[LUA] Здравствуйте, как получить фпс в Imgui? [LUA]

Immortal-

Участник
Автор темы
67
1
Здравствуйте, как получить фпс в игре Гта для выыода в Imgui?
 
Решение
не проверял в игре, но вроде должно работать
Lua:
local imgui = require 'imgui'

local mainWindowState = imgui.ImBool(false)
local dt = 0

function imgui.OnDrawFrame()
  if mainWindowState.v then
    imgui.Begin('TITLE', mainWindowState)
    imgui.Text('FPS: ' .. 1 / dt)
    imgui.End()
  end
end

function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
  while not isSampAvailable() do wait(0) end

  sampRegisterChatCommand('test', function()
    mainWindowState.v = not mainWindowState.v
  end)
  local t = os.clock()
  while true do
    dt = os.clock() - t
    t = os.clock()
    wait(0)
  end
end

Akionka

akionka.lua
Проверенный
742
500
не проверял в игре, но вроде должно работать
Lua:
local imgui = require 'imgui'

local mainWindowState = imgui.ImBool(false)
local dt = 0

function imgui.OnDrawFrame()
  if mainWindowState.v then
    imgui.Begin('TITLE', mainWindowState)
    imgui.Text('FPS: ' .. 1 / dt)
    imgui.End()
  end
end

function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
  while not isSampAvailable() do wait(0) end

  sampRegisterChatCommand('test', function()
    mainWindowState.v = not mainWindowState.v
  end)
  local t = os.clock()
  while true do
    dt = os.clock() - t
    t = os.clock()
    wait(0)
  end
end
 
  • Нравится
Реакции: Immortal-

imring

Ride the Lightning
Всефорумный модератор
2,355
2,517
не проверял в игре, но вроде должно работать
Lua:
local imgui = require 'imgui'

local mainWindowState = imgui.ImBool(false)
local dt = 0

function imgui.OnDrawFrame()
  if mainWindowState.v then
    imgui.Begin('TITLE', mainWindowState)
    imgui.Text('FPS: ' .. 1 / dt)
    imgui.End()
  end
end

function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
  while not isSampAvailable() do wait(0) end

  sampRegisterChatCommand('test', function()
    mainWindowState.v = not mainWindowState.v
  end)
  local t = os.clock()
  while true do
    dt = os.clock() - t
    t = os.clock()
    wait(0)
  end
end
 
  • Грустно
Реакции: Akionka