два imgui.WindowFlags

Kir

Участник
Автор темы
49
3
Версия MoonLoader
Другое
Нужно сделать NoResize совместно с NoCollapse, и убрать крестик
code:
local success, imgui = pcall(require, 'mimgui')
if not success then
    print('error 101 (mimgui not found!)')
end
local success, ffi = pcall(require, 'ffi')
if not success then
    print('error 102 (ffi not found)')
end
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local window = imgui.new.bool(true)

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
end)

local active = imgui.new.bool(false)
local text = imgui.new.char[64]()

imgui.OnFrame(
    function() return true end,
    function(this)
        local size, res = imgui.ImVec2(450, 250), imgui.ImVec2(getScreenResolution())
        imgui.SetNextWindowSize(size, imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver,
        imgui.ImVec2(0.5, 0.5))
        if (imgui.Begin('Apathy', window, imgui.WindowFlags.NoCollapse)) then
            if (imgui.Button(u8'test')) then
                sampSendChat('test') return
            end
        end
        imgui.End()
end)
 

хуега)

РП игрок
Модератор
2,576
2,279
Нужно сделать NoResize совместно с NoCollapse, и убрать крестик
code:
local success, imgui = pcall(require, 'mimgui')
if not success then
    print('error 101 (mimgui not found!)')
end
local success, ffi = pcall(require, 'ffi')
if not success then
    print('error 102 (ffi not found)')
end
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local window = imgui.new.bool(true)

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
end)

local active = imgui.new.bool(false)
local text = imgui.new.char[64]()

imgui.OnFrame(
    function() return true end,
    function(this)
        local size, res = imgui.ImVec2(450, 250), imgui.ImVec2(getScreenResolution())
        imgui.SetNextWindowSize(size, imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver,
        imgui.ImVec2(0.5, 0.5))
        if (imgui.Begin('Apathy', window, imgui.WindowFlags.NoCollapse)) then
            if (imgui.Button(u8'test')) then
                sampSendChat('test') return
            end
        end
        imgui.End()
end)
Замени название флагов на свои: imgui.Begin("test", nil, 1flag + 2 flag + 3flag)
 
  • Нравится
Реакции: MLycoris

хуега)

РП игрок
Модератор
2,576
2,279
ему же крестик убрать надо
А, тогда наоборот, не надо указывать второй параметр, вместо него nil или 0 (вроде 0 тоже катати)

а как в моём коде сделать открытие окна мимгуи через команду?
Lua:
local success, imgui = pcall(require, 'mimgui')
if not success then
    print('error 101 (mimgui not found!)')
end
local success, ffi = pcall(require, 'ffi')
if not success then
    print('error 102 (ffi not found)')
end
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local window = imgui.new.bool(true)



function main()
    while not isSampAvailable() do wait(0) end
    
    -- Регистрируем команду, в которую передаем название и функцию, которая вызовется при ее вводе
    sampRegisterChatCommand("imgui", function()
        -- Изменяем значение для переменной, отвечающей за активность окна
        window[0] = not window[0]
    end)
    
    wait(-1)
end



imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
end)

local active = imgui.new.bool(false)
local text = imgui.new.char[64]()

imgui.OnFrame(
    -- Вместо true, ставим window[0] (наш переключатель активности окна)
    function() return window[0] end,
    function(this)
        local size, res = imgui.ImVec2(450, 250), imgui.ImVec2(getScreenResolution())
        imgui.SetNextWindowSize(size, imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver,
        imgui.ImVec2(0.5, 0.5))
        -- Ставим nil, дабы не было крестика
        if (imgui.Begin('Apathy', nil, imgui.WindowFlags.NoCollapse)) then
            if (imgui.Button(u8'test')) then
                sampSendChat('test') return
            end
        end
        imgui.End()
end)
 
  • Нравится
Реакции: MrDorlik