Oren Game Engine
its time to see what i can do with it...
Sunday, June 24, 2007
there is a lot of updates, the must important ones is: events and if expressions.
here is the list of events supported by the system:
onTime - Runs the event at T+
onMouseEnter - Runs the event when the mouse enters the window rectangle.
onMouseExit - Runs the event when the mouse exits the window rectangle.
onEnter - Runs this event when the user presses enter.
onEnterRelease - Runs this event when the user lets go of the enter key.
those events are must if you need to do some hover effects, or press/release button actions.
if expression adds a lot of freedom when you want the gui stay small and responds to other gui variables, controls properties or game cvars.
rect 0, 0, 640, 480
background 0, 0, 0, 1
float "fTest" 0
if ("desktop::fTest" == 0)
background 0, 0, 0, 1
if ("desktop::fTest" == 1)
background 1, 0, 0, 1
set "desktop:fTest" "1"
this simple script creates desktop window with 680x480, black background and one variable called "fTest" (initialized to zero)
when the mouse enters window rect it changes the background according to "fTest" value,
because "fTest" is zero, the background will stay black everytime the mouse enters.
when we press the enter key, "fTest" will set to one, and now if we move the mouse into window rect the background will change to red.
i also added more controls:
ChoichBox (choichDef) - A window that allows the user to toggle between a few different choices.
ScrollBar (sliderDef) - The volume control is a scrollbar, as are the scroll bars in listbox windows.
ListBox (listDef) - A window that displays a list of items. support multi column and alignment for each column.
i added cvar property to few controls (editBox, scrollBar, choichBox), which is the cvar to attach to. It displays the value of the cvar, and changes the cvar when the user changes the value of the control.
i also fix few issues with font scale rendering,
id uses 3 sizes for each font type and store it in 3 files fontname_12/_24/_48.extension,
the textscale property of the controls used to determine which font file we should use and in what scale to render the text.
(1) if textscale less than or equal to 0.3 use font file with _12 (font size 12 pixels)
(2) if textscale larger than 0.3 and 0.6 or less use font file with _24 (font size 24 pixels)
(3) if textscale larger than 0.6 use font file with _48 (font size 48 pixels)
after we know which file to use, we compute the render scale of the text we want to display, this is by checking the value of the textscale against the range it falls in, for example
if textscale is 0.3 we know from (1) that we need to use font with size 12, and the render scale is 1.0 because the range of (1) is [0, 0.3] and 0.3 is 100% of this range.
if textscale is 0.15 the render scale is 0.5 because 0.15 is 50% of this range.
i also changed my font files generator tool to:
Bitmap Font Generator v1.8c by Andreas Jצnsson (www.AngelCode.com)
it take less space when using fonts with large sizes such as 24 and 48.
this tool make sure every black area will be filled with the right character and not just putting the characters with equal distance between them, for example the characters '_' and '-' will take 2 areas of size 48 in the old tool, and with the new they take hardly one area, it basically compute character rectangle and fit it where he can by keeping track of empty and filled areas inside the texture.
Share to Twitter
Share to Facebook
Share to Pinterest