Yue Posted July 29, 2017 Share Posted July 29, 2017 AddHook no Working on Lua. What does debug.sethook do? In the following code, the FPS information is displayed regardless of whether it is before the World: Render --================================================= -- Proyecto : Mars. -- -- Scripter : Yue Rexie. -- -- Archivo : Main.lua -- --================================================= -- Nota : Fichero principal del motor. -- --================================================= -- Imports. import("Imports/VariablesG.lua") --Variables Locales. local tituloAPP = "Mars | v.0.0 | Alpha" local mapa = 0 -- Sistema Gráfico. ventana = Window:Create(tituloAPP, 0, 0, 800, 600, Window.Titlebar + Window.Center ) -- ventana:SetLayout(0,0, 800,600 ) lienzo = Context:Create( ventana ) -- Se crea el mundo. mundo = World:Create() - Here function DrawFPS() lienzo:SetBlendMode(Blend.Alpha) lienzo:DrawText("FPS : "..Time:UPS(),2,2) lienzo:SetBlendMode(Blend.Solid) end debug.sethook(DrawFPS,"l") -- Bucle de carga mapa. while mapa == 0 do --Time:Delay (5000 ) -- Cargando Mapa. Time:Update() mundo:Update() mundo:Render() lienzo:Sync() mapa = Map:Load("Maps/start.map","l") end -- Bucle Principal. while true do -- Salir. if ventana:Closed() or ventana:KeyHit(Key.Escape) then return false end Time:Update() mundo:Update() mundo:Render() --DrawFPS() lienzo:Sync() end -- mundo:Clear() Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 29, 2017 Share Posted July 29, 2017 Perform the hook as shown here: 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.