Hi, I am currently in a Coding for Game Design course in college which requires us to use DarkGDK. We recently got an easy assignment of a basic Duck Hunt game which required us to shoot a cannon that was in the lower left corner of the screen. The cannon was shot after the player inputted the desired angle and power of where the bullet would go.
I had recently put DarkGDK on my laptop (Vista+GeForce 8600 mobile) and my desktop (Win7+GeForce 260 GTX Maxcore) and everything worked fine until I had to draw the circle (or ellipse) for the shot. The Virtual Machines at school would draw everything out correctly with it running Windows XP. The basic graphics would not show in any of the 3 variations of equations I had tried. I reinstalled Visual 2008, DGDK, and DX SDK 3 times and nothing has changed. Is there a workaround to getting the circle to draw or is this a known bug with Vista and Win7? Please help.
// Car Shoot Game
#include "DarkGDK.h"
void DarkGDK()
{
// Set int's and the Random Timer
int angle; // To hold the angle of the cannon
int power; // To hold the power of the cannon
int x1, x2, y1, y2; // To hold the X and Y coords of the car
int x0, x3, y0, y3; // To hold the X and Y coords of the bullet
dbRandomize(dbTimer()); // Randomizes dbRND every run with a new value
// Get Values for all colors
const DWORD RED = dbRGB(255, 0, 0);
const DWORD BLUE = dbRGB(0, 0, 255);
const DWORD GREY = dbRGB(80, 80, 80);
const DWORD BLACK = dbRGB(0, 0, 0);
// Clear the screen to Blue
dbCLS(BLUE);
// Draw the Cannon
dbInk(GREY, GREY);
dbBox(0, 439, 39, 479);
// Draw the Car
dbInk(RED, RED);
x1 = dbRND(540);
x2 = x1+50;
y1 = dbRND(380);
y2 = y1+50;
dbBox(x1, y1, x2, y2);
// Get the Input
dbInk(BLACK, BLACK);
dbPrint("Enter the desired angle (0-90):");
angle = atoi( dbInput() );
dbPrint("Enter the desired power:");
power = atoi( dbInput() );
// Get Input from the user and shoot cannon
// ************ Circle Equation ************
// x0 = 39;
// y0 = 439;
// x3 = x0 + power*dbCOS(angle*);
// y3 = y0 + power*dbSIN(angle*);
// dbInk(RED, RED);
// dbCircle(x3, y3, 15);
// ************ Circle Equation ************
// Get Input from user and shoot cannon
// ************ Square Equation ************
x3 = power*dbCOS(angle);
y3 = power*dbSIN(angle);
dbInk(RED, RED);
dbBox(x3+40, dbScreenHeight() - y3, x3+80, dbScreenHeight() - (y3 - 40));
// ************ Square Equation ************
// Wait for the user to press a key to close
dbWaitKey();
}