Window and general

[ Back ]

Here you'll find some things that just didn't fit anywhere else.

Sub routines

procedure set window x, y, w, h[, full_screen[, scale_factor]]
procedure set redraw value
procedure redraw
procedure wait ms
procedure wait keydown
procedure wait mousebutton
function fullscreen()
function active()
function time()
function rnd(n)
procedure randomize seed
args$[]
procedure shellexecute operation$, file$, path$, parameters$, waitForProcess


procedure set window x, y, w, h[, full_screen[, scale_factor]]

Place window at x, y and set its width and height to w and h. If full_screen is set to true, the window will have no borders and be stretched to cover the entire screen (that is, the screen mode is not actually changed as in previous NaaLaa versions). If scale_factor is set to a value greater than 1, the window and all the graphics will be scaled by that value. Mouse input coordinates are automatically scaled. For, example, if you'd like a 320x240 window scaled by 2, you'd write:

set window 0, 0, 320, 240, false, 2

procedure set redraw value

By default every operation that draws something to the primary image (the back buffer) will cause the entire image to be copied to the window. By setting value to false the primary image will only be copied when redraw is called.


procedure redraw

Copy the primary image to the window.


procedure wait ms

Sleep for ms milliseconds. Note that the window can only take care of its messages during a sleep period. If the keydown, mousex, mousey or mousebutton functions are used within a loop, the loop must contain a wait call. 0 is a valid value for ms.


procedure wait keydown

Wait for any key to be pressed.


procedure wait mousebutton

Wait for any mouse button to be pressed.


function fullscreen()

Return true if window is in fullscreen mode.


function active()

Return true if the window has got focus.


function time()

Return the current time in milliseconds.


function rnd(n)

Return a random number between 0 and n - 1.


procedure randomize seed

Send a new seed value to be used next time rnd is called. A normal thing is to use:

randomize time()

in the beginning of your program. But you can of course also force a certain random number sequence by passing an integer constant.


args$[]

If any arguments have been passed to your program when it starts, this array contains these arguments. The first argument (args[0]) is always the path to and filename of your program.

Note that the args array can also be used to pass arguments between program units.


procedure shellexecute operation$, file$, path$, parameters$, waitForProcess

Execute an external program/file. If waitForProcess is true, the program will wait for the new process to finish. Example for opening a webpage:

shellexecute "open", "http://www.naalaa.com", "", "", false

[ Back ]