When I compile my program, it says that "gevents" file is not found?
Whats wrong?
#include "gevents.h"
#include "gobjects.h"
#include "gwindow.h"
#define HEIGHT6 00
#define WIDTH 400
#define Rows 5
#define Cols 10
#define Radius 10
#define Lives 3
void intBricks(GWindow window);
GOval initBall(GWindow window);
GRect initPaddle(GWindow window):
GLabel initScoreboard(GWindow window);
void updateScoreboard(GWindow window, GLabel label, int points);
GObject detectCollision(GWindow window, GOval ball);
double x_velocity;
double y_velocity;
int main(void)
{
srand48(time(NULL));
GWindow window = newGwindow(WIDTH, HEIGHT);
intBricks(window);
GOval= initBall(window);
GLabel label = intScoreboard(window):
int bricks = Cols*Rows;
int lives = Lives;
int points = 0
waitForClick();
x_velocity = 2;
y_velocity = 4;
while(Lives > 0 && bricks > 0)
{
updateScoreboard(window, label, points);
move(ball, x_velocity, y_velocity);
pause(10);
GEvent event = GetNextEvent(MOUSE_EVENT);
if (event != NULL)
{
if (getEventType(event) == MOUSE_MOVED)
{
// ensure paddle follows top cursor
double x = getX(event) - getWidth(paddle) / 2;
double y = 500;
setLocation(paddle, x, y);
}
}
GObject object = detectCollision(window, ball);
if (object != NULL)
{
if (object == paddle)
{
y_velocity = -y_velocity;
}
else if (strcmp(getType(object), "GRect") == 0)
{
removeGWindow(window, object);
y_velocity = -y_velocity;
points++;
bricks--;
}
}
if (getX(ball) + getWidth(ball) >= getWidth(window))
{
x_velocity = -x_velocity;
}
if (getX(ball) <= 0)
{
x_velocity = -x_velocity;
}
if (getY(ball) <= 0)
{
y_velocity = -y_velocity;
}
if (getY(ball) + getHeight(ball) >= getHeight(window))
{
lives--;
setLocation(ball, 190, 200);
setLocation(paddle, 160, 500);
waitForClick();
}
}
if (bricks > 0)
{
GLabel game_over = newGLabel("YOU LOSE!");
setFont(game_over, "SansSerif-70");
setColor(game_over, "RED");
add(window, game_over);
setLocation(game_over, 15, 300);
}
else
{
GLabel game_over = newGLabel("YOU WIN!");
setFont(game_over, "SansSerif-70");
setColor(game_over, "GREEN");
add(window, game_over);
setLocation(game_over, 15, 300);
}
waitForClick();
closeGWindow(window);
return 0;
}
void initBricks(GWindow window)
{
int brick_y = 50;
int row_space = 20;
for (int i = 0; i < ROWS; i++)
{
int brick_x = 2;
for (int j = 0; j < COLS; j++) /
{
GRect brick = newGRect(brick_x + 5, brick_y, 35, 10);
if (i == 0)
{
setColor(brick, "PURPLE");
}
if (i == 1)
{
setColor(brick, "BLUE");
}
if (i == 2)
{
setColor(brick, "CYAN");
}
if (i == 3)
{
setColor(brick, "GREEN");
}
if (i == 4)
{
setColor(brick, "YELLOW");
}
setFilled(brick, true);
add(window, brick);
brick_x = brick_x + 39;
}
brick_y = brick_y + 15;
}
}
GOval initBall(GWindow window)
{
GOval ball = newGOval(200 - 10, 200, 20, 20);
setColor(ball, "BLACK");
setFilled(ball, true);
add(window, ball);
return ball;
}
GRect initPaddle(GWindow window)
{
GRect paddle = newGRect(200 - 35, 500, 70, 10);
setColor(paddle, "7F00FF"); //purple
setFilled(paddle, true);
add(window, paddle);
return paddle;
}
GLabel initScoreboard(GWindow window)
{
GLabel label = newGLabel(" ");
setFont(label, "SansSerif-50");
setColor(label, "C0C0C0");
add(window, label);
setLocation(label, 185, 300);
return label;
}
void updateScoreboard(GWindow window, GLabel label, int points)
{
char s[12];
sprintf(s, "%i", points);
setLabel(label, s);
double x = (getWidth(window) - getWidth(label)) / 2;
double y = (getHeight(window) - getHeight(label)) / 2;
setLocation(label, x, y);
}
GObject detectCollision(GWindow window, GOval ball)
{
double x = getX(ball);
double y = getY(ball);
GObject object;
object = getGObjectAt(window, x, y);
if (object != NULL)
{
return object;
}
object = getGObjectAt(window, x + 2 * RADIUS, y);
if (object != NULL)
{
return object;
}
object = getGObjectAt(window, x, y + 2 * RADIUS);
if (object != NULL)
{
return object;
}
object = getGObjectAt(window, x + 2 * RADIUS, y + 2 * RADIUS);
if (object != NULL)
{
return object;
}
return NULL;
}