Explorar o código

Updated and formatted

Eiyeron Fulmincendii %!s(int64=9) %!d(string=hai) anos
pai
achega
3ce6f4f864

+ 3 - 5
platform/nspire/Graphics.cpp

@@ -1,13 +1,11 @@
+#include <stdio.h>
 #include "Graphics.h"
 #include "CXfb.h"
-#include "stdio.h"
 #include "utility/misc.h"
 #include "utility/minmax.h"
 
+using namespace WalrusRPG; /*::Graphics*/
 using namespace Nspire;
-using namespace WalrusRPG;
-using WalrusRPG::Graphics::Texture;
-using WalrusRPG::Graphics::Pixel;
 using WalrusRPG::Utils::Rect;
 
 void Graphics::init()
@@ -172,4 +170,4 @@ void Graphics::put_rectangle(const Rect &rect, const Pixel &color)
             CXfb::draw_pixel(x, y, color.value);
         }
     }
-}
+}

+ 2 - 1
platform/nspire/Interrupts.cpp

@@ -45,7 +45,8 @@ void INTERRUPTS::init()
 
 void INTERRUPTS::off()
 {
-    if(!is_on) return;
+    if (!is_on)
+        return;
     is_on = false;
     // Disable IRQ in the CPU
     asm(

+ 7 - 8
platform/sfml/Graphics.cpp

@@ -4,18 +4,18 @@
 #include "utility/misc.h"
 #include "utility/minmax.h"
 
-using namespace WalrusRPG;
-using WalrusRPG::Graphics::Texture;
-using WalrusRPG::Graphics::Pixel;
+using namespace WalrusRPG; /*::Graphics*/
 using WalrusRPG::Utils::Rect;
 
 sf::RenderWindow window;
 sf::View view;
 sf::RenderTexture buffer;
 
+
 void Graphics::init()
 {
-    // window.create(sf::VideoMode::getDesktopMode(), "WalrusRPG", sf::Style::Fullscreen);
+    // window.create(sf::VideoMode::getDesktopMode(), "WalrusRPG",
+    // sf::Style::Fullscreen);
     window.create(sf::VideoMode(640, 480), "WalrusRPG");
     window.setFramerateLimit(60);
     view = sf::View(window.getDefaultView());
@@ -53,8 +53,7 @@ void Graphics::frame_end()
     window.display();
 }
 
-void Graphics::put_sprite(const WalrusRPG::Graphics::Texture &sheet, int x, int y,
-                          const Rect &window)
+void Graphics::put_sprite(const Texture &sheet, int x, int y, const Rect &window)
 {
     sf::Sprite sprite;
     sprite.setTexture(sheet.data);
@@ -63,8 +62,8 @@ void Graphics::put_sprite(const WalrusRPG::Graphics::Texture &sheet, int x, int
     buffer.draw(sprite);
 }
 
-void Graphics::put_sprite_tint(const WalrusRPG::Graphics::Texture &sheet, int x, int y,
-                               const Rect &window, const Pixel &color)
+void Graphics::put_sprite_tint(const Texture &sheet, int x, int y, const Rect &window,
+                               const Pixel &color)
 {
     sf::Sprite sprite;
     sprite.setTexture(sheet.data);

+ 13 - 13
src/engine/StateMachine.cpp

@@ -6,13 +6,12 @@
 #include "version.h"
 #include "input/Input.h"
 
+using namespace WalrusRPG; /*::StateMachine*/
 using namespace WalrusRPG::Graphics;
-using namespace WalrusRPG::States;
 using namespace WalrusRPG::Timing;
 using WalrusRPG::Input::Key;
 using WalrusRPG::Input::KeyState;
-
-#define STATEMACHINE WalrusRPG::StateMachine
+using WalrusRPG::States::State;
 
 namespace
 {
@@ -54,31 +53,32 @@ namespace
         draw_button(48, 44, key_get_state(Key::K_B));
         draw_button(56, 36, key_get_state(Key::K_A));
     }
-} /* namespace  */
 
-STATEMACHINE::StateMachine(State *state)
+    static tinystl::vector<WalrusRPG::States::State *> stack;
+
+} /* namespace */
+
+void StateMachine::init()
 {
-    push(state);
 }
 
-STATEMACHINE::~StateMachine()
+void StateMachine::deinit()
 {
-    while (!stack.empty())
-        pop();
+    stack.clear();
 }
 
-void STATEMACHINE::push(State *state)
+void StateMachine::push(State *state)
 {
     stack.push_back(state);
 }
 
-void STATEMACHINE::pop()
+void StateMachine::pop()
 {
     delete stack.back();
     stack.pop_back();
 }
 
-void STATEMACHINE::run()
+void StateMachine::run()
 {
     const unsigned loop_time = TIMER_FREQ / 60;
     unsigned loop_next = loop_time;
@@ -115,7 +115,7 @@ void STATEMACHINE::run()
         {
             while (Input::key_down(Key::K_SELECT))
                 Input::key_poll();
-            this->pop();
+            StateMachine::pop();
         }
 
 #ifdef ACTIVE_WAIT

+ 3 - 7
src/engine/StateMachine.h

@@ -6,14 +6,10 @@
 
 namespace WalrusRPG
 {
-    class StateMachine
+    namespace StateMachine
     {
-      protected:
-        tinystl::vector<WalrusRPG::States::State *> stack;
-
-      public:
-        StateMachine(WalrusRPG::States::State *state);
-        ~StateMachine();
+        void init();
+        void deinit();
         void push(WalrusRPG::States::State *state);
         void pop();
         void run();

+ 4 - 3
src/engine/main.cpp

@@ -48,13 +48,14 @@ int main(int argc, char *argv[])
     map.anim.add_animation(21, {stripe21, true, 0});
     map.anim.add_animation(22, {stripe22, true, 0});
 
-    StateMachine machine(new States::StateMap(0, 0, map));
-    machine.run();
+    StateMachine::init();
+    StateMachine::push(new States::StateMap(0, 0, map));
+    StateMachine::run();
+    StateMachine::deinit();
 
     Quirks::deinit();
     Timing::deinit();
     Graphics::deinit();
-
     delete[] dungeonTest;
     delete[] dungeonTest2;
 

+ 7 - 7
src/input/Input.cpp

@@ -2,7 +2,7 @@
 #include "Quirks.h"
 #include "platform.h"
 
-#define INPUT WalrusRPG::Input
+using namespace WalrusRPG; /*::Input*/
 using WalrusRPG::Input::Key;
 using WalrusRPG::Input::KeyState;
 
@@ -44,7 +44,7 @@ static InputMap key_map[] = {
 };
 #endif
 
-KeyState INPUT::key_get_state(Key key)
+KeyState Input::key_get_state(Key key)
 {
     // "Just" pressed/released before held/inactive to let these events through
     if (key_pressed(key))
@@ -60,7 +60,7 @@ KeyState INPUT::key_get_state(Key key)
     return KS_RELEASED;
 }
 
-void INPUT::key_poll()
+void Input::key_poll()
 {
     for (unsigned i = 0; i < K_SIZE; i++)
     {
@@ -69,19 +69,19 @@ void INPUT::key_poll()
     }
 }
 
-bool INPUT::key_pressed(Key key)
+bool Input::key_pressed(Key key)
 {
     return !key_states[key].previous && key_states[key].current;
 }
-bool INPUT::key_released(Key key)
+bool Input::key_released(Key key)
 {
     return key_states[key].previous && !key_states[key].current;
 }
-bool INPUT::key_down(Key key)
+bool Input::key_down(Key key)
 {
     return key_states[key].current;
 }
-bool INPUT::key_up(Key key)
+bool Input::key_up(Key key)
 {
     return !key_states[key].current;
 }

+ 5 - 5
src/map/Entity.cpp

@@ -2,21 +2,21 @@
 #include "utility/misc.h"
 #include "utility/Rect.h"
 
-#define ENTITY WalrusRPG::Entity
+using WalrusRPG::Entity;
 using namespace WalrusRPG::Utils;
 
-ENTITY::Entity(int x, int y, unsigned w, unsigned h, WalrusRPG::Renderer *tset,
+Entity::Entity(int x, int y, unsigned w, unsigned h, WalrusRPG::Renderer *tset,
                unsigned sprite_id)
     : coords(x, y, w, h), tset(tset), sprite_id(sprite_id)
 {
 }
 
-ENTITY::~Entity()
+Entity::~Entity()
 {
     // TODO if you allocate dynamically members
 }
 
-void ENTITY::render(Camera &camera, unsigned dt) const
+void Entity::render(Camera &camera, unsigned dt) const
 {
     UNUSED(dt);
 
@@ -29,7 +29,7 @@ void ENTITY::render(Camera &camera, unsigned dt) const
     }
 }
 
-void ENTITY::update(unsigned dt)
+void Entity::update(unsigned dt)
 {
     UNUSED(dt);
     // TODO update map's data according to elasped time

+ 9 - 9
src/map/Map.cpp

@@ -5,14 +5,14 @@
 #include "utility/Rect.h"
 #include "utility/misc.h"
 
-#define MAP WalrusRPG::Map
+using WalrusRPG::Map;
 using namespace WalrusRPG;
 using namespace WalrusRPG::Utils;
 using WalrusRPG::Graphics::Texture;
 
 // Graphics::Texture tex_overworld((char *) overworld);
 
-MAP::Map(int width, int height, uint16_t *layer0, uint16_t *layer1, Texture &tex)
+Map::Map(int width, int height, uint16_t *layer0, uint16_t *layer1, Texture &tex)
     : anim(), tex(tex)
 {
     this->renderer = new TileRenderer(tex, 16, 16);
@@ -22,18 +22,18 @@ MAP::Map(int width, int height, uint16_t *layer0, uint16_t *layer1, Texture &tex
     this->layer1 = layer1;
 }
 
-MAP::~Map()
+Map::~Map()
 {
     delete this->renderer;
 }
 
-void MAP::update(unsigned dt)
+void Map::update(unsigned dt)
 {
     // TODO update map's data according to elasped time
     UNUSED(dt);
 }
 
-void MAP::render(WalrusRPG::Camera &camera, unsigned dt)
+void Map::render(WalrusRPG::Camera &camera, unsigned dt)
 {
     anim.update(dt);
     signed t_width = renderer->get_tile_width();
@@ -79,24 +79,24 @@ void MAP::render(WalrusRPG::Camera &camera, unsigned dt)
     }
 }
 
-bool MAP::is_tile_solid(int x, int y) const
+bool Map::is_tile_solid(int x, int y) const
 {
     if (x >= width || y >= height)
         return true;
     return this->layer0[y * width + x] != 0;
 }
 
-bool MAP::is_pixel_solid(int x, int y) const
+bool Map::is_pixel_solid(int x, int y) const
 {
     return is_tile_solid(x / renderer->get_tile_width(), y / renderer->get_tile_height());
 }
 
-int MAP::get_width() const
+int Map::get_width() const
 {
     return this->width;
 }
 
-int MAP::get_height() const
+int Map::get_height() const
 {
     return this->width;
 }

+ 250 - 299
src/map/StateMap.cpp

@@ -4,8 +4,7 @@
 #include "piaf/Archive.h"
 
 
-#define STATEMAP WalrusRPG::States::StateMap
-
+using WalrusRPG::States::StateMap;
 using namespace WalrusRPG;
 using namespace WalrusRPG::Graphics;
 using WalrusRPG::Utils::Rect;
@@ -15,105 +14,104 @@ using WalrusRPG::Graphics::Texture;
 
 namespace
 {
-
     // x, y, width, height, xoffset, yoffset
     const int16_t haeccity[][6] = {
         ///*32*/{0, 0, 0, 0},
-/*33*/{0, 0, 1, 6, 0, 3},
-/*34*/{1, 0, 3, 2, 0, 3},
-/*35*/{4, 0, 5, 5, 0, 3},
-/*36*/{9, 0, 5, 7, 0, 3},
-/*37*/{0, 6, 8, 6, 0, 3},
-/*38*/{14, 0, 5, 6, 0, 3},
-/*39*/{1, 2, 1, 2, 0, 3},
-/*40*/{19, 0, 2, 8, 0, 2},
-/*41*/{8, 7, 2, 8, 0, 2},
-/*42*/{0, 12, 5, 5, 0, 2},
-/*43*/{5, 12, 3, 3, 0, 5},
-/*44*/{1, 4, 2, 2, 0, 8},
-/*45*/{2, 2, 2, 2, 0, 5},
-/*46*/{8, 5, 1, 1, 0, 8},
-/*47*/{10, 7, 3, 7, 0, 3},
-/*48*/{13, 7, 4, 6, 0, 3},
-/*49*/{17, 6, 2, 6, 0, 3},
-/*50*/{21, 0, 4, 6, 0, 3},
-/*51*/{25, 0, 3, 6, 0, 3},
-/*52*/{28, 0, 5, 6, 0, 3},
-/*53*/{33, 0, 3, 6, 0, 3},
-/*54*/{36, 0, 4, 6, 0, 3},
-/*55*/{40, 0, 3, 6, 0, 3},
-/*56*/{43, 0, 4, 6, 0, 3},
-/*57*/{47, 0, 4, 6, 0, 3},
-/*58*/{51, 0, 1, 5, 0, 4},
-/*59*/{52, 0, 2, 6, 0, 4},
-/*60*/{54, 0, 3, 5, 0, 4},
-/*61*/{57, 0, 3, 3, 0, 5},
-/*62*/{60, 0, 3, 5, 0, 4},
-/*63*/{57, 3, 3, 6, 0, 3},
-/*64*/{19, 8, 5, 6, 0, 3},
-/*65*/{13, 13, 4, 6, 0, 3},
-/*66*/{0, 17, 4, 6, 0, 3},
-/*67*/{4, 17, 4, 6, 0, 3},
-/*68*/{8, 15, 4, 6, 0, 3},
-/*69*/{24, 6, 3, 6, 0, 3},
-/*70*/{27, 6, 3, 6, 0, 3},
-/*71*/{30, 6, 4, 6, 0, 3},
-/*72*/{34, 6, 4, 6, 0, 3},
-/*73*/{12, 14, 1, 6, 0, 3},
-/*74*/{38, 6, 3, 7, 0, 3},
-/*75*/{24, 12, 4, 6, 0, 3},
-/*76*/{17, 14, 3, 6, 0, 3},
-/*77*/{28, 12, 5, 6, 0, 3},
-/*78*/{13, 19, 4, 6, 0, 3},
-/*79*/{0, 23, 4, 6, 0, 3},
-/*80*/{4, 23, 4, 6, 0, 3},
-/*81*/{8, 21, 5, 7, 0, 3},
-/*82*/{20, 14, 4, 6, 0, 3},
-/*83*/{33, 12, 4, 6, 0, 3},
-/*84*/{41, 6, 3, 6, 0, 3},
-/*85*/{44, 6, 4, 6, 0, 3},
-/*86*/{48, 6, 5, 6, 0, 3},
-/*87*/{63, 0, 5, 6, 0, 3},
-/*88*/{68, 0, 5, 6, 0, 3},
-/*89*/{73, 0, 5, 6, 0, 3},
-/*90*/{53, 6, 4, 6, 0, 3},
-/*91*/{60, 5, 2, 8, 0, 2},
-/*92*/{41, 12, 3, 7, 0, 3},
-/*93*/{24, 18, 2, 8, 0, 2},
-/*94*/{13, 25, 5, 3, 0, 2},
-/*95*/{3, 5, 4, 1, 0, 10},
-/*96*/{17, 12, 2, 2, 1, 1},
-/*97*/{17, 20, 4, 5, 0, 4},
-/*98*/{18, 25, 4, 7, 0, 2},
-/*99*/{21, 20, 3, 5, 0, 4},
-/*100*/{0, 29, 4, 7, 0, 2},
-/*101*/{4, 29, 4, 5, 0, 4},
-/*102*/{8, 28, 4, 8, 0, 2},
-/*103*/{4, 34, 4, 6, 0, 4},
-/*104*/{0, 36, 4, 7, 0, 2},
-/*105*/{12, 28, 1, 7, 0, 2},
-/*106*/{13, 28, 2, 8, 0, 2},
-/*107*/{26, 18, 4, 7, 0, 2},
-/*108*/{15, 28, 2, 7, 0, 2},
-/*109*/{30, 18, 5, 5, 0, 4},
-/*110*/{35, 18, 4, 5, 0, 4},
-/*111*/{37, 13, 4, 5, 0, 4},
-/*112*/{44, 12, 4, 6, 0, 4},
-/*113*/{48, 12, 4, 6, 0, 4},
-/*114*/{52, 12, 3, 5, 0, 4},
-/*115*/{55, 12, 4, 5, 0, 4},
-/*116*/{78, 0, 3, 6, 0, 3},
-/*117*/{81, 0, 4, 5, 0, 4},
-/*118*/{85, 0, 3, 5, 0, 4},
-/*119*/{88, 0, 5, 5, 0, 4},
-/*120*/{93, 0, 3, 5, 0, 4},
-/*121*/{96, 0, 4, 6, 0, 4},
-/*122*/{81, 5, 3, 5, 0, 4},
-/*123*/{62, 6, 3, 8, 0, 2},
-/*124*/{12, 35, 1, 7, 0, 3},
-/*125*/{4, 40, 3, 8, 0, 2},
-/*126*/{7, 40, 5, 2, 0, 5},
-/*127*/{65, 6, 5, 5, 0, 4},
+        /*33*/ {0, 0, 1, 6, 0, 3},
+        /*34*/ {1, 0, 3, 2, 0, 3},
+        /*35*/ {4, 0, 5, 5, 0, 3},
+        /*36*/ {9, 0, 5, 7, 0, 3},
+        /*37*/ {0, 6, 8, 6, 0, 3},
+        /*38*/ {14, 0, 5, 6, 0, 3},
+        /*39*/ {1, 2, 1, 2, 0, 3},
+        /*40*/ {19, 0, 2, 8, 0, 2},
+        /*41*/ {8, 7, 2, 8, 0, 2},
+        /*42*/ {0, 12, 5, 5, 0, 2},
+        /*43*/ {5, 12, 3, 3, 0, 5},
+        /*44*/ {1, 4, 2, 2, 0, 8},
+        /*45*/ {2, 2, 2, 2, 0, 5},
+        /*46*/ {8, 5, 1, 1, 0, 8},
+        /*47*/ {10, 7, 3, 7, 0, 3},
+        /*48*/ {13, 7, 4, 6, 0, 3},
+        /*49*/ {17, 6, 2, 6, 0, 3},
+        /*50*/ {21, 0, 4, 6, 0, 3},
+        /*51*/ {25, 0, 3, 6, 0, 3},
+        /*52*/ {28, 0, 5, 6, 0, 3},
+        /*53*/ {33, 0, 3, 6, 0, 3},
+        /*54*/ {36, 0, 4, 6, 0, 3},
+        /*55*/ {40, 0, 3, 6, 0, 3},
+        /*56*/ {43, 0, 4, 6, 0, 3},
+        /*57*/ {47, 0, 4, 6, 0, 3},
+        /*58*/ {51, 0, 1, 5, 0, 4},
+        /*59*/ {52, 0, 2, 6, 0, 4},
+        /*60*/ {54, 0, 3, 5, 0, 4},
+        /*61*/ {57, 0, 3, 3, 0, 5},
+        /*62*/ {60, 0, 3, 5, 0, 4},
+        /*63*/ {57, 3, 3, 6, 0, 3},
+        /*64*/ {19, 8, 5, 6, 0, 3},
+        /*65*/ {13, 13, 4, 6, 0, 3},
+        /*66*/ {0, 17, 4, 6, 0, 3},
+        /*67*/ {4, 17, 4, 6, 0, 3},
+        /*68*/ {8, 15, 4, 6, 0, 3},
+        /*69*/ {24, 6, 3, 6, 0, 3},
+        /*70*/ {27, 6, 3, 6, 0, 3},
+        /*71*/ {30, 6, 4, 6, 0, 3},
+        /*72*/ {34, 6, 4, 6, 0, 3},
+        /*73*/ {12, 14, 1, 6, 0, 3},
+        /*74*/ {38, 6, 3, 7, 0, 3},
+        /*75*/ {24, 12, 4, 6, 0, 3},
+        /*76*/ {17, 14, 3, 6, 0, 3},
+        /*77*/ {28, 12, 5, 6, 0, 3},
+        /*78*/ {13, 19, 4, 6, 0, 3},
+        /*79*/ {0, 23, 4, 6, 0, 3},
+        /*80*/ {4, 23, 4, 6, 0, 3},
+        /*81*/ {8, 21, 5, 7, 0, 3},
+        /*82*/ {20, 14, 4, 6, 0, 3},
+        /*83*/ {33, 12, 4, 6, 0, 3},
+        /*84*/ {41, 6, 3, 6, 0, 3},
+        /*85*/ {44, 6, 4, 6, 0, 3},
+        /*86*/ {48, 6, 5, 6, 0, 3},
+        /*87*/ {63, 0, 5, 6, 0, 3},
+        /*88*/ {68, 0, 5, 6, 0, 3},
+        /*89*/ {73, 0, 5, 6, 0, 3},
+        /*90*/ {53, 6, 4, 6, 0, 3},
+        /*91*/ {60, 5, 2, 8, 0, 2},
+        /*92*/ {41, 12, 3, 7, 0, 3},
+        /*93*/ {24, 18, 2, 8, 0, 2},
+        /*94*/ {13, 25, 5, 3, 0, 2},
+        /*95*/ {3, 5, 4, 1, 0, 10},
+        /*96*/ {17, 12, 2, 2, 1, 1},
+        /*97*/ {17, 20, 4, 5, 0, 4},
+        /*98*/ {18, 25, 4, 7, 0, 2},
+        /*99*/ {21, 20, 3, 5, 0, 4},
+        /*100*/ {0, 29, 4, 7, 0, 2},
+        /*101*/ {4, 29, 4, 5, 0, 4},
+        /*102*/ {8, 28, 4, 8, 0, 2},
+        /*103*/ {4, 34, 4, 6, 0, 4},
+        /*104*/ {0, 36, 4, 7, 0, 2},
+        /*105*/ {12, 28, 1, 7, 0, 2},
+        /*106*/ {13, 28, 2, 8, 0, 2},
+        /*107*/ {26, 18, 4, 7, 0, 2},
+        /*108*/ {15, 28, 2, 7, 0, 2},
+        /*109*/ {30, 18, 5, 5, 0, 4},
+        /*110*/ {35, 18, 4, 5, 0, 4},
+        /*111*/ {37, 13, 4, 5, 0, 4},
+        /*112*/ {44, 12, 4, 6, 0, 4},
+        /*113*/ {48, 12, 4, 6, 0, 4},
+        /*114*/ {52, 12, 3, 5, 0, 4},
+        /*115*/ {55, 12, 4, 5, 0, 4},
+        /*116*/ {78, 0, 3, 6, 0, 3},
+        /*117*/ {81, 0, 4, 5, 0, 4},
+        /*118*/ {85, 0, 3, 5, 0, 4},
+        /*119*/ {88, 0, 5, 5, 0, 4},
+        /*120*/ {93, 0, 3, 5, 0, 4},
+        /*121*/ {96, 0, 4, 6, 0, 4},
+        /*122*/ {81, 5, 3, 5, 0, 4},
+        /*123*/ {62, 6, 3, 8, 0, 2},
+        /*124*/ {12, 35, 1, 7, 0, 3},
+        /*125*/ {4, 40, 3, 8, 0, 2},
+        /*126*/ {7, 40, 5, 2, 0, 5},
+        /*127*/ {65, 6, 5, 5, 0, 4},
         /*uncovered by littera for now*/
         {0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0},
@@ -127,7 +125,7 @@ namespace
         {0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0},
-/*338*/{22, 26, 6, 6, 0, 3},
+        /*338*/ {22, 26, 6, 6, 0, 3},
         {0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0},
@@ -143,186 +141,124 @@ namespace
         {0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0},
-/*339*/{32, 25, 6, 5, 0, 4},
+        /*339*/ {32, 25, 6, 5, 0, 4},
         {0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0},
         {7, 42, 5, 8, 0, 1},
         {0, 0, 0, 0, 0, 0},
-/*161*/{0, 48, 1, 6, 0, 4},
-/*162*/{1, 48, 4, 7, 0, 3},
-/*163*/{32, 30, 4, 6, 0, 3},
-/*164*/{21, 35, 6, 4, 0, 3},
-/*165*/{27, 34, 5, 6, 0, 3},
-/*166*/{0, 54, 1, 7, 0, 3},
-/*167*/{21, 39, 3, 7, 0, 3},
-/*168*/{14, 6, 3, 1, 1, 2},
-/*169*/{36, 30, 6, 7, 0, 2},
-/*170*/{38, 25, 4, 5, 0, 2},
-/*171*/{16, 42, 5, 3, 0, 5},
-/*172*/{35, 23, 4, 2, 0, 5},
-/*173*/{15, 35, 2, 2, 0, 5},
-/*174*/{84, 5, 7, 8, 0, 2},
-/*175*/{54, 5, 3, 1, 0, 2},
-/*176*/{16, 45, 3, 3, 0, 2},
-/*177*/{12, 47, 3, 5, 0, 4},
-/*178*/{5, 50, 2, 4, 0, 3},
-/*179*/{7, 50, 2, 4, 0, 3},
-/*180*/{15, 37, 2, 2, 1, 1},
-/*181*/{75, 10, 5, 6, 0, 4},
-/*182*/{32, 36, 4, 7, 0, 3},
-/*183*/{8, 6, 1, 1, 0, 6},
-/*184*/{5, 48, 2, 2, 1, 9},
-/*185*/{75, 6, 2, 4, 0, 3},
-/*186*/{24, 40, 4, 5, 0, 2},
-/*187*/{70, 13, 5, 3, 0, 5},
-/*188*/{100, 0, 7, 6, 0, 3},
-/*189*/{107, 0, 6, 6, 0, 3},
-/*190*/{113, 0, 7, 6, 0, 3},
-/*191*/{9, 50, 3, 6, 0, 4},
-/*192*/{1, 55, 4, 9, 0, 0},
-/*193*/{5, 54, 4, 9, 0, 0},
-/*194*/{28, 40, 4, 9, 0, 0},
-/*195*/{15, 48, 4, 9, 0, 0},
-/*196*/{9, 56, 4, 8, 0, 1},
-/*197*/{5, 63, 4, 9, 0, 0},
-/*198*/{19, 46, 6, 6, 0, 3},
-/*199*/{0, 64, 4, 8, 0, 3},
-/*200*/{25, 45, 3, 9, 0, 0},
-/*201*/{19, 52, 3, 9, 0, 0},
-/*202*/{13, 57, 3, 9, 0, 0},
-/*203*/{9, 64, 3, 8, 0, 1},
-/*204*/{16, 57, 2, 9, 0, 0},
-/*205*/{22, 52, 2, 9, 0, 0},
-/*206*/{46, 23, 3, 9, -1, 0},
-/*207*/{61, 18, 3, 8, -1, 1},
-/*208*/{49, 24, 5, 6, 0, 3},
-/*209*/{54, 24, 4, 9, 0, 0},
-/*210*/{42, 32, 4, 9, 0, 0},
-/*211*/{36, 37, 4, 9, 0, 0},
-/*212*/{32, 43, 4, 9, 0, 0},
-/*213*/{28, 49, 4, 9, 0, 0},
-/*214*/{24, 54, 4, 8, 0, 1},
-/*215*/{12, 52, 3, 3, 0, 5},
-/*216*/{18, 61, 4, 6, 0, 3},
-/*217*/{12, 66, 4, 9, 0, 0},
-/*218*/{0, 72, 4, 9, 0, 0},
-/*219*/{4, 72, 4, 9, 0, 0},
-/*220*/{8, 72, 4, 8, 0, 1},
-/*221*/{46, 32, 5, 9, 0, 0},
-/*222*/{80, 10, 4, 6, 0, 3},
-/*223*/{91, 5, 4, 6, 0, 3},
-/*224*/{120, 0, 4, 8, 0, 1},
-/*225*/{95, 6, 4, 8, 0, 1},
-/*226*/{84, 13, 4, 8, 0, 1},
-/*227*/{64, 19, 4, 8, 0, 1},
-/*228*/{58, 26, 4, 7, 0, 2},
-/*229*/{68, 19, 4, 8, 0, 1},
-/*230*/{72, 16, 5, 5, 0, 4},
-/*231*/{77, 16, 4, 7, 0, 4},
-/*232*/{72, 21, 4, 8, 0, 1},
-/*233*/{62, 27, 4, 8, 0, 1},
-/*234*/{51, 33, 4, 8, 0, 1},
-/*235*/{55, 33, 4, 7, 0, 2},
-/*236*/{16, 66, 2, 8, 0, 1},
-/*237*/{22, 61, 2, 8, 0, 1},
-/*238*/{18, 67, 3, 8, -1, 1},
-/*239*/{59, 33, 3, 7, -1, 2},
-/*240*/{66, 27, 4, 7, 0, 2},
-/*241*/{88, 13, 4, 8, 0, 1},
-/*242*/{99, 6, 4, 8, 0, 1},
-/*243*/{103, 6, 4, 8, 0, 1},
-/*244*/{107, 6, 4, 8, 0, 1},
-/*245*/{111, 6, 4, 8, 0, 1},
-/*246*/{115, 6, 4, 7, 0, 2},
-/*247*/{81, 16, 3, 5, 0, 4},
-/*248*/{124, 0, 4, 5, 0, 4},
-/*249*/{128, 0, 4, 8, 0, 1},
-/*250*/{124, 5, 4, 8, 0, 1},
-/*251*/{119, 8, 4, 8, 0, 1},
-/*252*/{92, 14, 4, 7, 0, 2},
-/*253*/{96, 14, 4, 9, 0, 1},
-/*254*/{81, 21, 3, 8, 0, 2},
-/*255*/{76, 23, 4, 8, 0, 2}
-    };
+        /*161*/ {0, 48, 1, 6, 0, 4},
+        /*162*/ {1, 48, 4, 7, 0, 3},
+        /*163*/ {32, 30, 4, 6, 0, 3},
+        /*164*/ {21, 35, 6, 4, 0, 3},
+        /*165*/ {27, 34, 5, 6, 0, 3},
+        /*166*/ {0, 54, 1, 7, 0, 3},
+        /*167*/ {21, 39, 3, 7, 0, 3},
+        /*168*/ {14, 6, 3, 1, 1, 2},
+        /*169*/ {36, 30, 6, 7, 0, 2},
+        /*170*/ {38, 25, 4, 5, 0, 2},
+        /*171*/ {16, 42, 5, 3, 0, 5},
+        /*172*/ {35, 23, 4, 2, 0, 5},
+        /*173*/ {15, 35, 2, 2, 0, 5},
+        /*174*/ {84, 5, 7, 8, 0, 2},
+        /*175*/ {54, 5, 3, 1, 0, 2},
+        /*176*/ {16, 45, 3, 3, 0, 2},
+        /*177*/ {12, 47, 3, 5, 0, 4},
+        /*178*/ {5, 50, 2, 4, 0, 3},
+        /*179*/ {7, 50, 2, 4, 0, 3},
+        /*180*/ {15, 37, 2, 2, 1, 1},
+        /*181*/ {75, 10, 5, 6, 0, 4},
+        /*182*/ {32, 36, 4, 7, 0, 3},
+        /*183*/ {8, 6, 1, 1, 0, 6},
+        /*184*/ {5, 48, 2, 2, 1, 9},
+        /*185*/ {75, 6, 2, 4, 0, 3},
+        /*186*/ {24, 40, 4, 5, 0, 2},
+        /*187*/ {70, 13, 5, 3, 0, 5},
+        /*188*/ {100, 0, 7, 6, 0, 3},
+        /*189*/ {107, 0, 6, 6, 0, 3},
+        /*190*/ {113, 0, 7, 6, 0, 3},
+        /*191*/ {9, 50, 3, 6, 0, 4},
+        /*192*/ {1, 55, 4, 9, 0, 0},
+        /*193*/ {5, 54, 4, 9, 0, 0},
+        /*194*/ {28, 40, 4, 9, 0, 0},
+        /*195*/ {15, 48, 4, 9, 0, 0},
+        /*196*/ {9, 56, 4, 8, 0, 1},
+        /*197*/ {5, 63, 4, 9, 0, 0},
+        /*198*/ {19, 46, 6, 6, 0, 3},
+        /*199*/ {0, 64, 4, 8, 0, 3},
+        /*200*/ {25, 45, 3, 9, 0, 0},
+        /*201*/ {19, 52, 3, 9, 0, 0},
+        /*202*/ {13, 57, 3, 9, 0, 0},
+        /*203*/ {9, 64, 3, 8, 0, 1},
+        /*204*/ {16, 57, 2, 9, 0, 0},
+        /*205*/ {22, 52, 2, 9, 0, 0},
+        /*206*/ {46, 23, 3, 9, -1, 0},
+        /*207*/ {61, 18, 3, 8, -1, 1},
+        /*208*/ {49, 24, 5, 6, 0, 3},
+        /*209*/ {54, 24, 4, 9, 0, 0},
+        /*210*/ {42, 32, 4, 9, 0, 0},
+        /*211*/ {36, 37, 4, 9, 0, 0},
+        /*212*/ {32, 43, 4, 9, 0, 0},
+        /*213*/ {28, 49, 4, 9, 0, 0},
+        /*214*/ {24, 54, 4, 8, 0, 1},
+        /*215*/ {12, 52, 3, 3, 0, 5},
+        /*216*/ {18, 61, 4, 6, 0, 3},
+        /*217*/ {12, 66, 4, 9, 0, 0},
+        /*218*/ {0, 72, 4, 9, 0, 0},
+        /*219*/ {4, 72, 4, 9, 0, 0},
+        /*220*/ {8, 72, 4, 8, 0, 1},
+        /*221*/ {46, 32, 5, 9, 0, 0},
+        /*222*/ {80, 10, 4, 6, 0, 3},
+        /*223*/ {91, 5, 4, 6, 0, 3},
+        /*224*/ {120, 0, 4, 8, 0, 1},
+        /*225*/ {95, 6, 4, 8, 0, 1},
+        /*226*/ {84, 13, 4, 8, 0, 1},
+        /*227*/ {64, 19, 4, 8, 0, 1},
+        /*228*/ {58, 26, 4, 7, 0, 2},
+        /*229*/ {68, 19, 4, 8, 0, 1},
+        /*230*/ {72, 16, 5, 5, 0, 4},
+        /*231*/ {77, 16, 4, 7, 0, 4},
+        /*232*/ {72, 21, 4, 8, 0, 1},
+        /*233*/ {62, 27, 4, 8, 0, 1},
+        /*234*/ {51, 33, 4, 8, 0, 1},
+        /*235*/ {55, 33, 4, 7, 0, 2},
+        /*236*/ {16, 66, 2, 8, 0, 1},
+        /*237*/ {22, 61, 2, 8, 0, 1},
+        /*238*/ {18, 67, 3, 8, -1, 1},
+        /*239*/ {59, 33, 3, 7, -1, 2},
+        /*240*/ {66, 27, 4, 7, 0, 2},
+        /*241*/ {88, 13, 4, 8, 0, 1},
+        /*242*/ {99, 6, 4, 8, 0, 1},
+        /*243*/ {103, 6, 4, 8, 0, 1},
+        /*244*/ {107, 6, 4, 8, 0, 1},
+        /*245*/ {111, 6, 4, 8, 0, 1},
+        /*246*/ {115, 6, 4, 7, 0, 2},
+        /*247*/ {81, 16, 3, 5, 0, 4},
+        /*248*/ {124, 0, 4, 5, 0, 4},
+        /*249*/ {128, 0, 4, 8, 0, 1},
+        /*250*/ {124, 5, 4, 8, 0, 1},
+        /*251*/ {119, 8, 4, 8, 0, 1},
+        /*252*/ {92, 14, 4, 7, 0, 2},
+        /*253*/ {96, 14, 4, 9, 0, 1},
+        /*254*/ {81, 21, 3, 8, 0, 2},
+        /*255*/ {76, 23, 4, 8, 0, 2}};
 
     const int8_t haeccity_kernings[][3] = {
-        {66, 74, -1},
-        {67, 74, -1},
-        {68, 74, -1},
-        {70, 44, -2},
-        {70, 46, -1},
-        {70, 59, -1},
-        {70, 74, -2},
-        {71, 74, -1},
-        {76, 34, -1},
-        {76, 39, -1},
-        {76, 84, -1},
-        {76, 86, -1},
-        {76, 87, -1},
-        {76, 89, -1},
-        {76, 121, -1},
-        {79, 74, -1},
-        {80, 44, -2},
-        {80, 46, -1},
-        {80, 59, -1},
-        {80, 74, -1},
-        {80, 88, -1},
-        {80, 97, -1},
-        {84, 44, -1},
-        {84, 46, -1},
-        {84, 59, -1},
-        {84, 74, -1},
-        {84, 97, -1},
-        {86, 44, -2},
-        {86, 46, -1},
-        {86, 59, -1},
-        {86, 74, -1},
-        {86, 97, -1},
-        {87, 59, -1},
-        {87, 74, -1},
-        {89, 44, -2},
-        {89, 46, -1},
-        {89, 59, -1},
-        {89, 74, -1},
-        {98, 44, -1},
-        {98, 106, -1},
-        {101, 44, -1},
-        {101, 97, -1},
-        {101, 106, -1},
-        {102, 34, 1},
-        {102, 39, 1},
-        {102, 44, -1},
-        {102, 97, -1},
-        {107, 97, -1},
-        {107, 102, -1},
-        {107, 103, -1},
-        {107, 115, -1},
-        {107, 116, -1},
-        {107, 118, -1},
-        {107, 121, -1},
-        {108, 97, -1},
-        {108, 102, -1},
-        {108, 103, -1},
-        {108, 115, -1},
-        {108, 116, -1},
-        {108, 121, -1},
-        {111, 44, -1},
-        {111, 106, -1},
-        {112, 44, -1},
-        {112, 106, -1},
-        {114, 44, -2},
-        {114, 46, -1},
-        {114, 97, -1},
-        {114, 100, -1},
-        {114, 106, -1},
-        {115, 44, -1},
-        {115, 102, -1},
-        {115, 106, -1},
-        {115, 116, -1},
-        {118, 44, -1},
-        {118, 106, -1},
-        {119, 44, -1},
-        {119, 106, -1},
+        {66, 74, -1},   {67, 74, -1},   {68, 74, -1},   {70, 44, -2},   {70, 46, -1},
+        {70, 59, -1},   {70, 74, -2},   {71, 74, -1},   {76, 34, -1},   {76, 39, -1},
+        {76, 84, -1},   {76, 86, -1},   {76, 87, -1},   {76, 89, -1},   {76, 121, -1},
+        {79, 74, -1},   {80, 44, -2},   {80, 46, -1},   {80, 59, -1},   {80, 74, -1},
+        {80, 88, -1},   {80, 97, -1},   {84, 44, -1},   {84, 46, -1},   {84, 59, -1},
+        {84, 74, -1},   {84, 97, -1},   {86, 44, -2},   {86, 46, -1},   {86, 59, -1},
+        {86, 74, -1},   {86, 97, -1},   {87, 59, -1},   {87, 74, -1},   {89, 44, -2},
+        {89, 46, -1},   {89, 59, -1},   {89, 74, -1},   {98, 44, -1},   {98, 106, -1},
+        {101, 44, -1},  {101, 97, -1},  {101, 106, -1}, {102, 34, 1},   {102, 39, 1},
+        {102, 44, -1},  {102, 97, -1},  {107, 97, -1},  {107, 102, -1}, {107, 103, -1},
+        {107, 115, -1}, {107, 116, -1}, {107, 118, -1}, {107, 121, -1}, {108, 97, -1},
+        {108, 102, -1}, {108, 103, -1}, {108, 115, -1}, {108, 116, -1}, {108, 121, -1},
+        {111, 44, -1},  {111, 106, -1}, {112, 44, -1},  {112, 106, -1}, {114, 44, -2},
+        {114, 46, -1},  {114, 97, -1},  {114, 100, -1}, {114, 106, -1}, {115, 44, -1},
+        {115, 102, -1}, {115, 106, -1}, {115, 116, -1}, {118, 44, -1},  {118, 106, -1},
+        {119, 44, -1},  {119, 106, -1},
     };
 
     void print_debug_camera_data(const Camera &camera)
@@ -334,53 +270,63 @@ namespace
     {
         Text::print_format(0, 16, "MAP : W: %d, H:%d", map.get_width(), map.get_height());
     }
-
 }
 
-void STATEMAP::putchar_haeccity(unsigned char c, unsigned x, unsigned y)
+void StateMap::putchar_haeccity(unsigned char c, unsigned x, unsigned y)
 {
-        if(c <= 32) return;
-        c -= 33;
-        Rect letter{haeccity[c][0], haeccity[c][1], haeccity[c][2], haeccity[c][3]};
-        put_sprite(tex_haeccity, x + haeccity[c][4], y + haeccity[c][5], letter);        
+    if (c <= 32)
+        return;
+    c -= 33;
+    Rect letter{haeccity[c][0], haeccity[c][1], haeccity[c][2], haeccity[c][3]};
+    put_sprite(tex_haeccity, x + haeccity[c][4], y + haeccity[c][5], letter);
 }
 
-void STATEMAP::putchar_haeccity_tint(unsigned char c, unsigned x, unsigned y, const Pixel& col)
+void StateMap::putchar_haeccity_tint(unsigned char c, unsigned x, unsigned y,
+                                     const Pixel &col)
 {
-        if(c <= 32) return;
-        c -= 33;
-        Rect letter{haeccity[c][0], haeccity[c][1], haeccity[c][2], haeccity[c][3]};
-        put_sprite_tint(tex_haeccity, x + haeccity[c][4], y + haeccity[c][5], letter, col);  
+    if (c <= 32)
+        return;
+    c -= 33;
+    Rect letter{haeccity[c][0], haeccity[c][1], haeccity[c][2], haeccity[c][3]};
+    put_sprite_tint(tex_haeccity, x + haeccity[c][4], y + haeccity[c][5], letter, col);
 }
 
 
-void STATEMAP::print_haeccity(const char *str, unsigned x, unsigned y, const Pixel& col = White)
+void StateMap::print_haeccity(const char *str, unsigned x, unsigned y,
+                              const Pixel &col = White)
 {
     const bool must_tint = (col != White);
-    for(unsigned i = 0; str[i] && x < 320; i++)
+    for (unsigned i = 0; str[i] && x < 320; i++)
     {
         unsigned char c = str[i];
-        if(c < 32) continue;
-        if(c == 32) {x+=2; continue;}
+        if (c < 32)
+            continue;
+        if (c == 32)
+        {
+            x += 2;
+            continue;
+        }
         // printf("%c = %d\n", c, c);
-        if(must_tint)
+        if (must_tint)
             putchar_haeccity_tint(c, x, y, col);
         else
             putchar_haeccity(c, x, y);
-        x += haeccity[c-33][2] +1;
+        x += haeccity[c - 33][2] + 1;
     }
 }
 
-STATEMAP::StateMap(int x, int y, Map &map) : camera(x, y), map(map), arc_haeccity("data/haeccity.wrf"), tex_haeccity(arc_haeccity.get("haeccity"))
+StateMap::StateMap(int x, int y, Map &map)
+    : camera(x, y), map(map), arc_haeccity("data/haeccity.wrf"),
+      tex_haeccity(arc_haeccity.get("haeccity"))
 {
 }
 
-void STATEMAP::update(unsigned dt)
+void StateMap::update(unsigned dt)
 {
     camera.update(dt);
 }
 
-void STATEMAP::render(unsigned dt)
+void StateMap::render(unsigned dt)
 {
     // fill(Black);
     map.render(camera, dt);
@@ -389,17 +335,22 @@ void STATEMAP::render(unsigned dt)
     // print_debug_map_data(map);
     print_haeccity("Hello world! :D", 0, 0);
     print_haeccity("This isn't actually a utility nor built-ins functions.", 0, 9);
-    print_haeccity("This is a quick prototype to see if variable-wdith fonts works.", 0, 18);
-    print_haeccity("Builting it myself allows me to make it work on calc too.", 0, 27, Yellow);
-    print_haeccity("( I wonder if a conditionnal to tint the text slows down a lot the process. )", 0, 36, Gray);
-    print_haeccity("Oh well, I hope I'll get to do a pretty textbox like in games !", 0, 45);
+    print_haeccity("This is a quick prototype to see if variable-wdith fonts works.", 0,
+                   18);
+    print_haeccity("Builting it myself allows me to make it work on calc too.", 0, 27,
+                   Yellow);
+    print_haeccity(
+        "( I wonder if a conditionnal to tint the text slows down a lot the process. )",
+        0, 36, Gray);
+    print_haeccity("Oh well, I hope I'll get to do a pretty textbox like in games !", 0,
+                   45);
 
     for (int i = 0; i < 16; ++i)
     {
         for (int j = 0; j < 16; ++j)
         {
-            putchar_haeccity_tint(16*j + i+32, 6*i, 9*j + 54, Pixel(i*16, j*16, 255));
+            putchar_haeccity_tint(16 * j + i + 32, 6 * i, 9 * j + 54,
+                                  Pixel(i * 16, j * 16, 255));
         }
     }
-    
 }

+ 4 - 2
src/map/StateMap.h

@@ -22,8 +22,10 @@ namespace WalrusRPG
             void render(unsigned dt);
             void update(unsigned dt);
             void putchar_haeccity(unsigned char c, unsigned x, unsigned y);
-            void putchar_haeccity_tint(unsigned char c, unsigned x, unsigned y, const WalrusRPG::Graphics::Pixel& col);
-            void print_haeccity(const char *str, unsigned x, unsigned y, const WalrusRPG::Graphics::Pixel& col);
+            void putchar_haeccity_tint(unsigned char c, unsigned x, unsigned y,
+                                       const WalrusRPG::Graphics::Pixel &col);
+            void print_haeccity(const char *str, unsigned x, unsigned y,
+                                const WalrusRPG::Graphics::Pixel &col);
         };
     }
 }

+ 5 - 6
src/render/Animator.cpp

@@ -1,7 +1,6 @@
 #include "Animator.h"
 
-#define ANIMATOR WalrusRPG::Animator
-
+using WalrusRPG::Animator;
 using namespace WalrusRPG;
 
 namespace
@@ -43,25 +42,25 @@ namespace
     }
 }
 
-ANIMATOR::Animator()
+Animator::Animator()
 {
     elapsed_time = 0;
 }
 
-void ANIMATOR::add_animation(int index, Animation anim)
+void Animator::add_animation(int index, Animation anim)
 {
     animations[index] = anim;
     animations[index].duration = get_animation_duration(anim);
 }
 
-unsigned ANIMATOR::get_animation_frame(unsigned id)
+unsigned Animator::get_animation_frame(unsigned id)
 {
     if (animations[id].stripe.empty())
         return id;
     return find_frame(animations[id], elapsed_time);
 }
 
-void ANIMATOR::update(unsigned dt)
+void Animator::update(unsigned dt)
 {
     elapsed_time += dt;
 }

+ 9 - 10
src/render/Camera.cpp

@@ -2,12 +2,11 @@
 #include "utility/misc.h"
 #include "input/Input.h"
 
-#define CAMERA WalrusRPG::Camera
-
+using WalrusRPG::Camera;
 using namespace WalrusRPG;
 using WalrusRPG::Input::Key;
 
-CAMERA::Camera(signed x, signed y)
+Camera::Camera(signed x, signed y)
 {
     this->x = x;
     this->y = y;
@@ -15,12 +14,12 @@ CAMERA::Camera(signed x, signed y)
     render_area_height = 240;
 }
 
-CAMERA::~Camera()
+Camera::~Camera()
 {
     // TODO if you allocate dynamically members
 }
 
-void CAMERA::update(unsigned dt)
+void Camera::update(unsigned dt)
 {
     UNUSED(dt);
     // TODO update map's data according to elasped time
@@ -41,27 +40,27 @@ void CAMERA::update(unsigned dt)
         x--;
 }
 
-void CAMERA::set_x(signed x)
+void Camera::set_x(signed x)
 {
     this->x = x;
 }
 
-signed CAMERA::get_x() const
+signed Camera::get_x() const
 {
     return this->x;
 }
 
-void CAMERA::set_y(signed y)
+void Camera::set_y(signed y)
 {
     this->y = y;
 }
 
-signed CAMERA::get_y() const
+signed Camera::get_y() const
 {
     return this->y;
 }
 
-bool CAMERA::is_visible(const WalrusRPG::Utils::Rect &object) const
+bool Camera::is_visible(const WalrusRPG::Utils::Rect &object) const
 {
     if ((in_range(object.x, x, x + (signed) render_area_width) ||
          in_range(object.x + (signed) object.width - 1, x,

+ 8 - 8
src/render/Pixel.cpp

@@ -1,34 +1,34 @@
 #include "Pixel.h"
 
-#define PIXEL WalrusRPG::Graphics::Pixel
+using WalrusRPG::Graphics::Pixel;
 
-PIXEL::Pixel(std::uint16_t color) : value(color)
+Pixel::Pixel(std::uint16_t color) : value(color)
 {
 }
 
-PIXEL::Pixel(Pixel &pix) : value(pix.value)
+Pixel::Pixel(Pixel &pix) : value(pix.value)
 {
 }
 
-PIXEL::Pixel(std::uint8_t red, std::uint8_t green, std::uint8_t blue)
+Pixel::Pixel(std::uint8_t red, std::uint8_t green, std::uint8_t blue)
     : b(blue >> 3), g(green >> 2), r(red >> 3)
 {
 }
 
-PIXEL::operator std::uint16_t() const
+Pixel::operator std::uint16_t() const
 {
     return value;
 }
 
-PIXEL &PIXEL::operator=(unsigned value)
+Pixel &Pixel::operator=(unsigned value)
 {
     this->value = value;
     return *this;
 }
 
-bool PIXEL::operator==(const PIXEL& col)
+bool Pixel::operator==(const Pixel &col)
 {
-	return value == col.value;
+    return value == col.value;
 }
 
 #define CONST_COLOR(color, r, g, b) \

+ 2 - 2
src/render/Pixel.h

@@ -36,8 +36,8 @@ namespace WalrusRPG
             operator std::uint16_t() const;
 
             Pixel &operator=(unsigned value);
-           
-            bool operator==(const Pixel&col);
+
+            bool operator==(const Pixel &col);
         };
 
         extern const Pixel Black;

+ 5 - 5
src/render/SpriteRenderer.cpp

@@ -3,27 +3,27 @@
 #include "Graphics.h"
 #include "render/Pixel.h"
 
-#define SPRITERENDERER WalrusRPG::SpriteRenderer
+using WalrusRPG::SpriteRenderer;
 using namespace WalrusRPG;
 using namespace WalrusRPG::Utils;
 using WalrusRPG::Graphics::Pixel;
 
-SPRITERENDERER::SpriteRenderer(WalrusRPG::Graphics::Texture _tilesheet)
+SpriteRenderer::SpriteRenderer(WalrusRPG::Graphics::Texture _tilesheet)
     : tilesheet(_tilesheet)
 {
 }
 
-void SPRITERENDERER::add_sprite(unsigned id, WalrusRPG::Utils::Rect rect)
+void SpriteRenderer::add_sprite(unsigned id, WalrusRPG::Utils::Rect rect)
 {
     sprites[id] = rect;
 }
 
-void SPRITERENDERER::render(const unsigned id, const Rect &rect)
+void SpriteRenderer::render(const unsigned id, const Rect &rect)
 {
     Graphics::put_sprite(tilesheet, rect.x, rect.y, sprites[id]);
 }
 
-void SPRITERENDERER::render(const unsigned id, const Rect &rect, const Pixel &tint)
+void SpriteRenderer::render(const unsigned id, const Rect &rect, const Pixel &tint)
 {
     Graphics::put_sprite_tint(tilesheet, rect.x, rect.y, sprites[id], tint);
 }

+ 8 - 8
src/render/Text.cpp

@@ -4,18 +4,18 @@
 #include "sprites.h"
 #include "Graphics.h"
 
-#define TEXT WalrusRPG::Graphics::Text
+using namespace WalrusRPG::Graphics; /*Text*/
 using namespace WalrusRPG::Graphics;
 using namespace WalrusRPG::Utils;
 
 Texture tex_font((char *) font);
 
-void TEXT::print_char(char c, unsigned x, unsigned y)
+void Text::print_char(char c, unsigned x, unsigned y)
 {
     put_sprite(tex_font, x, y, Rect((c % 16) * 8, (c / 16) * 8, 8, 8));
 }
 
-void TEXT::print_string(const char *str, unsigned x, unsigned y)
+void Text::print_string(const char *str, unsigned x, unsigned y)
 {
     Rect rect;
     rect.width = 8;
@@ -30,12 +30,12 @@ void TEXT::print_string(const char *str, unsigned x, unsigned y)
     }
 }
 
-void TEXT::print_string(const std::string &str, unsigned x, unsigned y)
+void Text::print_string(const std::string &str, unsigned x, unsigned y)
 {
-    TEXT::print_string(str.c_str(), x, y);
+    Text::print_string(str.c_str(), x, y);
 }
 
-void TEXT::print_format(unsigned x, unsigned y, const char *format, ...)
+void Text::print_format(unsigned x, unsigned y, const char *format, ...)
 {
     char buffer[256] = "";
     va_list args;
@@ -44,7 +44,7 @@ void TEXT::print_format(unsigned x, unsigned y, const char *format, ...)
     print_string(buffer, x, y);
 }
 
-void TEXT::print_format(unsigned x, unsigned y, const std::string &format, ...)
+void Text::print_format(unsigned x, unsigned y, const std::string &format, ...)
 {
-    TEXT::print_format(x, y, format.c_str());
+    Text::print_format(x, y, format.c_str());
 }

+ 6 - 6
src/render/TileRenderer.cpp

@@ -1,17 +1,17 @@
 #include "TileRenderer.h"
 #include "Graphics.h"
 
-#define TILERENDERER WalrusRPG::TileRenderer
+using WalrusRPG::TileRenderer;
 using namespace WalrusRPG;
 using namespace WalrusRPG::Utils;
 
-TILERENDERER::TileRenderer(WalrusRPG::Graphics::Texture &_tilesheet, unsigned tile_width,
+TileRenderer::TileRenderer(WalrusRPG::Graphics::Texture &_tilesheet, unsigned tile_width,
                            unsigned tile_height)
     : tilesheet(_tilesheet), tile_width(tile_width), tile_height(tile_height)
 {
 }
 
-void TILERENDERER::render(const unsigned id, const Rect &rect)
+void TileRenderer::render(const unsigned id, const Rect &rect)
 {
     unsigned num_tiles_x = tilesheet.get_dimensions().width / tile_width;
     // unsigned num_tiles_y = sheet_height / tile_height;
@@ -20,17 +20,17 @@ void TILERENDERER::render(const unsigned id, const Rect &rect)
                               tile_height * (id / num_tiles_x), tile_width, tile_height));
 }
 
-int TILERENDERER::get_tile_width() const
+int TileRenderer::get_tile_width() const
 {
     return tile_width;
 }
-int TILERENDERER::get_tile_height() const
+int TileRenderer::get_tile_height() const
 {
     return tile_height;
 }
 
 
-TILERENDERER::~TileRenderer()
+TileRenderer::~TileRenderer()
 {
     // Nothing else than the current object is dynamically allocated, nothing should be
     // done here atm.