i assume its for doing 2d draw commands?
you can do them three ways...
1) just set the FlipHook function in the initial part of the program
function FlipHook() --or this works automatically without needing hooks.lua
SetBlend(1)
SetColor(Vec4(1,0,0,0.25))
DrawText("hello",50,300)
SetColor(Vec4(1,1,1,1))
SetBlend(0)
end
2) set a function with the hook command via "scripts/hooks" lua script
function DrawStuff()
SetBlend(1)
SetColor(Vec4(0,1,1,1))
DrawText("hello",0,300)
SetColor(Vec4(1,1,1,1))
SetBlend(0)
end
AddHook("Flip", DrawStuff)
3) and of course right before the Flip in the main loop
note that the FlipHook function doesnt play well with the AddHook's function in the standalone for some reason...
require("scripts/constants/engine_const")
require("scripts/hooks")
RegisterAbstractPath("")
Graphics(800,600)
fw=CreateFramework()
fw.main.camera:SetPosition(Vec3(0,0,-2))
light=CreateSpotLight(10)
light:SetRotation(Vec3(45,55,0))
light:SetPosition(Vec3(5,5,-5))
material=LoadMaterial("abstract::cobblestones.mat")
mesh=CreateCube()
mesh:Paint(material)
ground=CreateCube()
ground:SetScale(Vec3(10.0,1.0,10.0))
ground:SetPosition(Vec3(0.0,-2.0,0.0))
ground:Paint(material)
light=CreateDirectionalLight()
light:SetRotation(Vec3(45,45,45))
--add your own via hooks.lua
function DrawStuff()
SetBlend(1)
SetColor(Vec4(0,1,1,1))
DrawText("hello",0,300)
SetColor(Vec4(1,1,1,1))
SetBlend(0)
end
AddHook("Flip", DrawStuff)
--[[function FlipHook() --or this works automatically without needing hooks.lua
SetBlend(1)
SetColor(Vec4(1,0,0,0.25))
DrawText("hello",50,300)
SetColor(Vec4(1,1,1,1))
SetBlend(0)
end]]
while AppTerminate()==0 do
if KeyHit(KEY_ESCAPE)==1 then
break
end
mesh:Turn(Vec3(AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5))
fw:Update()
fw:Render()
-- or just add the 2d drawcommands here
SetBlend(1)
SetColor(Vec4(0,0,1,1))
DrawText("something",100,300)
SetColor(Vec4(1,1,1,1))
SetBlend(0)
Flip(0)
end