Imgui lua

The еnd.

Активный
Автор темы
235
41
Что надо прописать в коде что бы вызывать меню imgui по команде?
 
Решение
Lua:
local imgui = require 'imgui'

local main_window_state = imgui.ImBool(false)

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('yourcmd',function ()
        main_window_state.v = not main_window_state.v
    end)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
    end
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.Begin('imgui', main_window_state)
        imgui.Text('Hello world!')
        imgui.End()
    end
end

Bredd Lane

Известный
423
350
Lua:
local imgui = require 'imgui'

local main_window_state = imgui.ImBool(false)

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('yourcmd',function ()
        main_window_state.v = not main_window_state.v
    end)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
    end
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.Begin('imgui', main_window_state)
        imgui.Text('Hello world!')
        imgui.End()
    end
end
 
  • Нравится
Реакции: The еnd.

The еnd.

Активный
Автор темы
235
41
Lua:
local imgui = require 'imgui'

local main_window_state = imgui.ImBool(false)

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('yourcmd',function ()
        main_window_state.v = not main_window_state.v
    end)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
    end
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.Begin('imgui', main_window_state)
        imgui.Text('Hello world!')
        imgui.End()
    end
end
У меня хуйня выходит
Как эту менюшку вывести с помощью команды?

Lua:
-- Export Info: ImGUI Editor 0.0.1 by Pakulichev

local imgui = require 'imgui'

local main_window_state = imgui.ImBool(false)

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('kzhv',function ()
        main_window_state.v = not main_window_state.v
    end)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
    end
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.Begin('imgui', main_window_state)
        imgui.Text('Hello world!')
        imgui.End()
    end
end
local imgui = require 'mimgui';
local ffi = require 'ffi';
local encoding = require 'encoding';
encoding.default = 'CP1251';
local u8 = encoding.UTF8;

local pWindow = imgui.new.bool(true); -- main window handle, change to show & hide
local button2Callback = function() end
local checkbox3Checked = imgui.new.bool(false);
local inputtext4Value = imgui.new.char[128]();

imgui.OnInitialize(function()
    imgui.StyleColorsLight();
    imgui.GetIO().IniFilename = nil
    scrX, scrY = getScreenResolution()
    local glyph_ranges = imgui.GetIO().Fonts:GetGlyphRangesCyrillic();
    --imgui.GetIO().Fonts:Clear();
    imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\arial.ttf', 16, nil, glyph_ranges);
    imgui.InvalidateFontsTexture();
end);

imgui.OnFrame(function() return pWindow[0] end,
function(self)
    self.HideCursor = false;
    self.LockPlayer = true;
    imgui.SetNextWindowPos(imgui.ImVec2(scrX / 2, scrY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5));
    imgui.SetNextWindowSize(imgui.ImVec2(840.000000, 650.000000), imgui.Cond.FirstUseEver);
    imgui.PushStyleColor(imgui.Col.TitleBgActive, imgui.ImVec4(0.800000,0.800000,0.800000,1.000000));
    imgui.PushStyleColor(imgui.Col.WindowBg, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
    imgui.Begin('New Window', nil, imgui.WindowFlags.NoResize);
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.209671,1.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(10.000000,30.000000));
    imgui.Text('faded fam script');
    imgui.PopStyleColor();
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(95.000000,45.000000));
    imgui.Text('');
    imgui.PopStyleColor();
    imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
    imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
    imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(49.000000,105.000000));
    if(imgui.Button('New Button', imgui.ImVec2(100.000000,50.000000))) then
        button2Callback();
    end
    imgui.PopStyleColor(4);
    imgui.PushStyleColor(imgui.Col.FrameBg, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.FrameBgActive, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.FrameBgHovered, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.CheckMark, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(50.000000,78.000000));
    imgui.Checkbox('New Checkbox', checkbox3Checked);
    imgui.PopStyleColor(5);
    imgui.PushStyleColor(imgui.Col.FrameBg, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.FrameBgActive, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.FrameBgHovered, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(50.000000,50.000000));
    imgui.PushItemWidth(200.000000);
    imgui.InputTextWithHint('##input4', 'wtf', inputtext4Value, ffi.sizeof(inputtext4Value)-1);
    imgui.PopItemWidth();
    imgui.PopStyleColor(4);
    imgui.End();
    imgui.PopStyleColor(2);
end);
 

Bredd Lane

Известный
423
350
У меня хуйня выходит
Как эту менюшку вывести с помощью команды?

Lua:
-- Export Info: ImGUI Editor 0.0.1 by Pakulichev

local imgui = require 'imgui'

local main_window_state = imgui.ImBool(false)

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('kzhv',function ()
        main_window_state.v = not main_window_state.v
    end)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
    end
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.Begin('imgui', main_window_state)
        imgui.Text('Hello world!')
        imgui.End()
    end
end
local imgui = require 'mimgui';
local ffi = require 'ffi';
local encoding = require 'encoding';
encoding.default = 'CP1251';
local u8 = encoding.UTF8;

local pWindow = imgui.new.bool(true); -- main window handle, change to show & hide
local button2Callback = function() end
local checkbox3Checked = imgui.new.bool(false);
local inputtext4Value = imgui.new.char[128]();

imgui.OnInitialize(function()
    imgui.StyleColorsLight();
    imgui.GetIO().IniFilename = nil
    scrX, scrY = getScreenResolution()
    local glyph_ranges = imgui.GetIO().Fonts:GetGlyphRangesCyrillic();
    --imgui.GetIO().Fonts:Clear();
    imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\arial.ttf', 16, nil, glyph_ranges);
    imgui.InvalidateFontsTexture();
end);

imgui.OnFrame(function() return pWindow[0] end,
function(self)
    self.HideCursor = false;
    self.LockPlayer = true;
    imgui.SetNextWindowPos(imgui.ImVec2(scrX / 2, scrY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5));
    imgui.SetNextWindowSize(imgui.ImVec2(840.000000, 650.000000), imgui.Cond.FirstUseEver);
    imgui.PushStyleColor(imgui.Col.TitleBgActive, imgui.ImVec4(0.800000,0.800000,0.800000,1.000000));
    imgui.PushStyleColor(imgui.Col.WindowBg, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
    imgui.Begin('New Window', nil, imgui.WindowFlags.NoResize);
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.209671,1.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(10.000000,30.000000));
    imgui.Text('faded fam script');
    imgui.PopStyleColor();
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(95.000000,45.000000));
    imgui.Text('');
    imgui.PopStyleColor();
    imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
    imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
    imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(49.000000,105.000000));
    if(imgui.Button('New Button', imgui.ImVec2(100.000000,50.000000))) then
        button2Callback();
    end
    imgui.PopStyleColor(4);
    imgui.PushStyleColor(imgui.Col.FrameBg, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.FrameBgActive, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.FrameBgHovered, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.CheckMark, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(50.000000,78.000000));
    imgui.Checkbox('New Checkbox', checkbox3Checked);
    imgui.PopStyleColor(5);
    imgui.PushStyleColor(imgui.Col.FrameBg, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.FrameBgActive, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.FrameBgHovered, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
    imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
    imgui.SetCursorPos(imgui.ImVec2(50.000000,50.000000));
    imgui.PushItemWidth(200.000000);
    imgui.InputTextWithHint('##input4', 'wtf', inputtext4Value, ffi.sizeof(inputtext4Value)-1);
    imgui.PopItemWidth();
    imgui.PopStyleColor(4);
    imgui.End();
    imgui.PopStyleColor(2);
end);
попробуй
Lua:
-- Export Info: ImGUI Editor 0.0.1 by Pakulichev

local imgui = require 'mimgui';
local ffi = require 'ffi';
local encoding = require 'encoding';
encoding.default = 'CP1251';
local u8 = encoding.UTF8;

local pWindow = imgui.new.bool(true); -- main window handle, change to show & hide
local button2Callback = function() end
local checkbox3Checked = imgui.new.bool(false);
local inputtext4Value = imgui.new.char[128]();

imgui.OnInitialize(function()
    imgui.StyleColorsLight();
    imgui.GetIO().IniFilename = nil
    scrX, scrY = getScreenResolution()
    local glyph_ranges = imgui.GetIO().Fonts:GetGlyphRangesCyrillic();
    --imgui.GetIO().Fonts:Clear();
    imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\arial.ttf', 16, nil, glyph_ranges);
    imgui.InvalidateFontsTexture();
end);

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('kzhv',function ()
        pWindow.v = not pWindow.v
    end)
    while true do
        wait(0)
        imgui.Process = pWindow.v
    end
end

imgui.OnFrame(function() return pWindow[0] end,
function(self)
    if pWindow.v then
        self.HideCursor = false;
        self.LockPlayer = true;
        imgui.SetNextWindowPos(imgui.ImVec2(scrX / 2, scrY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5));
        imgui.SetNextWindowSize(imgui.ImVec2(840.000000, 650.000000), imgui.Cond.FirstUseEver);
        imgui.PushStyleColor(imgui.Col.TitleBgActive, imgui.ImVec4(0.800000,0.800000,0.800000,1.000000));
        imgui.PushStyleColor(imgui.Col.WindowBg, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
        imgui.Begin('New Window', nil, imgui.WindowFlags.NoResize);
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.209671,1.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(10.000000,30.000000));
        imgui.Text('faded fam script');
        imgui.PopStyleColor();
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(95.000000,45.000000));
        imgui.Text('');
        imgui.PopStyleColor();
        imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
        imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
        imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(49.000000,105.000000));
        if(imgui.Button('New Button', imgui.ImVec2(100.000000,50.000000))) then
            button2Callback();
        end
        imgui.PopStyleColor(4);
        imgui.PushStyleColor(imgui.Col.FrameBg, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.FrameBgActive, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.FrameBgHovered, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.CheckMark, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(50.000000,78.000000));
        imgui.Checkbox('New Checkbox', checkbox3Checked);
        imgui.PopStyleColor(5);
        imgui.PushStyleColor(imgui.Col.FrameBg, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.FrameBgActive, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.FrameBgHovered, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(50.000000,50.000000));
        imgui.PushItemWidth(200.000000);
        imgui.InputTextWithHint('##input4', 'wtf', inputtext4Value, ffi.sizeof(inputtext4Value)-1);
        imgui.PopItemWidth();
        imgui.PopStyleColor(4);
        imgui.End();
        imgui.PopStyleColor(2);
    end
end);
 

The еnd.

Активный
Автор темы
235
41
1601561426301.png

попробуй
Lua:
-- Export Info: ImGUI Editor 0.0.1 by Pakulichev

local imgui = require 'mimgui';
local ffi = require 'ffi';
local encoding = require 'encoding';
encoding.default = 'CP1251';
local u8 = encoding.UTF8;

local pWindow = imgui.new.bool(true); -- main window handle, change to show & hide
local button2Callback = function() end
local checkbox3Checked = imgui.new.bool(false);
local inputtext4Value = imgui.new.char[128]();

imgui.OnInitialize(function()
    imgui.StyleColorsLight();
    imgui.GetIO().IniFilename = nil
    scrX, scrY = getScreenResolution()
    local glyph_ranges = imgui.GetIO().Fonts:GetGlyphRangesCyrillic();
    --imgui.GetIO().Fonts:Clear();
    imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\arial.ttf', 16, nil, glyph_ranges);
    imgui.InvalidateFontsTexture();
end);

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('kzhv',function ()
        pWindow.v = not pWindow.v
    end)
    while true do
        wait(0)
        imgui.Process = pWindow.v
    end
end

imgui.OnFrame(function() return pWindow[0] end,
function(self)
    if pWindow.v then
        self.HideCursor = false;
        self.LockPlayer = true;
        imgui.SetNextWindowPos(imgui.ImVec2(scrX / 2, scrY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5));
        imgui.SetNextWindowSize(imgui.ImVec2(840.000000, 650.000000), imgui.Cond.FirstUseEver);
        imgui.PushStyleColor(imgui.Col.TitleBgActive, imgui.ImVec4(0.800000,0.800000,0.800000,1.000000));
        imgui.PushStyleColor(imgui.Col.WindowBg, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
        imgui.Begin('New Window', nil, imgui.WindowFlags.NoResize);
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.209671,1.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(10.000000,30.000000));
        imgui.Text('faded fam script');
        imgui.PopStyleColor();
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(95.000000,45.000000));
        imgui.Text('');
        imgui.PopStyleColor();
        imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
        imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
        imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.240000,0.650000,0.870000,1.000000));
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(49.000000,105.000000));
        if(imgui.Button('New Button', imgui.ImVec2(100.000000,50.000000))) then
            button2Callback();
        end
        imgui.PopStyleColor(4);
        imgui.PushStyleColor(imgui.Col.FrameBg, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.FrameBgActive, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.FrameBgHovered, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.CheckMark, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(50.000000,78.000000));
        imgui.Checkbox('New Checkbox', checkbox3Checked);
        imgui.PopStyleColor(5);
        imgui.PushStyleColor(imgui.Col.FrameBg, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.FrameBgActive, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.FrameBgHovered, imgui.ImVec4(0.000000,0.000000,0.000000,1.000000));
        imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(1.000000,1.000000,1.000000,1.000000));
        imgui.SetCursorPos(imgui.ImVec2(50.000000,50.000000));
        imgui.PushItemWidth(200.000000);
        imgui.InputTextWithHint('##input4', 'wtf', inputtext4Value, ffi.sizeof(inputtext4Value)-1);
        imgui.PopItemWidth();
        imgui.PopStyleColor(4);
        imgui.End();
        imgui.PopStyleColor(2);
    end
end);