Jump to content

debug.sethook?


Yue
 Share

Recommended Posts

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()

 

 

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...