Macros

The following macros are predefined in include\acknex.h for making life easier and code shorter.  !!  Valuable hint: look into acknex.h for checking what a certain macro is doing before using it. Macros in a programming language are notorious for causing trouble when used in a wrong way. So don't use a macro without knowing which code it generates.

set(obj,flag)

reset(obj,flag)

toggle(obj,flag)

Sets, resets, or toggles one or several flags in the flags parameter of the given object pointer.

Examples:

set(mpanel,SHOW | TRANSLUCENT);
reset(myview,SHOW | AUDIBLE);
toggle(my,PASSABLE);

is(obj,flag)

Checks whether the flag is set in the flags parameter of the given object pointer.

Example:

if (is(my,INVISIBLE)) ptr_remove(me);

zero(struct)

vec_zero(vector)

Sets the given struct´or vector to zero; useful for initializing local variables in functions.  !!  Be aware that zero() can only clear a struct, but not a struct pointer or engine object.

Example:

function foo() 
{

  ANGLE my_angle;
  struct MYTYPE my_struct;
  ...
  vec_zero(my_angle);
  zero(my_struct); // don't use this for struct pointers or engine objects!
}

wait_for(function)

Waits for the completion of all instances of the given function.

Example:

function foo() 
{
  int i;
  for (i=0; i<100; i++) { wait(1); }
}
...
foo();
wait_for(foo); // wait until foo is terminated

COLOR_WHITE, COLOR_BLUE, COLOR_GREEN, COLOR_RED, COLOR_GREY, COLOR_BLACK

Some often-used color vectors.

DEBUG_VAR(variable, pos_y)

Draws the variable content in red letters on the screen at the given vertical position. Can be used for quick debugging one or several local variables in a while loop.

Example:

action rotate_me() {
  while(1) {
    my.pan += 0.1*time_step; 
    DEBUG_VAR(my.pan,10);
    wait(1);
  }
}

DEBUG_BMAP(bmap, pos_x, scale)

Draws the bitmap on the screen at the given horizontal position and scaled by the given factor. Can be used for quick debugging the content of bitmaps in a while loop - especially useful for render targets in a view stage chain.

 

See also:

#define, flags, proc_status ► latest version online