summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile (renamed from src/makefile)27
-rwxr-xr-xsrc/a.outbin0 -> 104128 bytes
-rw-r--r--src/bullet.cpp4
-rw-r--r--src/bullet.h24
-rw-r--r--src/bullet.obin0 -> 7208 bytes
-rw-r--r--src/driver.cpp4
-rw-r--r--src/driver.obin0 -> 18744 bytes
-rw-r--r--src/flyingObject.cpp2
-rw-r--r--src/flyingObject.h28
-rw-r--r--src/flyingObject.obin0 -> 7360 bytes
-rw-r--r--src/game.cpp6
-rw-r--r--src/game.h54
-rw-r--r--src/game.obin0 -> 141592 bytes
-rw-r--r--src/point.cpp4
-rw-r--r--src/point.h49
-rw-r--r--src/point.obin0 -> 5504 bytes
-rw-r--r--src/rocks.cpp4
-rw-r--r--src/rocks.h84
-rw-r--r--src/rocks.obin0 -> 53520 bytes
-rw-r--r--src/ship.cpp4
-rw-r--r--src/ship.h32
-rw-r--r--src/ship.obin0 -> 4304 bytes
-rw-r--r--src/uiDraw.cpp4
-rw-r--r--src/uiDraw.h135
-rw-r--r--src/uiDraw.obin0 -> 29136 bytes
-rw-r--r--src/uiInteract.cpp4
-rw-r--r--src/uiInteract.h131
-rw-r--r--src/uiInteract.obin0 -> 12872 bytes
-rw-r--r--src/velocity.cpp4
-rw-r--r--src/velocity.h23
-rw-r--r--src/velocity.obin0 -> 5656 bytes
31 files changed, 33 insertions, 594 deletions
diff --git a/src/makefile b/src/Makefile
index 22b20f7..d4e921a 100644
--- a/src/makefile
+++ b/src/Makefile
@@ -2,18 +2,17 @@
# Logan Hunt
# Summary:
# Play the game asteroids
-# Above and Beyond
+# Above and Beyond (Extra Credit)
# Changed colors
-# Added fuel
+# Added fuel
# rotation: -1 units/frame
# movement: -3 units/frame
-# Made sure that initially, trajectories of rocks will
+# Made sure that initially, trajectories of spawned rocks will
# not hit ship
# There's a chance of medium asteroids spawning at the start
# The initial amount of large rocks is random
###############################################################
-
LFLAGS = -lglut -lGLU -lGL
###############################################################
@@ -34,34 +33,34 @@ a.out: driver.o game.o uiInteract.o uiDraw.o point.o velocity.o flyingObject.o s
# bullet.o The bullets fired from the ship
# rocks.o Contains all of the Rock classes
###############################################################
-uiDraw.o: uiDraw.cpp uiDraw.h
+uiDraw.o: uiDraw.cpp ../include/uiDraw.h
g++ -c uiDraw.cpp
-uiInteract.o: uiInteract.cpp uiInteract.h
+uiInteract.o: uiInteract.cpp ../include/uiInteract.h
g++ -c uiInteract.cpp
-point.o: point.cpp point.h
+point.o: point.cpp ../include/point.h
g++ -c point.cpp
-driver.o: driver.cpp game.h
+driver.o: driver.cpp ../include/game.h
g++ -c driver.cpp
-game.o: game.cpp game.h uiDraw.h uiInteract.h point.h velocity.h flyingObject.h bullet.h rocks.h ship.h
+game.o: game.cpp ../include/game.h ../include/uiDraw.h ../include/uiInteract.h ../include/point.h ../include/velocity.h ../include/flyingObject.h ../include/bullet.h ../include/rocks.h ../include/ship.h
g++ -c game.cpp
-velocity.o: velocity.cpp velocity.h point.h
+velocity.o: velocity.cpp ../include/velocity.h ../include/point.h
g++ -c velocity.cpp
-flyingObject.o: flyingObject.cpp flyingObject.h point.h velocity.h uiDraw.h
+flyingObject.o: flyingObject.cpp ../include/flyingObject.h ../include/point.h ../include/velocity.h ../include/uiDraw.h
g++ -c flyingObject.cpp
-ship.o: ship.cpp ship.h flyingObject.h point.h velocity.h uiDraw.h
+ship.o: ship.cpp ../include/ship.h ../include/flyingObject.h ../include/point.h ../include/velocity.h ../include/uiDraw.h
g++ -c ship.cpp
-bullet.o: bullet.cpp bullet.h flyingObject.h point.h velocity.h uiDraw.h
+bullet.o: bullet.cpp ../include/bullet.h ../include/flyingObject.h ../include/point.h ../include/velocity.h ../include/uiDraw.h
g++ -c bullet.cpp
-rocks.o: rocks.cpp rocks.h flyingObject.h point.h velocity.h uiDraw.h
+rocks.o: rocks.cpp ../include/rocks.h ../include/flyingObject.h ../include/point.h ../include/velocity.h ../include/uiDraw.h
g++ -c rocks.cpp
###############################################################
diff --git a/src/a.out b/src/a.out
new file mode 100755
index 0000000..41f0db3
--- /dev/null
+++ b/src/a.out
Binary files differ
diff --git a/src/bullet.cpp b/src/bullet.cpp
index 69fb603..b2ea253 100644
--- a/src/bullet.cpp
+++ b/src/bullet.cpp
@@ -1,5 +1,5 @@
-#include "bullet.h"
-#include "ship.h"
+#include "../include/bullet.h"
+#include "../include/ship.h"
#include <cmath>
#define M_PI 3.14159265
diff --git a/src/bullet.h b/src/bullet.h
deleted file mode 100644
index 3392ee4..0000000
--- a/src/bullet.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef bullet_h
-#define bullet_h
-
-#define BULLET_SPEED 10
-#define BULLET_LIFE 40
-
-#include "point.h"
-#include "velocity.h"
-#include "flyingObject.h"
-
-class Bullet : public FlyingObject
-{
-private:
- int framesAlive;
-
-public:
- Bullet( const Point &point );
- int getFramesAlive() const { return framesAlive; };
- void fire( const Velocity &velocity , const float angle );
- void advance();
-};
-
-
-#endif /* bullet_h */
diff --git a/src/bullet.o b/src/bullet.o
new file mode 100644
index 0000000..66eff87
--- /dev/null
+++ b/src/bullet.o
Binary files differ
diff --git a/src/driver.cpp b/src/driver.cpp
index 5e1b9a5..06d7ca1 100644
--- a/src/driver.cpp
+++ b/src/driver.cpp
@@ -7,8 +7,8 @@
* that specifies what methods of the game class are
* called each time through the game loop.
******************************************************/
-#include "game.h"
-#include "uiInteract.h"
+#include "../include/game.h"
+#include "../include/uiInteract.h"
/*************************************
* All the interesting work happens here, when
diff --git a/src/driver.o b/src/driver.o
new file mode 100644
index 0000000..c1b4d8a
--- /dev/null
+++ b/src/driver.o
Binary files differ
diff --git a/src/flyingObject.cpp b/src/flyingObject.cpp
index 149e3f5..08d195b 100644
--- a/src/flyingObject.cpp
+++ b/src/flyingObject.cpp
@@ -1,4 +1,4 @@
-#include "flyingObject.h"
+#include "../include/flyingObject.h"
#include <iostream>
// Advance flyingobjects
diff --git a/src/flyingObject.h b/src/flyingObject.h
deleted file mode 100644
index 3296c5a..0000000
--- a/src/flyingObject.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef flyingObject_h
-#define flyingObject_h
-
-#include "point.h"
-#include "velocity.h"
-#include "uiDraw.h"
-
-class FlyingObject
-{
-protected:
- Point point;
- Velocity velocity;
- bool alive;
-public:
- FlyingObject() : point( Point() ) , velocity( Velocity() ) , alive( true ) {}
- Point getPoint() const { return this->point; }
- void setPoint( const Point &point ) { this->point = point; }
- Velocity getVelocity() const { return this->velocity; }
- void setVelocity( const Velocity &velocity) { this->velocity = velocity; }
- bool isAlive() { return this->alive; }
- void kill() { alive = false; };
- virtual void draw() { drawDot( point ); };
- virtual void advance();
-};
-
-
-
-#endif /* flyingObject_h */
diff --git a/src/flyingObject.o b/src/flyingObject.o
new file mode 100644
index 0000000..127099c
--- /dev/null
+++ b/src/flyingObject.o
Binary files differ
diff --git a/src/game.cpp b/src/game.cpp
index f7d4054..2430a10 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -5,9 +5,9 @@
*
*********************************************************************/
-#include "game.h"
-#include "uiDraw.h"
-#include "bullet.h"
+#include "../include/game.h"
+#include "../include/uiDraw.h"
+#include "../include/bullet.h"
// These are needed for the getClosestDistance function...
#include <limits>
#include <iostream>
diff --git a/src/game.h b/src/game.h
deleted file mode 100644
index 943ed63..0000000
--- a/src/game.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*********************************************************************
- * File: game.h
- * Description: Defines the game class for Asteroids
- *
- *********************************************************************/
-
-#ifndef GAME_H
-#define GAME_H
-
-#include <vector>
-#include "bullet.h"
-#include "ship.h"
-#include "rocks.h"
-#include "uiDraw.h"
-#include "uiInteract.h"
-
-#define CLOSE_ENOUGH 15
-
-using namespace std;
-
-class Game
-{
-private:
- Point topLeft;
- Point bottomRight;
- vector<Rock *> rocks;
- vector<Bullet *> bullets;
- Ship* ship;
- int level = 0;
-
- float getClosestDistance( const FlyingObject &obj1 , const FlyingObject &obj2 ) const;
-
- vector<Rock *> createRocks();
-
- void advanceBullets();
- void advanceAsteroids();
- void advanceShip();
-
- void cleanUpZombies();
-
- void handleCollisions();
-
- void drawBullets();
- void drawRocks();
- void drawShip();
-public:
- Game ( const Point &tl , const Point &br );
- void handleInput ( const Interface &ui );
- void draw ( const Interface &ui );
- void advance();
-};
-
-
-#endif /* GAME_H */
diff --git a/src/game.o b/src/game.o
new file mode 100644
index 0000000..09aba02
--- /dev/null
+++ b/src/game.o
Binary files differ
diff --git a/src/point.cpp b/src/point.cpp
index cad96e4..a40e1ef 100644
--- a/src/point.cpp
+++ b/src/point.cpp
@@ -8,9 +8,9 @@
* the location and the bounds.
************************************************************************/
-#include "point.h"
+#include "../include/point.h"
#include <cassert>
-#include "uiDraw.h"
+#include "../include/uiDraw.h"
using namespace std;
/******************************************
* POINT : CONSTRUCTOR WITH X,Y
diff --git a/src/point.h b/src/point.h
deleted file mode 100644
index 7f0715f..0000000
--- a/src/point.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/***********************************************************************
- * Header File:
- * Point : The representation of a position on the screen
- * Author:
- * Br. Helfrich
- * Summary:
- * Everything we need to know about a location on the screen, including
- * the location and the bounds.
- ************************************************************************/
-
-
-#ifndef POINT_H
-#define POINT_H
-
-#include <iostream>
-
-/*********************************************
- * POINT
- * A single position.
- *********************************************/
-class Point
-{
-public:
- // constructors
- Point() : x(0.0), y(0.0) {}
- Point(bool check) : x(0.0), y(0.0) {}
- Point(float x, float y);
-
- // getters
- float getX() const { return x; }
- float getY() const { return y; }
-
- // setters
- void setX(float x);
- void setY(float y);
- void addX(float dx) { setX(getX() + dx); }
- void addY(float dy) { setY(getY() + dy); }
-
- bool inRange ( const Point &p , const float range );
-private:
- float x; // horizontal position
- float y; // vertical position
-};
-
-// stream I/O useful for debugging
-std::ostream & operator << (std::ostream & out, const Point & pt);
-std::istream & operator >> (std::istream & in, Point & pt);
-
-#endif // POINT_H
diff --git a/src/point.o b/src/point.o
new file mode 100644
index 0000000..2427fb4
--- /dev/null
+++ b/src/point.o
Binary files differ
diff --git a/src/rocks.cpp b/src/rocks.cpp
index 7c3c13e..b29fb64 100644
--- a/src/rocks.cpp
+++ b/src/rocks.cpp
@@ -1,5 +1,5 @@
-#include "rocks.h"
-#include "uiDraw.h"
+#include "../include/rocks.h"
+#include "../include/uiDraw.h"
#include <cmath>
#define M_PI 3.14159265
diff --git a/src/rocks.h b/src/rocks.h
deleted file mode 100644
index ae12e2b..0000000
--- a/src/rocks.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef rocks_h
-#define rocks_h
-
-#define BIG_ROCK_SIZE 16
-#define MEDIUM_ROCK_SIZE 8
-#define SMALL_ROCK_SIZE 4
-
-#define BIG_ROCK_SPIN 2
-#define MEDIUM_ROCK_SPIN 5
-#define SMALL_ROCK_SPIN 10
-
-#include "flyingObject.h"
-#include <vector>
-
-using namespace std;
-
-class Rock : public FlyingObject
-{
-protected:
- int rotationDegPerFrame;
- int size;
- float angle;
-public:
- Rock() : FlyingObject() , rotationDegPerFrame ( 0 ) , size ( 1 ) , angle ( 0 ) {}
- Rock ( int degPerFrame , int size , float angle ) : rotationDegPerFrame ( degPerFrame ) , size ( size ) , angle ( angle ) {}
-
- int getRotationDegPerFrame() { return rotationDegPerFrame; }
- int getSize () { return size; }
- float getAngle() { return angle; }
-
- void setAngle ( const float angle ) { this->angle = angle; }
- void setRotationDegPerFrame ( const int degPerFrame ) { this->rotationDegPerFrame = degPerFrame; }
- void setSize ( const int size ) { this->size = size; }
- void advance() { this->angle += rotationDegPerFrame; FlyingObject::advance(); }
- virtual void draw() {};
- virtual vector<Rock *> destroy() = 0;
-};
-
-class BigRock : public Rock
-{
-public:
- BigRock ( const Point &point , const Velocity &velocity )
- {
- setPoint ( point );
- setAngle ( 0 );
- setSize ( BIG_ROCK_SIZE );
- setRotationDegPerFrame ( BIG_ROCK_SPIN );
- setAngle ( random ( 0 , 360 ) );
- setVelocity ( velocity );
- }
-
- vector<Rock *> destroy();
- void draw();
-};
-
-class MediumRock : public Rock
-{
-public:
- MediumRock ( const Point &point , const Velocity &vel ) {
- this->point = point;
- this->velocity = vel;
- setAngle ( 0 );
- setRotationDegPerFrame ( MEDIUM_ROCK_SPIN );
- setSize ( MEDIUM_ROCK_SIZE );
- }
- vector<Rock *> destroy();
- void draw();
-};
-
-class SmallRock : public Rock
-{
-public:
- SmallRock( const Point &point , const Velocity &vel ) {
- this->point = point;
- this->velocity = vel;
- setAngle ( 0 );
- setRotationDegPerFrame ( SMALL_ROCK_SPIN );
- setSize ( SMALL_ROCK_SIZE );
- }
- vector<Rock *> destroy();
- void draw();
-};
-
-#endif /* rocks_h */
diff --git a/src/rocks.o b/src/rocks.o
new file mode 100644
index 0000000..0072788
--- /dev/null
+++ b/src/rocks.o
Binary files differ
diff --git a/src/ship.cpp b/src/ship.cpp
index 2eaa852..da21e69 100644
--- a/src/ship.cpp
+++ b/src/ship.cpp
@@ -1,5 +1,5 @@
-#include "ship.h"
-#include "bullet.h"
+#include "../include/ship.h"
+#include "../include/bullet.h"
#include <cmath>
diff --git a/src/ship.h b/src/ship.h
deleted file mode 100644
index 46b6817..0000000
--- a/src/ship.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef ship_h
-#define ship_h
-
-#define SHIP_SIZE 10
-#define ROTATE_AMOUNT 6
-#define THRUST_AMOUNT 0.5
-
-#include "flyingObject.h"
-#include "uiDraw.h"
-#include "uiInteract.h"
-
-using namespace std;
-
-class Ship : public FlyingObject
-{
-private:
- float angle;
- bool isThrusting;
- int fuel;
-public:
- Ship( const Point &point ) : FlyingObject() , fuel ( 1000 ) , angle ( 90.0 ) , isThrusting( false ) { setPoint ( point ); }
- float getAngle() const { return this->angle; }
- float getFuel() { return this->fuel; }
- void setFuel ( const int fuel ) { this->fuel - fuel; }
- void thrust( const bool isUp );
- void rotate( const bool isRight );
- bool getIsThrusting() { return isThrusting; }
- void setThrusting( const bool isThrusting ) { this->isThrusting = isThrusting; }
- void draw() const;
-};
-
-#endif /* ship_h */
diff --git a/src/ship.o b/src/ship.o
new file mode 100644
index 0000000..4cd5e1a
--- /dev/null
+++ b/src/ship.o
Binary files differ
diff --git a/src/uiDraw.cpp b/src/uiDraw.cpp
index 6d36f24..9e64706 100644
--- a/src/uiDraw.cpp
+++ b/src/uiDraw.cpp
@@ -34,8 +34,8 @@
#include <math.h>
#endif // _WIN32
-#include "point.h"
-#include "uiDraw.h"
+#include "../include/point.h"
+#include "../include/uiDraw.h"
using namespace std;
diff --git a/src/uiDraw.h b/src/uiDraw.h
deleted file mode 100644
index caa0fb5..0000000
--- a/src/uiDraw.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/***********************************************************************
- * Header File:
- * User Interface Draw : put pixels on the screen
- * Author:
- * Br. Helfrich
- * Summary:
- * This is the code necessary to draw on the screen. We have a collection
- * of procedural functions here because each draw function does not
- * retain state. In other words, they are verbs (functions), not nouns
- * (variables) or a mixture (objects)
- ************************************************************************/
-
-#ifndef UI_DRAW_H
-#define UI_DRAW_H
-
-#include <string> // To display text on the screen
-#include <cmath> // for M_PI, sin() and cos()
-#include "point.h" // Where things are drawn
-using std::string;
-
-/************************************************************************
- * DRAW DIGIT
- * Draw a single digit in the old school line drawing style. The
- * size of the glyph is 8x11 or x+(0..7), y+(0..10)
- *************************************************************************/
-void drawDigit(const Point & topLeft, char digit);
-
-/*************************************************************************
- * DRAW NUMBER
- * Display an integer on the screen using the 7-segment method
- *************************************************************************/
-void drawNumber(const Point & topLeft, int number);
-
-/*************************************************************************
- * DRAW TEXT
- * Draw text using a simple bitmap font
- ************************************************************************/
-void drawText(const Point & topLeft, const char * text);
-
-/************************************************************************
- * ROTATE
- * Rotate a given point (point) around a given origin (center) by a given
- * number of degrees (angle).
- *************************************************************************/
-void rotate(Point & point, const Point & origin, int rotation = 0);
-
-/************************************************************************
- * DRAW RECTANGLE
- * Draw a rectangle on the screen centered on a given point (center) of
- * a given size (width, height), and at a given orientation (rotation)
- * measured in degrees (0 - 360)
- *************************************************************************/
-void drawRect(const Point & center, int width, int height, int rotation);
-
-/************************************************************************
- * DRAW CIRCLE
- * Draw a circle from a given location (center) of a given size (radius).
- *************************************************************************/
-void drawCircle(const Point & center, int radius);
-
-/************************************************************************
- * DRAW POLYGON
- * Draw a polygon from a given location (center) of a given size (radius).
- *************************************************************************/
-void drawPolygon(const Point & center,
- int radius = 20,
- int points = 4,
- int rotation = 0);
-
-/************************************************************************
- * DRAW LINE
- * Draw a line on the screen from the beginning to the end.
- *************************************************************************/
-void drawLine(const Point & begin, const Point & end,
- float red = 1.0, float green = 1.0, float blue = 1.0);
-
-
-/***********************************************************************
- * DRAW Lander
- * Draw a moon-lander spaceship on the screen at a given point
- ***********************************************************************/
-void drawLander(const Point & point);
-
-/***********************************************************************
- * DRAW Lander Flame
- * Draw the flames coming out of a moonlander for thrust
- ***********************************************************************/
-void drawLanderFlames(const Point & point,
- bool bottom,
- bool left,
- bool right);
-
-/************************************************************************
- * DRAW DOT
- * Draw a single point on the screen, 2 pixels by 2 pixels
- *************************************************************************/
-void drawDot(const Point & point);
-
-/************************************************************************
- * DRAW Sacred Bird
- * Draw the bird on the screen
- *************************************************************************/
-void drawSacredBird(const Point & center, float radius);
-
-/************************************************************************
- * DRAW Tough Bird
- * Draw a tough bird on the screen
- *************************************************************************/
-void drawToughBird(const Point & center, float radius, int hits);
-
-/************************************************************************
- * DRAW Ship
- * Draw the spaceship on the screen
- *************************************************************************/
-void drawShip(const Point & point, int rotation, bool thrust);
-
-/**********************************************************************
- * DRAW * ASTEROID
- **********************************************************************/
-void drawSmallAsteroid( const Point & point, int rotation);
-void drawMediumAsteroid(const Point & point, int rotation);
-void drawLargeAsteroid( const Point & point, int rotation);
-
-/******************************************************************
- * RANDOM
- * This function generates a random number. The user specifies
- * The parameters
- * INPUT: min, max : The number of values (min <= num <= max)
- * OUTPUT <return> : Return the integer
- ****************************************************************/
-int random(int min, int max);
-double random(double min, double max);
-
-
-#endif // UI_DRAW_H
diff --git a/src/uiDraw.o b/src/uiDraw.o
new file mode 100644
index 0000000..0748021
--- /dev/null
+++ b/src/uiDraw.o
Binary files differ
diff --git a/src/uiInteract.cpp b/src/uiInteract.cpp
index 1e89833..bb9f8fe 100644
--- a/src/uiInteract.cpp
+++ b/src/uiInteract.cpp
@@ -38,8 +38,8 @@
#include <math.h>
#endif // _WIN32
-#include "uiInteract.h"
-#include "point.h"
+#include "../include/uiInteract.h"
+#include "../include/point.h"
using namespace std;
diff --git a/src/uiInteract.h b/src/uiInteract.h
deleted file mode 100644
index d7bfe6b..0000000
--- a/src/uiInteract.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*********************************************
- * Header file:
- * UI INTERFACE
- * Author:
- * Br. Helfrich
- * Summary:
- * This module will create an OpenGL window,
- * enter the OpenGL main loop, and accept events.
- * The main methods are:
- * 1. Constructors - Create the window
- * 2. run() - Run the main loop
- * 3. callback - Specified in Run, this user-provided
- * function will get called with every frame
- * 4. isDown() - Is a given key pressed on this loop?
- **********************************************/
-
-#ifndef UI_INTERFACE_H
-#define UI_INTERFACE_H
-
- #include "point.h"
-
-/********************************************
- * INTERFACE
- * All the data necessary to keep our graphics
- * state in memory
- ********************************************/
-class Interface
-{
-public:
- // Default constructor useful for setting up the random variables
- // or for opening the file for output
- Interface() { initialize(0, 0x0000, "Window", Point(-50, 50), Point(50, -50)); };
-
- // Constructor if you want to set up the window with anything but
- // the default parameters
- Interface(int argc, char ** argv, const char * title, Point topLeft, Point bottomRight)
- {
- initialize(argc, argv, title, topLeft, bottomRight);
- }
-
- // Destructor, incase any housecleaning needs to occr
- ~Interface();
-
- // This will set the game in motion
- void run(void (*callBack)(const Interface *, void *), void *p);
-
- // Is it time to redraw the screen
- bool isTimeToDraw();
-
- // Set the next draw time based on current time and time period
- void setNextDrawTime();
-
- // Retrieve the next tick time... the time of the next draw.
- unsigned int getNextTick() { return nextTick; };
-
- // How many frames per second are we configured for?
- void setFramesPerSecond(double value);
-
- // Key event indicating a key has been pressed or not. The callbacks
- // should be the only onces to call this
- void keyEvent(int key, bool fDown);
- void keyEvent();
-
- // Current frame rate
- double frameRate() const { return timePeriod; };
-
- // Get various key events
- int isDown() const { return isDownPress; };
- int isUp() const { return isUpPress; };
- int isLeft() const { return isLeftPress; };
- int isRight() const { return isRightPress; };
- bool isSpace() const { return isSpacePress; };
-
- static void *p; // for client
- static void (*callBack)(const Interface *, void *);
-
-private:
- void initialize(int argc, char ** argv, const char * title, Point topLeft, Point bottomRight);
-
- static bool initialized; // only run the constructor once!
- static double timePeriod; // interval between frame draws
- static unsigned int nextTick; // time (from clock()) of our next draw
-
- static int isDownPress; // is the down arrow currently pressed?
- static int isUpPress; // " up "
- static int isLeftPress; // " left "
- static int isRightPress; // " right "
- static bool isSpacePress; // " space "
-};
-
-
-
-/************************************************************************
- * DRAW CALLBACK
- * This is the main callback from OpenGL. It gets called constantly by
- * the graphics engine to refresh and draw the window. Here we will
- * clear the background buffer, draw on it, and send it to the forefront
- * when the appropriate time period has passsed.
- *
- * Note: This and all other callbacks can't be member functions, they must
- * have global scope for OpenGL to see them.
- *************************************************************************/
-void drawCallback();
-
-/************************************************************************
- * KEY DOWN CALLBACK
- * When a key on the keyboard has been pressed, we need to pass that
- * on to the client. Currnetly, we are only registering the arrow keys
- *************************************************************************/
-void keyDownCallback(int key, int x, int y);
-
-/************************************************************************
- * KEY UP CALLBACK
- * When the user has released the key, we need to reset the pressed flag
- *************************************************************************/
-void keyUpCallback(int key, int x, int y);
-
-/***************************************************************
- * KEYBOARD CALLBACK
- * Generic callback to a regular ascii keyboard event, such as
- * the space bar or the letter 'q'
- ***************************************************************/
-void keyboardCallback(unsigned char key, int x, int y);
-
-/************************************************************************
- * RUN
- * Set the game in action. We will get control back in our drawCallback
- *************************************************************************/
-void run();
-
-#endif // UI_INTERFACE_H
diff --git a/src/uiInteract.o b/src/uiInteract.o
new file mode 100644
index 0000000..b19d945
--- /dev/null
+++ b/src/uiInteract.o
Binary files differ
diff --git a/src/velocity.cpp b/src/velocity.cpp
index ceca109..ec64cf3 100644
--- a/src/velocity.cpp
+++ b/src/velocity.cpp
@@ -1,4 +1,4 @@
-#include "velocity.h"
+#include "../include/velocity.h"
// Default velocity constructor
Velocity :: Velocity ()
@@ -7,7 +7,7 @@ Velocity :: Velocity ()
setDy ( 0.0 );
}
-// Velocity constructor
+// Velocity constructor with data
Velocity :: Velocity ( float dx , float dy )
{
setDx ( dx );
diff --git a/src/velocity.h b/src/velocity.h
deleted file mode 100644
index 11c41cb..0000000
--- a/src/velocity.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef VELOCITY_H
-#define VELOCITY_H
-
-#include "point.h"
-
-class Velocity
-{
- public:
- Velocity();
- Velocity( float dx , float dy );
- float getDx() const;
- float getDy() const;
- void addDy( const float dy );
- void addDx( const float dx );
- void setDx( float dx );
- void setDy( float dy );
- Point updatePoint ( Point &point );
- private:
- float dx;
- float dy;
-};
-
-#endif
diff --git a/src/velocity.o b/src/velocity.o
new file mode 100644
index 0000000..002241b
--- /dev/null
+++ b/src/velocity.o
Binary files differ