-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close #24. Basically, add every file under the `src/engine` path to the namespace `Engine`. Also add to fix a bunch of other files to fit with the new namespace (basically just appended `Engine::...` to a bunch of stuff). If it compiles, it should be good to go and good enough for a review. Try to check if I missed any file, but should be a-ok. Choose to go with CamlCase for namespace format, because it looks prettier imo. Can be changed back to `engine` with a simple Ctrl+F anyway.
- Loading branch information
Showing
22 changed files
with
104 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,58 @@ | ||
#include "engine/entity.h" | ||
|
||
Entity::Entity(){ | ||
using namespace Engine; | ||
|
||
Engine::Entity::Entity(){ | ||
this->point = NULL; | ||
this->sprite = NULL; | ||
} | ||
|
||
Entity::Entity(std::string name): Entity() { | ||
Engine::Entity::Entity(std::string name): Entity() { | ||
this->name = name; | ||
} | ||
|
||
void Entity::addPoint(){ | ||
void Engine::Entity::addPoint(){ | ||
this->point = new Point(); | ||
this->point->linkPos(&(this->pos)); | ||
} | ||
|
||
Point* Entity::getPoint(){ | ||
Point* Engine::Entity::getPoint(){ | ||
return this->point; | ||
} | ||
|
||
void Entity::addSprite(){ | ||
void Engine::Entity::addSprite(){ | ||
sf::CircleShape* circle = new sf::CircleShape(10); | ||
circle->setPosition(1, 1); | ||
this->sprite = circle; | ||
} | ||
void Entity::addSprite(sf::Drawable* sprite){ | ||
void Engine::Entity::addSprite(sf::Drawable* sprite){ | ||
this->sprite = sprite; | ||
} | ||
|
||
sf::Drawable* Entity::getSprite(){ | ||
sf::Drawable* Engine::Entity::getSprite(){ | ||
return this->sprite; | ||
} | ||
|
||
//Dangerous adder : only private | ||
void Entity::addPhxBox(PhxBox* pb){ | ||
void Engine::Entity::addPhxBox(PhxBox* pb){ | ||
this->phxbox = pb; | ||
pb->linkPos(&(this->pos)); | ||
pb->linkVel(&(this->vel)); | ||
pb->linkOwner(this); | ||
} | ||
|
||
void Entity::addPhxBox(Box<PhxBox>* pb, PhxBox::CollisionBehaviour ct){ | ||
void Engine::Entity::addPhxBox(Box<PhxBox>* pb, PhxBox::CollisionBehaviour ct){ | ||
PhxBox* phxbox = new PhxBox(); | ||
this->addPhxBox(phxbox); | ||
phxbox->linkBox(pb); | ||
phxbox->setCollisionType(ct); | ||
} | ||
|
||
PhxBox* Entity::getPhxBox(){ | ||
PhxBox* Engine::Entity::getPhxBox(){ | ||
return this->phxbox; | ||
} | ||
|
||
void Entity::move(double dx, double dy){ | ||
void Engine::Entity::move(double dx, double dy){ | ||
this->pos.first += dx; | ||
this->pos.second += dy; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#include "engine/physics/kinematics.h" | ||
|
||
void gravity(std::pair<double, double>* vel, double* mass){ | ||
using namespace Engine; | ||
|
||
void Engine::gravity(std::pair<double, double>* vel, double* mass){ | ||
vel->second += *mass * PHX_CST_G; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.