|
#ifndef _ATLASIMAGE_H_INCLUDED_
#define _ATLASIMAGE_H_INCLUDED_
class ImageGL;
class XParser;
class Rect;
const int verticesPerQuad = 4;
const int indicesPerQuad = 6;
const int compVertPos = 2;
const int compVertTex = 2;
class AtlasImage
{
public:
AtlasImage(ImageGL* pTexture) : m_pImageGL(pTexture) {}
AtlasImage(const AtlasImage& atlasImage);
AtlasImage() : m_pImageGL(NULL) {}
void Load(const XParser* pXParser);
void Render(int x, int y) const;
void Release();
int GetHeight() const
{
return m_height;
}
int GetWidth() const
{
return m_width;
}
int GetXOffset() const
{
return m_xOffset;
}
void SetXOffset(int xOffset)
{
m_xOffset = xOffset;
}
int GetYOffset() const
{
return m_yOffset;
}
void SetYOffset(int yOffset)
{
m_yOffset = yOffset;
}
const string& GetName() const
{
return *m_pName;
}
void SetName(const string& name)
{
m_pName = &name;
}
ImageGL* GetTexture() const
{
return m_pImageGL;
}
void SetImageGL(ImageGL* pImageGL)
{
m_pImageGL = pImageGL;
}
int GetTransHeight() const
{
return m_transHeight;
}
int GetTransWidth() const
{
return m_transWidth;
}
friend class TexturedQuad;
protected:
bool CreateVertices(float* vertices, int x, int y,
float scale, float rotation, int ancor) const;
const string* m_pName; // only for debug purposes
int m_x;
int m_y;
int m_width;
int m_height;
int m_transWidth;
int m_transHeight;
int m_xOffset;
int m_yOffset;
bool m_transparent;
float m_texCoords[verticesPerQuad*compVertTex];
ImageGL* m_pImageGL;
};
void CreateQuad(float* pTexCoords,
int x, int y, int width, int height,
int texWidth, int texHeight);
#endif // _ATLASIMAGE_H_INCLUDED_
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
After working in the software industry for many years, I've started my own
games company that specialises in strategy games for mobile platforms.