]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Limb animation actually works
authorAndy <drumsetmonkey@gmail.com>
Thu, 19 Jan 2017 14:21:12 +0000 (09:21 -0500)
committerAndy <drumsetmonkey@gmail.com>
Thu, 19 Jan 2017 14:21:12 +0000 (09:21 -0500)
1  2 
include/components.hpp
main.cpp
src/components.cpp
src/world.cpp

Simple merge
diff --cc main.cpp
index f04581a4f8839d4323560029584c3435fde0c823,7e06d7de902eec841729767b1dfc4cdd61656ca6..e17b9105a097ce4804fa94d2031734ef3c7cb6fb
+++ b/main.cpp
@@@ -80,55 -89,14 +89,14 @@@ int main(int argc, char *argv[]
        //
  
        game::engine.init();
-       // used three times below
-       auto worldSys = game::engine.getSystem<WorldSystem>();
-       //
-       // initialize GLEW
-       //
  
- #ifndef __WIN32__
-       glewExperimental = GL_TRUE;
- #endif
-       auto glewError = glewInit();
-       if (glewError != GLEW_OK)
-               UserError(std::string("GLEW was not able to initialize! Error: ")
-                       + reinterpret_cast<const char *>(glewGetErrorString(glewError)));
-       //
-       // start the random number generator (TODO our own?)
-       //
+       // initialize the renderer
+       Render::init();
  
+       // start the random number generator
        randInit(millis());
  
-       //
-       // some basic OpenGL setup stuff
-       //
-       SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0);
-       // enable v-sync (TODO but 1000 fps?)
-       SDL_GL_SetSwapInterval(0);
-       // hide the cursor
-       SDL_ShowCursor(SDL_DISABLE);
-       // switch to pixel grid
-       glViewport(0, 0, game::SCREEN_WIDTH, game::SCREEN_HEIGHT);
-       glEnable(GL_BLEND);
-       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-       glClearColor(1, 1, 1, 1);
-       //
-       // initialize shaders
-       //
-       std::cout << "Initializing shaders!\n";
-       Render::initShaders();
-       Colors::init();
-       //
 -      // load saved data
 +      // load some saved data
-       //
        game::briceLoad();
        game::briceUpdate();
  
index 3096d39cf17f6718b78b855df45eaceaa6abdade,b758cb6af85af8d2559802e95990c0c38305cf74..b06bf84f14bc2f37f938859b42dd671d629076d0
@@@ -308,19 -306,16 +313,19 @@@ std::vector<Frame> developFrame(XMLElem
                                std::string sname = sxml->Name();
                                if (sname == "src") {
                                        foffset = (sxml->Attribute("offset") != nullptr) ? 
-                                               str2coord(sxml->Attribute("offset")) : vec2(0,0);
+                                               sxml->StrAttribute("offset") : vec2(0,0);
                                        fdraw = (sxml->Attribute("drawOffset") != nullptr) ?
-                                               str2coord(sxml->Attribute("drawOffset")) : vec2(0,0);
+                                               sxml->StrAttribute("drawOffset") : vec2(0,0);
 -
 +                                      
                                        if (sxml->Attribute("size") != nullptr) {
-                                               fsize = str2coord(sxml->Attribute("size"));
 -                                              fsize = sxml->Attribute("size");
 -                                              tmpf.push_back(std::make_pair(SpriteData(sxml->GetText(), foffset, fsize), fdraw));
++                                              fsize = sxml->StrAttribute("size");
 +                                              sd = new SpriteData(sxml->GetText(), foffset, fsize);
                                        } else {
 -                                              tmpf.push_back(std::make_pair(SpriteData(sxml->GetText(), foffset), fdraw));
 +                                              sd = new SpriteData(sxml->GetText(), foffset);
                                        }
 +                                      if (sxml->QueryUnsignedAttribute("limb", &limb) == XML_NO_ERROR) 
 +                                              sd->limb = limb;
 +                                      tmpf.push_back(std::make_pair(*sd, fdraw));
                                }
                                sxml = sxml->NextSiblingElement();
                        }
diff --cc src/world.cpp
Simple merge