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:
- The object is only written for 1 frame, so for displaying it permanently
you need a while ... wait(1)
loop.
- Flags, color, screen position, and other properties can be set immediately before drawing the object.
- The SHOW flag of the object needs not be set. The layer parameter of the object has no effect on the drawing order.
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