I'm making something for school and I'm not really sure why this is going into an infinite loop. I'm pretty sure i'm using dbCheckDisplayMode() incorrectly.
#include "DarkGDK.h"
void drawPattern(int width, int height)
{
int patternWidthThird = width / 4,
patternHeightThird = height / 4,
patternWidthEighth = width / 8,
patternHeightEighth = height / 8;
dbLine(0, 0, width, 0);
dbLine(width, 0, width, height);
dbLine(width, height, 0, height);
dbLine(0, height, 0, 0);
dbLine(0, 0, width, height);
dbLine(width, 0, 0, height);
dbLine(0, (height / 2), width, (height / 2));
dbLine((width / 2), 0, (width / 2), height);
dbLine(patternWidthEighth, patternHeightEighth, (width - patternWidthEighth), patternHeightEighth);
dbLine((width - patternWidthEighth), patternHeightEighth, (width - patternWidthEighth), (height - patternHeightEighth));
dbLine((width - patternWidthEighth), (height - patternHeightEighth), patternWidthEighth, (height - patternHeightEighth));
dbLine(patternWidthEighth, (height - patternHeightEighth), patternWidthEighth, patternHeightEighth);
dbBox(patternWidthThird, patternHeightThird, (width - patternWidthThird), (height - patternHeightThird));
}
void DarkGDK()
{
int patternWidth, patternHeight;
bool safeResolution = false;
do
{
dbPrint("Enter your screen's width: ");
patternWidth = atoi(dbInput());
dbPrint("Enter your screen's height: ");
patternHeight = atoi(dbInput());
if(dbCheckDisplayMode(patternWidth, patternHeight, 32))
{
dbSetDisplayMode(patternWidth, patternHeight, 32);
safeResolution = true;
}
}while(safeResolution == false);
dbCLS();
drawPattern(patternWidth, patternHeight);
dbWaitKey();
}