-
Notifications
You must be signed in to change notification settings - Fork 4
/
TileSet.h
56 lines (43 loc) · 1.31 KB
/
TileSet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __TILESET_H__
#define __TILESET_H__
#include "JMDefs.h"
class CTileset
{
// Member Functions
public:
CTileset() {};
CTileset( const char *szName, int cellWidth, int cellHeight ) { Load( szName, cellWidth, cellHeight ); };
bool IsBMP( const char *szName ) { return false; };
float TexelW() { return m_vTexels.x; };
float TexelH() { return m_vTexels.y; };
JResult Load( const char *szName, int cellwidth, int cellheight );
#ifdef RENDER_TILESET_POSTLOAD_NEEDED
uint32 Texture() { return m_Texture; };
#endif // postload needed
JIVector &GetTile( int dwIndex, JIVector &vTile )
{
/*if( index >= TILE_IDX_NUMTILES )
{
return TILE_IDX_INVALID;
}/**/
vTile.x = dwIndex % m_dwTilesPerRow;
vTile.y = dwIndex / m_dwTilesPerRow;
return( vTile );
}
void PreDrawTile();
void PostDrawTile();
void SetTileColor( JColor color );
bool DrawTile( int dwIndex, const JFVector &vPos, JVector &vSize, bool bIsTextured );
protected:
private:
// Member Variables
public:
protected:
#ifdef RENDER_TILESET_POSTLOAD_NEEDED
uint32 m_Texture; // created with glBindTexture();glTexImage2D(); use with glBindTexture();
#endif // postload needed
JFVector m_vTexels;
int m_dwTilesPerRow; // = Texture Width / Cell Width
private:
};
#endif // __TILESET_H__