GLBasic User Manual

Main sections

HIBERNATE

HIBERNATE



The HIBERNATE command puts the program into a sleep mode until the user does something (moves the mouse, presses a key, touches the joystick, ...)
With this command CPU load can be reduced drastically . If you're writing a level editor for example where you don't have to update the display every frame for animations, putting a HIBERNATE command in your code will allow other programs to use the CPU while no work is required by your program.
Using this command offers laptops and pocketpc devices a longer battery lifetime.

// --------------------------------- //
// Project: Hibernate
// Start: Tuesday, May 04, 2004
// IDE Version: 1.40430
WHILE TRUE
    a$=""
    FOR i=0 TO 255
        IF KEY(i) THEN a$=a$+i+", "
    NEXT
    MOUSESTATE mx, my, b1, b2
    JOYSTATE jx,jy,jb1,jb2
    PRINT a$, 0,0
    PRINT "Mx:"+mx+" My:"+my+" b1:"+b1+" b2:"+b2, 0,40
    PRINT "Jx:"+jx+" Jy:"+jy+" b1:"+jb1+" b2:"+jb2, 0,80
    SHOWSCREEN
    HIBERNATE
WEND

See also...