This content is provided AS IS for archive purposes only. Content may be out of date with no guarantee of correctness.

HagInit - Main Functions - Hag GUI for Cobra - Static

Main Article

HagInit - Main Functions - Hag GUI for Cobra

Procedure HagInit(screenw: Integer, screenh: Integer, index: Integer=0)

Set screenw to the screen width and screenh to the screen height.

Optionally, specify a value for index. This causes hag to start creating elements with a certain sprite z-index. For example, if you have a background sprite, you would specify an index of 1 to cause hag to appear above this layer.

HagInit is a vital command that sets some crucial variables, clears old hag log files, sets default preferences, sets some sane default theme styles, initialises logging and initialises millisecond-based timers.

If you have moved or renamed the hag directory so that it is not available at the default path of "hag/", you must first use the procedure HagBaseDir to tell hag where the directory is. With HagBaseDir as the only exception, HagInit is always the first hag command you will call.

Then, before loading any hag GUI elements, you should first load a theme with HagLoadGuiTheme.

Example:

Program
   Uses

       cobra2D,
       hagC2D,
       keyset

Begin
   OpenScreen(640,480,32,FALSE)
   
   HagBaseDir("hag\")
   HagInit(640, 480)    
   HagLoadGuiTheme("xp")

   // SetUp Your Controls...
   
   HagUpdateOnce()
   
   While Not KeyDown(VK_ESCAPE)
   
       // Update Your Controls...
   
       HagUpdateAll_AutoKeys()
           
       Flip
       Pause
(1)
   Wend
   
   HagFreeAll()
End

Stay Subscribed

Follow me on twitter @golightlyb, subscribe to the RSS feed or get updates by e-mail.

You can also contact me directly - I make an effort to reply to every e-mail.


Login
v0.34.archive