Source: src/cl_panel.cc


Annotated List
Files
Globals
Hierarchy
Index
//Status pannel

#include "cl_panel.h"

void PANEL::init()
{
	x = 0;
	xs = 640;
	y = 480-48;
	ys = 48;
	bmp = screen;
	obj = 0;
}

void PANEL::xys(int a, int b, int c, int d)
{
	x = a;
	y = b;
	xs = c;
	ys = d;
}

void PANEL::canvas(BITMAP *b)
{
	bmp = b;	
}

void PANEL::avatar(GAMEOBJ *o)
{
	obj = o;
}

GAMEOBJ* PANEL::avatar()
{
	return obj;
}

void PANEL::draw()
{
	rect(bmp, x, y, x + xs - 1, y + ys - 1 , COL_WHITE);
	rect(bmp, x + 1 , y + 1, x + xs - 2, y + ys - 2 , COL_GRAY3);
	rectfill(bmp, x + 2, y + 2, x + xs-3, y + ys-3, COL_BLACK);
	textprintf(bmp, font, x+10, y+10, COL_WHITE, 
			"Score: %d", data_score);
	textprintf(bmp, font, x+10, y+20, COL_WHITE, 
			"Energy: %d", data_energy);
}

void PANEL::update()
{
	if(obj) {
		data_score  = obj->get_property_int(OBJ_SCORE);
		data_energy = obj->get_property_int(OBJ_ENERGY);
	} else {
		data_score  = 0;
		data_energy = 0;
	}
}

void PANEL::refresh()
{
	update();
	draw();
}

void PANEL::drs_rectangle()
{
	DRS_add_rectangle(x, y, xs, ys);
}

Generated by: georgik on armada on Sat Jul 24 07:07:15 2004, using kdoc 2.0a54.