draw_obj(void* ptr)

Writes a layered object - a text, panel, or view entity - on the screen in the current frame. A7.81 LC

Parameters:

ptr TEXT*, PANEL*, or view ENTITY* pointer to be drawn.

Remarks:

Speed:

Medium

Example (lite-C):

// TEXT object to hold the player name
TEXT* txtPlayerName =
{
   strings = 1;
   flags = CENTER_X;
   font = "Arial#13bi";
}

// Display the entities' string1 above its head
// Call this function in the entities' while loop
function show_my_name()
{
  VECTOR* vTextpos = vector(my.x,my.y,my.z+my.max_z+5); // 5 quants above head
  vec_to_screen(vTextpos,camera);   // convert to screen coordinates
  txtPlayerName.pos_x = vTextpos.x; // set the position
  txtPlayerName.pos_y = vTextpos.y;
  str_cpy((txtPlayerName.pstring)[0],my.string1); // set the TEXT string
  draw_obj(txtPlayerName);
}

See also:

draw_text, TEXT, PANEL, ENTITY

► latest version online