General System Variables

int screen; // this is a hardcoded image handle for the screen
int systemtime; // read-only timer variable constantly increasing
int timer; // read/write timer variable
int key[scancode]; // read/write key-state array
int lastpressed; // read/write scancode of last pressed key
int lastkey; // read/write last key pressed in ASCII
int; // read-only, whether or not the game window in focus. 
To elaborate:
screen - Is a pointer to a bitmap of the screen's current dimensions (set in v3.cfg or by SetResolution() function at runtime). Anything you want to appear in ther verge window should be blitted here with one of the graphics functions. When ShowPage() is called the screen bitmap is transfered to the display.

systemtime - A read-only timer that stores the time elapsed since your program began, in centiseconds. Not to be confused with the time stored on your system clock. If you want to know what the current time settings are on a computer, see the Date/Time variables instead.

timer - A number than increases by 100 every second and very useful for anything you need to happen within a set timeframe. As you can re-set this value whenever you like, it's also possible to use it to work out how long ago something happened.

key[scancode] - Stores whether a key IS CURRENTLY PRESSED - so if the key was down the last time ShowPage() or UpdateControls() was called. If you want to use is like a HAS BEEN PRESSED state, you'll need to reset the value back to 0 each time manually. Unlike standard ASCII methods key['a'] will not work - verge has its own defines, look at the Scan Codes section to see them.

lastpressed - Stores the verge scancode of the last keyboard key the player pressed. See Scan Codes.

lastkey - Same as above, but stores proper ASCII, so 'a' = 97 = little a - Used to tell if the Verge game window is in focus or if the user minimized/alt-tabbed out of it for a second. Useful for stuff like pausing gameplay while inactive to go easier on the CPU.

b1, b2, b3, b4, up, down, left, right - General control variables for playing games in Verge. The directional buttons are self-explanatory. By default, b1 is the Enter key, b2 is the Alt key (either will do), b3 is Escape key, and b4 is the Space key. These buttons can be remapped using SetButtonKey(). Unlike the key[] scan codes, these buttons are also usable by joysticks and game controllers.

Post a new comment?

Talkback #2 written by vecna on 2004-09-18.

A note about "systemtime" and "timer", and RageCage's comment: If you never write to timer, then systemtime and timer will always be the same value. systemtime is read-only, timer is read/write. The idea is that you can use "timestamp" type logic with systemtime, and you're free to zero out timer for whatever you like to make timing code for things like fades a little bit simpler. Both increment 100 times per second (unless the user.cfg option 'gamerate' has been modified).

Talkback #1 written by RageCage on 2004-07-21.

Timer is a read/write variable but it's a bad idea to ever write to it because it may interfere with other functions using the same variable. The way around that is to use timeStamps to zero-out the timer for use when checking how much time has went by. Example:

int timeStamp=timer;

if(timer- timeStamp > 100){
    //run this code once every second

Post a new comment?

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford. is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.