]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Merge branch 'master' of https://github.com/tcsullivan/gamedev
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 22 Dec 2016 02:40:05 +0000 (21:40 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 22 Dec 2016 02:40:05 +0000 (21:40 -0500)
1  2 
include/common.hpp
include/components.hpp
include/engine.hpp
src/components.cpp
src/ui.cpp
src/ui_menu.cpp
src/world.cpp

Simple merge
Simple merge
index 6e0c5a0d6fa4a52cb2060960a61c08db4a02fefc,d4028d89b66303e71a368e7f464335ba3155b727..52569e7c7517e7898fe15cf869113d4d48c1ae2e
@@@ -38,11 -71,29 +71,24 @@@ public
  
  
  namespace game {
+       /**
+        * Handles all game events.
+        */
        extern entityx::EventManager events;
+       /**
+        * Handles entity data.
+        */
      extern entityx::EntityManager entities;
  
 -      /**
 -       * Handles sprite loading, for the sprite system.
 -       */
 -      extern SpriteLoader sprite_l;
 -
+       /**
+        * An instance of the main game engine.
+        */
      extern Engine engine;
  
+       /**
+        * Ends the game.
+        */
      inline void endGame(void) {
          events.emit<GameEndEvent>();
      }
index 8a66f80ed90845b0911ffc38025f80096c5d7064,e85883e2e8bad41c9722857bdbddf4b0874309b2..f95f46f7b6abd81209dd805174c72433c2b12cda
@@@ -90,12 -98,9 +98,8 @@@ void RenderSystem::update(entityx::Enti
                                                                1.0, 1.0,
                                                                1.0, 0.0};
  
-               if (entity.has_component<Animate>()) {
-                       sprite.sprite = entity.component<Animate>().get()->nextFrame();
-               }
                for (auto &S : sprite.sprite) {
 -                      float width = HLINES(S.first.size.x);
 -                      float height = HLINES(S.first.size.y);
 +                      const auto& size = S.first.tex.getDim() * game::HLINE;
  
                        vec2 loc = vec2(pos.x + S.first.offset.x, pos.y + S.first.offset.y);
  
@@@ -267,10 -275,9 +274,8 @@@ std::vector<Frame> developFrame(XMLElem
                        auto sxml = framexml->FirstChildElement();
                        while (sxml) {
                                std::string sname = sxml->Name();
--                              if (sname == "src") {
++                              if (sname == "src")
                                        tmpf.push_back(std::make_pair(SpriteData(sxml->GetText(), vec2(0,0)), vec2(0,0)));
-                                       //std::cout << tmpf.back().first.pic << std::endl;
--                              }
                                sxml = sxml->NextSiblingElement();
                        }
                        tmp.push_back(tmpf);
diff --cc src/ui.cpp
index e87c74af5d241830b6984ea723cde624f8d71d03,0b22e34bd6860b8bdabc8b2977d4be55735a674e..a154d7eac964175d7287e18481d3f19b2d4ae692
@@@ -1093,19 -1027,25 +1023,22 @@@ namespace ui 
                        return;
                }
  
 -              auto ftc = Color(0, 0, 0, fadeIntensity);
 -              if (fadeWhite)
 -                      ftc.red = ftc.green = ftc.blue = 255;
 -
 -              auto fadeTex = Texture::genColor(ftc);
 +              ColorTex fadeTex (fadeWhite ? Color(255, 255, 255, fadeIntensity) :
 +                  Color(0, 0, 0, fadeIntensity));
  
+               static const GLfloat tex[] = {
+                       0.0, 0.0,
+                       1.0, 0.0,
+                       0.0, 1.0,
+                       1.0, 1.0
+               };
  
-         GLfloat tex[] = {0.0, 0.0,
-                         1.0, 0.0,
-                         0.0, 1.0,
-                         1.0, 1.0};
-         GLfloat backdrop[] = {offset.x - SCREEN_WIDTH / 2 - 1, offset.y - SCREEN_HEIGHT / 2, -7.9,
-                               offset.x + SCREEN_WIDTH / 2, offset.y - SCREEN_HEIGHT / 2,       -7.9,
-                               offset.x - SCREEN_WIDTH / 2 - 1, offset.y + SCREEN_HEIGHT / 2, -7.9,
-                               offset.x + SCREEN_WIDTH / 2, offset.y + SCREEN_HEIGHT / 2,       -7.9};
+         GLfloat backdrop[] = {
+                       offset.x - SCREEN_WIDTH2 - 1, offset.y - SCREEN_HEIGHT2, -7.9,
+                       offset.x + SCREEN_WIDTH2, offset.y - SCREEN_HEIGHT2, -7.9,
+                       offset.x - SCREEN_WIDTH2 - 1, offset.y + SCREEN_HEIGHT2, -7.9,
+                       offset.x + SCREEN_WIDTH2, offset.y + SCREEN_HEIGHT2, -7.9
+               };
  
                setFontZ(-8.2);
          glUniform1i(Render::textShader.uniform[WU_texture], 0);
diff --cc src/ui_menu.cpp
Simple merge
diff --cc src/world.cpp
index 059b6c706ac930ec10f69154461f29bc1da5baf9,df005e46858c159ec4eda219a6da0929c4e324c7..c458ab06a6cd74e48626438e4bf0a604afae8ff9
@@@ -1042,20 -1043,24 +1044,23 @@@ void WorldSystem::render(void
                // the ending pixel of the world
                static const float e = static_cast<float>(SCREEN_WIDTH) / 2.0f;
  
 -              static const auto blackTex = Texture::genColor(Color(0, 0, 0));
                static const float sheight = static_cast<float>(SCREEN_HEIGHT);
+                       
  
                if (offset.x + world.startX > s) {
 -                      glBindTexture(GL_TEXTURE_2D, blackTex);
 +                      Colors::black.use();
                        glUniform1f(Render::worldShader.uniform[WU_light_impact], 0.0f);
  
+                       auto off = offset.y - static_cast<float>(SCREEN_HEIGHT) / 2.0f;
                        GLfloat blackBarLeft[] = {
-                               s,            0.0f,    -3.5f, 0.0f, 0.0f,
-                               world.startX, 0.0f,    -3.5f, 1.0f, 0.0f,
-                               world.startX, sheight, -3.5f, 1.0f, 1.0f,
+                               s,            0.0f    + off,    -3.5f, 0.0f, 0.0f,
+                               world.startX, 0.0f    + off,    -3.5f, 1.0f, 0.0f,
+                               world.startX, sheight + off, -3.5f, 1.0f, 1.0f,
  
-                               world.startX, sheight, -3.5f, 1.0f, 1.0f,
-                       s,            sheight, -3.5f, 0.0f, 1.0f,
-                               s,            0.0f,    -3.5f, 0.0f, 0.0f
+                               world.startX, sheight + off, -3.5f, 1.0f, 1.0f,
+                       s,            sheight + off, -3.5f, 0.0f, 1.0f,
+                               s,            0.0f        + off,    -3.5f, 0.0f, 0.0f
                        };
  
                glVertexAttribPointer(Render::worldShader.coord, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 5, &blackBarLeft[0]);
                }
  
                if (offset.x - world.startX < e) {
 -                      glBindTexture(GL_TEXTURE_2D, blackTex);
 +                      Colors::black.use();
                        glUniform1f(Render::worldShader.uniform[WU_light_impact], 0.0f);
+               
+                       auto off = offset.y - static_cast<float>(SCREEN_HEIGHT) / 2.0f;
  
                        GLfloat blackBarRight[] = {
-                               -(world.startX), 0.0f,    -3.5f, 0.0f, 0.0f,
-                               e,               0.0f,    -3.5f, 1.0f, 0.0f,
-                               e,               sheight, -3.5f, 1.0f, 1.0f,
+                               -(world.startX), 0.0f    + off,    -3.5f, 0.0f, 0.0f,
+                               e,               0.0f    + off,    -3.5f, 1.0f, 0.0f,
+                               e,               sheight + off, -3.5f, 1.0f, 1.0f,
  
-                               e,               sheight, -3.5f, 1.0f, 1.0f,
-                       -(world.startX), sheight, -3.5f, 0.0f, 1.0f,
-                               -(world.startX), 0.0f,    -3.5f, 0.0f, 0.0f
+                               e,               sheight + off, -3.5f, 1.0f, 1.0f,
+                       -(world.startX), sheight + off, -3.5f, 0.0f, 1.0f,
+                               -(world.startX), 0.0f    + off,    -3.5f, 0.0f, 0.0f
                        };
  
                glVertexAttribPointer(Render::worldShader.coord, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 5, &blackBarRight[0]);