Ver código fonte

Cleaned the branch from the non-usable data.

Eiyeron Fulmincendii 9 anos atrás
pai
commit
51282fa05a
4 arquivos alterados com 9 adições e 18 exclusões
  1. 1 13
      src/map/StateMap.cpp
  2. 0 3
      src/map/StateMap.h
  3. 7 2
      src/textbox/Textbox.cpp
  4. 1 0
      src/textbox/Textbox.h

+ 1 - 13
src/map/StateMap.cpp

@@ -37,7 +37,7 @@ namespace
 StateMap::StateMap(int x, int y, Map &map)
     : started(false), camera(x, y), map(map), data("data/out.wrf"),
       tex_haeccity(data.get("t_haecci")), txt(tex_haeccity, data.get("f_haecci")),
-      tex_psyduck(data.get("psyduck")), box(txt)
+      box(txt)
 {
     box.set_text((
         char *) "Hello world! I am "
@@ -52,11 +52,6 @@ StateMap::StateMap(int x, int y, Map &map)
                 "How goes? I'm fine, headache-y but fine. Heh, it's normal, don't worry "
                 "for me.\n"
                 "I wonder... Heh, Let's see if it works correctly, shall we?");
-    WalrusRPG::Animation p;
-    p.looping = true;
-    p.stripe.push_back({0, 10});
-    p.stripe.push_back({1, 10});
-    anim.add_animation(0, p);
 }
 
 void StateMap::update(unsigned dt)
@@ -70,7 +65,6 @@ void StateMap::update(unsigned dt)
     else
         box.update(t);
     camera.update(t);
-    anim.update(t);
 }
 
 void StateMap::render(unsigned dt)
@@ -81,10 +75,4 @@ void StateMap::render(unsigned dt)
     if (!started)
         return;
     box.render(dt);
-    if (box.state == WalrusRPG::TextboxState::Updating)
-        Graphics::put_sprite(
-            tex_psyduck, 4, 4,
-            {32 * static_cast<signed>(anim.get_animation_frame(0)), 0, 32, 32});
-    else
-        Graphics::put_sprite(tex_psyduck, 4, 4, {0, 0, 32, 32});
 }

+ 0 - 3
src/map/StateMap.h

@@ -5,7 +5,6 @@
 #include "piaf/Archive.h"
 #include "Map.h"
 #include "render/Font.h"
-#include "render/Animator.h"
 #include "textbox/Textbox.h"
 
 namespace WalrusRPG
@@ -20,9 +19,7 @@ namespace WalrusRPG
             Map &map;
             WalrusRPG::PIAF::Archive data;
             WalrusRPG::Graphics::Texture tex_haeccity;
-            WalrusRPG::Graphics::Texture tex_psyduck;
             WalrusRPG::Graphics::Font txt;
-            WalrusRPG::Animator anim;
             WalrusRPG::Textbox box;
 
           public:

+ 7 - 2
src/textbox/Textbox.cpp

@@ -13,6 +13,7 @@ using WalrusRPG::Graphics::Font;
 using WalrusRPG::Graphics::CharacterParameters;
 using WalrusRPG::Graphics::Pixel;
 using WalrusRPG::Input::Key;
+using WalrusRPG::Utils::Rect;
 
 namespace
 {
@@ -33,11 +34,15 @@ namespace
     }
 }
 
-Textbox::Textbox(Font fnt)
+Textbox::Textbox(Rect dimensions, Font fnt)
     : fnt(fnt), buffer(0), buffer_index(-1), global_string_offset(0),
       current_color(0, 0, 0), letter_wait(0), letter_wait_cooldown(10),
-      dimensions(40, 4, 200, 32), state(Waiting)
+      dimensions(dimensions), state(Waiting)
+{
+}
 
+Textbox::Textbox(Font fnt)
+    : Textbox({4, 4, 220, 32}, fnt)
 {
 }
 

+ 1 - 0
src/textbox/Textbox.h

@@ -59,6 +59,7 @@ namespace WalrusRPG
       public:
         TextboxState state;
         Textbox(Graphics::Font fnt);
+        Textbox(Utils::Rect dimensions, Graphics::Font fnt);
         ~Textbox();
 
         void set_text(char *new_msg);