Help Support the Baja Engine! Donate to Breezeway Studios!
GUIs

Search:

How To


GUIs in the Baja engine are easy to make with the built in 2d objects. The first step is to lay out a design for your interfaces in Photoshop or another image editor. Then, save all of the elements of the design as images (probably TGAs, see Creating TGAs with Alpha Channels. Then use level.add() to add Panels and TextPanels and adjust their properties to fit your design.

Code

level.add{type='Panel', name='bkg'}
obj.bkg.color.r=0
obj.bkg.color.g=0
obj.bkg.color.b=0
obj.bkg.scale.x=1
obj.bkg.scale.y=1
obj.bkg.percent=true
obj.bkg.pos.x=0
obj.bkg.pos.y=0

level.add{type='Panel', name='exitbutton'}
obj.exitbutton.percent=true
obj.exitbutton.pos.x=700/1600
obj.exitbutton.pos.y=-400/1200
obj.exitbutton:load('exit.tga')
obj.exitbutton.scale.x=obj.exitbutton.scale.x/1600
obj.exitbutton.scale.y=obj.exitbutton.scale.y/1200

--ect...

Sample Implementation


The Techdemo include a sample implementation of a GUI.