Skip to content

Commit

Permalink
Add wiresmash namespace (#31)
Browse files Browse the repository at this point in the history
Closes #27, that will close #20.

Add 
```cpp
namespace Wiresmah {

...

} // namespace Wiresmash
```
to every file in the `*/game` folders.
  • Loading branch information
gbrivady authored May 21, 2023
1 parent 319dfcf commit 50176fc
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions include/game/entity/dev/blue_terrain.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include "engine/box/rectangle.h"
#include "engine/entity.h"
#include "engine/physics/phxbox.h"

namespace Wiresmash {

class BlueTerrain : public Engine::Entity {
public:
BlueTerrain();
Expand All @@ -14,4 +17,6 @@ class BlueTerrain : public Engine::Entity {
}
};

} // namespace Wiresmash

#endif
3 changes: 3 additions & 0 deletions include/game/entity/dev/controllable.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "engine/input/input_handler.h"

namespace Wiresmash {
class DevControllable : public Engine::InputHandler {
private:
int amplitude;
Expand All @@ -12,4 +13,6 @@ class DevControllable : public Engine::InputHandler {
void doInput(int actionId) override;
};

} // namespace Wiresmash

#endif
4 changes: 4 additions & 0 deletions include/game/entity/dev/red_square.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include "game/entity/dev/controllable.h"

namespace Wiresmash {

class RedSquare : public Engine::Entity {
private:
/* data */
Expand All @@ -17,4 +19,6 @@ class RedSquare : public Engine::Entity {
void collPhxNotify(Engine::Entity* ett) {}
};

} // namespace Wiresmash

#endif
4 changes: 3 additions & 1 deletion src/game/entity/dev/blue_terrain.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "game/entity/dev/blue_terrain.h"

BlueTerrain::BlueTerrain() : Engine::Entity("dev_02_BTR") {
using namespace Wiresmash;

Wiresmash::BlueTerrain::BlueTerrain() : Engine::Entity("dev_02_BTR") {

Engine::Rectangle<Engine::PhxBox>* myBox =
new Engine::Rectangle<Engine::PhxBox>(100, 20);
Expand Down
4 changes: 3 additions & 1 deletion src/game/entity/dev/controllable.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "game/entity/dev/controllable.h"

void DevControllable::doInput(int actionId) {
using namespace Wiresmash;

void Wiresmash::DevControllable::doInput(int actionId) {
switch (actionId) {
case 0:
owner->move(0, amplitude);
Expand Down
4 changes: 3 additions & 1 deletion src/game/entity/dev/red_square.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "game/entity/dev/red_square.h"

RedSquare::RedSquare(int size) : Engine::Entity("dev_01_RSQ") {
using namespace Wiresmash;

Wiresmash::RedSquare::RedSquare(int size) : Engine::Entity("dev_01_RSQ") {
this->addPoint();
this->getPoint()->setMass(1);

Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ int main(int argc, char const* argv[]) {
universe.linkWindow(&window);
universe.initInput(make_keybinds("../settings/keybinds"));

RedSquare* dev_ett1 = new RedSquare(10);
Wiresmash::RedSquare* dev_ett1 = new Wiresmash::RedSquare(10);
dev_ett1->setPos(100, 0);

universe.addEntity(dev_ett1);

RedSquare* dev_ett3 = new RedSquare(10);
Wiresmash::RedSquare* dev_ett3 = new Wiresmash::RedSquare(10);
dev_ett3->setPos(100, 0);
universe.addEntity(dev_ett3);

BlueTerrain* dev_ett2 = new BlueTerrain();
Wiresmash::BlueTerrain* dev_ett2 = new Wiresmash::BlueTerrain();
universe.addEntity(dev_ett2);
// std::this_thread::sleep_for(std::chrono::seconds(4));
int i = 0;
Expand Down

0 comments on commit 50176fc

Please sign in to comment.