J
JoeC
I have kinda complex question. I am writing a game program and I am
trying to derrive things from my graphic library. For starters I want
to derrive the terrain from my graphics so that I can re-use my
graphics for other things like units. My graphic library works fine.
All I changed was graphic * trn to terrain trn[5]. So I am calling it
from a non-pointer array.
Here is some of what I got, if more is needed let me know:
static graphic * g1; <- this is a graphic that displays fine.
static terrain trn[5]; <- this object works but doesn't display
graphics.
g1 = new graphic(pgr); <-creating a graphic with a BYTE type
trn[0].SetAll(255, 255, 255, bits); creating terrain with color
and BYTE type
trn[1].SetAll(0 , 255, 0 , bits);
if(b->GetSpace(y,x)){
num = b->GetSpace(y,x);
SetTextColor(hdc,RGB(trn[num].red(), trn[num].grn(),
trn[num].blu()));
trn[num].display(hwnd,convert(y),convert(x)); <-This
worked as a graphic
but not derrived in terrain
g1->display(hwnd, convert(3),convert(5)); <-This displays find
which I use the same code as the base of the terrain object.
class terrain : public graphic{
float mvcost;
int defence;
int r, g, b;
public:
terrain(): r(0), g(0), b(0){}
terrain(int, int, int);
void SetColor(int rn, int bn, int gn){r = rn; b = bn; g = gn;}
void SetAll(int, int, int, BYTE c[]);
int red(){return r;}
int grn(){return g;}
int blu(){return b;}
float move(){return mvcost;}
};
Basically I don't understand why graphic is not working as base of
terrain.
trying to derrive things from my graphic library. For starters I want
to derrive the terrain from my graphics so that I can re-use my
graphics for other things like units. My graphic library works fine.
All I changed was graphic * trn to terrain trn[5]. So I am calling it
from a non-pointer array.
Here is some of what I got, if more is needed let me know:
static graphic * g1; <- this is a graphic that displays fine.
static terrain trn[5]; <- this object works but doesn't display
graphics.
g1 = new graphic(pgr); <-creating a graphic with a BYTE type
trn[0].SetAll(255, 255, 255, bits); creating terrain with color
and BYTE type
trn[1].SetAll(0 , 255, 0 , bits);
if(b->GetSpace(y,x)){
num = b->GetSpace(y,x);
SetTextColor(hdc,RGB(trn[num].red(), trn[num].grn(),
trn[num].blu()));
trn[num].display(hwnd,convert(y),convert(x)); <-This
worked as a graphic
but not derrived in terrain
g1->display(hwnd, convert(3),convert(5)); <-This displays find
which I use the same code as the base of the terrain object.
class terrain : public graphic{
float mvcost;
int defence;
int r, g, b;
public:
terrain(): r(0), g(0), b(0){}
terrain(int, int, int);
void SetColor(int rn, int bn, int gn){r = rn; b = bn; g = gn;}
void SetAll(int, int, int, BYTE c[]);
int red(){return r;}
int grn(){return g;}
int blu(){return b;}
float move(){return mvcost;}
};
Basically I don't understand why graphic is not working as base of
terrain.