]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
fixes n stuff
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 9 Mar 2017 01:44:00 +0000 (20:44 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 9 Mar 2017 01:44:00 +0000 (20:44 -0500)
include/components.hpp
include/texture.hpp
src/components.cpp

index 0fb8ec679a0fe2a0745a4e5c2900e8657dc63f86..2215a646af8383f415685c9f8c4083ded84caea9 100644 (file)
@@ -257,12 +257,12 @@ struct Solid : public Component {
 };
 
 struct SpriteData {
+       SpriteData(void) = default;
        
        SpriteData(std::string path, vec2 off):
                offset(off)     {
                        tex = Texture(path);
                        size = tex.getDim();
-                       offset = vec2(0.0f, 0.0f);
 
                        size_tex = vec2(1.0, 1.0);
                        
@@ -448,7 +448,7 @@ struct Limb {
        }
 
        float updateRate; /**< How often we will change each frame. */
-       float updateCurrent; /**< How much has been updated in the current frame. */
+       float updateCurrent = 0; /**< How much has been updated in the current frame. */
        unsigned int updateType; /**< What the updateRate will base it's updates off of.
                                                ie: Movement, attacking, jumping. */
        unsigned int limbID; /**< The id of the limb we will be updating */
index 25f73a5d3810318884cc3277c463b6d41ef047cd..0684cb792ad4b799ee7b53efc596d8df6c3b39c9 100644 (file)
@@ -28,7 +28,7 @@
 class Texture {
 protected:
        std::string name; /**< The name (path) of the loaded file. */
-       GLuint tex;       /**< The GLuint for the loaded texture. */
+       GLuint tex = 0;   /**< The GLuint for the loaded texture. */
        vec2 dim;         /**< The dimensions of the loaded texture. */
 
 public:
index f4ac01e3c015ea86b83934efdf26f3389074f2b8..a711f45d2c81be60d4a8db7ebc5b6acd6418590e 100644 (file)
@@ -126,7 +126,7 @@ void RenderSystem::render(void)
                else 
                        sz = sprite.getSpriteSize().x;
 
-               if(sprite.faceLeft) {
+               if (sprite.faceLeft) {
                        glm::mat4 scale = glm::scale(glm::mat4(1.0f), glm::vec3(-1.0f,1.0f,1.0f));
                        glm::mat4 translate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f - sz - pos.x * 2.0f, 0.0f, 0.0f));
 
@@ -348,7 +348,7 @@ std::vector<Frame> developFrame(XMLElement* xml)
 {
        Frame tmpf;
        std::vector<Frame> tmp;
-       SpriteData* sd; 
+       SpriteData sd;  
 
        unsigned int limb = 0;
 
@@ -377,13 +377,13 @@ std::vector<Frame> developFrame(XMLElement* xml)
                                        
                                        if (sxml->Attribute("size") != nullptr) {
                                                fsize = sxml->StrAttribute("size");
-                                               sd = new SpriteData(sxml->GetText(), foffset, fsize);
+                                               sd = SpriteData(sxml->GetText(), foffset, fsize);
                                        } else {
-                                               sd = new SpriteData(sxml->GetText(), foffset);
+                                               sd = SpriteData(sxml->GetText(), foffset);
                                        }
                                        if (sxml->QueryUnsignedAttribute("limb", &limb) == XML_NO_ERROR) 
-                                               sd->limb = limb;
-                                       tmpf.push_back(std::make_pair(*sd, fdraw));
+                                               sd.limb = limb;
+                                       tmpf.push_back(std::make_pair(sd, fdraw));
                                }
                                sxml = sxml->NextSiblingElement();
                        }