};
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);
}
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 */
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:
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));
{
Frame tmpf;
std::vector<Frame> tmp;
- SpriteData* sd;
+ SpriteData sd;
unsigned int limb = 0;
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();
}