Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Compiling\!

  • Loading branch information...
commit 4ed40a9e206e38bae970d752ecdb359494651ed5 1 parent 2f45b09
@cjfrisz authored
View
11 Config.cpp
@@ -187,11 +187,12 @@ namespace evolver {
config << "fullscreen" << SEPARATOR << this->fullscreen;
config << "screenWidth" << SEPARATOR << this->screenWidth;
config << "screenHeight" << SEPARATOR << this->screenHeight;
- config << "colorDepth" << SEPARATOR << this->colorDepth;
- config << "keyUp" << SEPARATOR << this->keyUp;
- config << "keyDown" << SEPARATOR << this->keyDown;
- config << "keyLeft" << SEPARATOR << this->keyLeft;
- config << "keyRight" << SEPARATOR << this->keyRight;
+ config << "color_depth" << SEPARATOR << this->colorDepth;
+ config << "UP" << SEPARATOR << this->keyUp;
+ config << "DOWN" << SEPARATOR << this->keyDown;
+ config << "LEFT" << SEPARATOR << this->keyLeft;
+ config << "RIGHT" << SEPARATOR << this->keyRight;
+ config << "QUIT" << SEPARATOR << this->keyQuit;
config.close();
View
6 FallBehavior.cpp
@@ -9,6 +9,10 @@ namespace evolver {
this->actor = NULL;
}
+ FallBehavior::~FallBehavior () {
+ // Nothing to do
+ }
+
FallBehavior::FallBehavior (const FallBehavior &original) {
this->copyFallBehavior(original);
}
@@ -31,6 +35,8 @@ namespace evolver {
return;
}
+ void FallBehavior::fall () { }
+
void FallBehavior::copyFallBehavior (const FallBehavior &original) {
this->actor = NULL;
View
8 JumpBehavior.cpp
@@ -5,10 +5,14 @@
namespace evolver {
- JumpBehavior::JumpBehavior (void) {
+ JumpBehavior::JumpBehavior () {
this->actor = NULL;
}
+ JumpBehavior::~JumpBehavior () {
+ // Nothing to do yet
+ }
+
JumpBehavior::JumpBehavior (const JumpBehavior &original) {
this->copyJumpBehavior(original);
}
@@ -31,6 +35,8 @@ namespace evolver {
return;
}
+ void JumpBehavior::jump () { }
+
void JumpBehavior::copyJumpBehavior (const JumpBehavior &original) {
this->actor = NULL;
View
14 MoveBehavior.cpp
@@ -4,10 +4,14 @@
namespace evolver {
- MoveBehavior::MoveBehavior (void) {
+ MoveBehavior::MoveBehavior () {
this->actor = NULL;
}
+ MoveBehavior::~MoveBehavior () {
+ // Nothing to do yet
+ }
+
MoveBehavior::MoveBehavior (const MoveBehavior &original) {
this->copyMoveBehavior(original);
}
@@ -30,6 +34,14 @@ namespace evolver {
return;
}
+ void MoveBehavior::moveUp (float elapsedTime) { }
+
+ void MoveBehavior::moveDown (float elapsedTime) { }
+
+ void MoveBehavior::moveLeft (float elapsedTime) { }
+
+ void MoveBehavior::moveRight (float elapsedTime) { }
+
void MoveBehavior::copyMoveBehavior (const MoveBehavior &original) {
this->actor = NULL;
View
47 evolver.cpp
@@ -97,9 +97,9 @@ namespace evolver {
void initGame (void) {
Actor *actor = new Actor();
- NoFall *fall = new NoFall();
- NoJump *jump = new NoJump();
- NoMovement *move = new NoMovement();
+ FallBehavior *fall = new NoFall();
+ JumpBehavior *jump = new NoJump();
+ MoveBehavior *move = new NoMovement();
actor->setActorOriginX(0);
actor->setActorOriginY(0);
@@ -116,13 +116,8 @@ namespace evolver {
}
void evolverKey (sf::Key::Code code, float timeElapsed) {
- if (code == evolverConfig.getKeyQuit()) {
- quit(EXIT_SUCCESS);
- }
- else {
- controller.handleControl(controller.controlToAction(code),
- timeElapsed);
- }
+ controller.handleControl(controller.controlToAction(code),
+ timeElapsed);
return;
}
@@ -147,21 +142,22 @@ namespace evolver {
bool done;
float elapsedTime;
sf::Event event;
- sf::Clock clock;
done = false;
- while (evolver.IsOpened()) {
-
- elapsedTime = clock.GetElapsedTime();
- clock.Reset();
+ while (done == false) {
- while ((done == false) && (evolver.GetEvent(event))) {
+ while (evolver.GetEvent(event)) {
switch (event.Type)
{
case sf::Event::KeyPressed:
- evolverKey(event.Key.Code, elapsedTime);
+ if (event.Key.Code == evolverConfig.getKeyQuit()) {
+ done = true;
+ }
+ else {
+ evolverKey(event.Key.Code, elapsedTime);
+ }
break;
case sf::Event::Closed:
done = true;
@@ -199,6 +195,21 @@ int main (int argc, char *argv[]) {
// Config.h
}
+ std::cout << "Quit key: " << evolver::evolverConfig.getKeyQuit() <<
+ std::endl;
+
+ std::cout << "Up key: " << evolver::evolverConfig.getKeyUp() <<
+ std::endl;
+
+ std::cout << "Down key: " << evolver::evolverConfig.getKeyDown() <<
+ std::endl;
+
+ std::cout << "Left key: " << evolver::evolverConfig.getKeyLeft() <<
+ std::endl;
+
+ std::cout << "Right key: " << evolver::evolverConfig.getKeyRight() <<
+ std::endl;
+
evolver::controller.
setControlActionPair(evolver::evolverConfig.getKeyUp(),
evolver::UP);
@@ -211,7 +222,7 @@ int main (int argc, char *argv[]) {
evolver::controller.
setControlActionPair(evolver::evolverConfig.getKeyRight(),
evolver::RIGHT);
-
+
evolver::initSFML();
evolver::initGL();
evolver::initGame();
Please sign in to comment.
Something went wrong with that request. Please try again.