Hope this is the right area as I'm new to DarkGDK, we started learning it today, I'm studying Games Prog
I have an issue, basically I made a program at Uni where lots of boxes in a vector bounce around the screen. Although at home it doesnt seem to work, namely dbCLS(); tends to ignore when I use boxes.
This worked at Uni, the exact project works when I send it to my friends so I'm at a bit of a loss at the moment.
Here is the issue with boxes, as you can see its not being cleared each loop:
Here is what happens if I replace the dbBox line with dbDot (it works):
Here is the main code:
#include "DarkGDK.h"
#include "Shape.h"
#include <vector>
void DarkGDK(void)
{
const int dt = 1;
dbSyncOn();
dbSyncRate(60);
//dbSetWindowOff();
dbSetWindowPosition(100, 100);
dbSetWindowSize(1024, 768);
// Seed randomiser with timer
dbRandomize(dbTimer());
std::vector<Shape*> boxes;
//boxes.resize(99);
for (int i = 0; i < 100; i++)
{
int tempWidth = dbRnd(50) + 5;
int tempHeight = dbRnd(50) + 5;
int tempPosX = dbRnd(700) + 5;
int tempPosY = dbRnd(500) + 5;
int speed = dbRnd(4) + 1;
//int speed = 1;
int color = dbRnd(16000000);
boxes.push_back(new Shape(tempPosX, tempPosY, speed, speed, tempWidth, tempHeight, color));
}
while (LoopGDK())
{
// clear screen
//dbInk(0, 0);
dbCLS();
std::vector<Shape*>::iterator itBoxes = boxes.begin();
while (itBoxes != boxes.end())
{
(*itBoxes)->update(dt);
(*itBoxes)->draw();
itBoxes++;
}
dbSync();
}
while (!boxes.empty())
{
delete boxes.back();
boxes.pop_back();
}
// return back to windows
return;
}
Here is the draw code, simple:
void Shape::draw()
{
dbInk(mColor, mColor);
dbBox(mX, mY, mX + mWidth, mY + mHeight);
//dbDot(mX, mY);
}
It should be noted I have tried in both VS2008 Pro and Express, I have installed SP1, using August SDK 2007, everything seems right, other projects compile it's just this one, which I have seen work. And as you can see is just boxes?
Appreciate any help