- 54
- 4
- Версия SA-MP
-
- 0.3.7 (R1)
Появилась проблема, хочу перейти на мимгуи и сделать темы для скрипта из imgui_themes.lua. Выбор тем делаю в виде чайлд окна и радиобатон, перебор всего списка при помощи цикла for и ipairs, но как я нажимаю на кнопки, ничего не происходит, а в логах imgui_themes терминейтед)
lua pizdec:
require("lib.moonloader")
local imgui = require 'mimgui'
local vkeys = require 'vkeys'
local wm = require 'windows.message'
local new = imgui.new
local page = 0
local themes = import("resource/imgui_themes.lua")
local renderWindow = new.bool()
local sizeX, sizeY = getScreenResolution()
local theme_radio = new.int()
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
imgui.SwitchContext()
end);
local newFrame = imgui.OnFrame(
function() return renderWindow[0] end,
function(player)
imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(300, 250), imgui.Cond.FirstUseEver)
imgui.Begin("MimguiTest by Reuz", renderWindow, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize)
imgui.SetCursorPos(imgui.ImVec2(10,25))
if imgui.Button("Osnova") then
page = 1
end
imgui.SetCursorPos(imgui.ImVec2(240,25))
if imgui.Button("Settings") then
page = 2
end
imgui.Separator()
if (page==1) then
if imgui.Button('Maze Bank') then
setCharCoordinates(PLAYER_PED, 1560.81, -1358.15, 329.45) end
end
if (page==2) then
imgui.BeginChild("ChildWindow2", imgui.ImVec2(200, 175), true)
for i, value in ipairs(themes.colorThemes) do
if imgui.RadioButtonIntPtr(value, theme_radio, i) then
themes.SwitchColorTheme(i)
end
end
imgui.EndChild()
end
imgui.End()
end)
function main()
sampAddChatMessage("{FFFFFF}Script mimgui loaded")
addEventHandler('onWindowMessage', function(msg, wparam, lparam)
if msg == wm.WM_KEYDOWN or msg == wm.WM_SYSKEYDOWN then
if wparam == vkeys.VK_F3 then
renderWindow[0] = not renderWindow[0]
end
end
end)
wait(-1)
end