function imgui.OnDrawFrame()

Thomasya

Известный
Автор темы
67
2
Версия MoonLoader
.026-beta
Здравствуйте. Некоторое время занят разработкой скрипта.
Суть вопроса в том что я хочу добавить несколько вкладок, в пред.идущем вопросе мне отправили ссылку на imgui C++.
Не могли бы вы помочь мне с реализацией вкладок. Один пример пожалуйста. Lua imGui вкладки
 

kizn

q(≧▽≦q)
Всефорумный модератор
2,405
2,107
Там есть вкладки вроде
 

sᴀxᴏɴ

это шд братик
Всефорумный модератор
788
855
Не могли бы вы подсказать как сделать что бы imgui открывалось по команде?
local mainwnd = imgui.ImBool(false) --начало скрипта
mainwnd.v = not mainwnd.v --команда
и проверку mainwnd.v в ondraw
в imgui.Begin вторым параметром mainwnd

п.с на форуме есть поиск
п.с.с это все есть в теме moon imgui
 
  • Вау
Реакции: kizn

Feed70

Участник
43
12
Не рабо :3
[14:14:15.207441] (error) Auto Piar for ARZ: ...ы\GTA_San_Andreas — мвд хелпер\moonloader\AutoPiarV2.lua:345: attempt to concatenate field 'ICON_FA_INFO_CIRCLE' (a nil value)
stack traceback:
...ы\GTA_San_Andreas — мвд хелпер\moonloader\AutoPiarV2.lua:345: in function 'Hint'
...ы\GTA_San_Andreas — мвд хелпер\moonloader\AutoPiarV2.lua:332: in function 'ButtonTelegram'
...ы\GTA_San_Andreas — мвд хелпер\moonloader\AutoPiarV2.lua:245: in function 'OnDrawFrame'
...ры\GTA_San_Andreas — мвд хелпер\moonloader\lib\imgui.lua:1377: in function <...ры\GTA_San_Andreas — мвд хелпер\moonloader\lib\imgui.lua:1366>
 

Hideme Flow

Известный
571
200
проверь всё ли так
Lua:
require "lib.moonloader" -- подключение библиотеки
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local fa = require 'faIcons'
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })

main_window_state = imgui.ImBool(false)

function imgui.BeforeDrawFrame()
    if fa_font == nil then
        local font_config = imgui.ImFontConfig() -- to use 'imgui.ImFontConfig.new()' on error
        font_config.MergeMode = true
        fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/resource/fonts/fontawesome-webfont.ttf', 14.0, font_config, fa_glyph_ranges)
    end
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("icons", cmd_icons)
    while true do
        wait(0)
    end
end

function cmd_icons(arg)
    main_window_state.v = not main_window_state.v
    imgui.Process = main_window_state.v
end

function imgui.OnDrawFrame()

    if not main_window_state.v then
        imgui.Process = false
    end

    if main_window_state.v then
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(200, 200), imgui.Cond.FirstUseEver)

        imgui.Begin(fa.ICON_PENCIL .. ' Imgui Icons', main_window_state, imgui.WindowFlags.NoCollapse)

        imgui.Button(fa.ICON_PICTURE_O .. ' AppStore')

        imgui.TextColoredRGB("{FF4500}" .. fa.ICON_TAXI .. u8"{708090} Привет", 2);

        imgui.End()
    end
end
 

Вложения

  • icons.lua
    1.7 KB · Просмотры: 33