>
> The class is OK at least for the code I can see, but many relevant parts =
> are missing. Most importantly, whe and how do you change the color of =
> the widget? Do you call widget->redraw() after changing the color? And =
> do you return to the main loop, so the actual drawing can take place?
>
>
the coordinates that are passed in create a 'pyramid' like diagonally
orientated shape, but then maybe i could just distort the angles of
fl_recetf and acheive the same effect? In which case this whole question
is moot becuase i have a working colours version with fl_recetf already...
But anway...>
Initially i create my widgets like so:
(class 'LifeWorld' declares a pointer for DrawBox)
void LifeWorld::InitCells()
{
int cellW = cellGrp->w() / 35; //this value will need calculating..
int cellH = cellGrp->h() / 35;
int cellX = cellGrp->x();
int cellY = cellGrp->y();
int yStart = cellY;
int xStart = cellX;
int count = 0;
max_W = 35; //used later in algorithm to check bounds by maximum
number of cells in each direction
max_H = 35;
cell tempCell;
gColor = 25;
for(int y = yStart; y < cellGrp->h()+cellH; y += cellH)
{
for(int x = xStart; x < cellGrp->w()+cellW; x+= cellW)
{
tempCell.LIVE = false;
cells.push_back(tempCell);
cell_rect = new DrawBox(x, y, cellW, cellH);
cell_rect->color(gColour);
cellGrp->add(cell_rect);
count++;
}
}
}
there a call to Fl::Check(); which allows redrawing, (that created
another issue really as i realised i need to see the update on every
tick, so am presently calling Fl::Check on every iteration..!)
The update screen function looks like this:
(this is not changed from the version that used fl_rectf, it worked
fine with that, but fails to do anything in my polygon version)
I
void LifeWorld::DrawWorld()
{
for(int count = 0; count < cellGrp->children(); count++)
{
if(cells[count].LIVE == true)
{
cellGrp->child(count)->color(Fl_Color(fl_color(68));
}
else
{
cellGrp->child(count)->color(fl_color(25));
}
}
cellGrp->redraw();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk