diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-15 04:07:07 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-15 04:07:07 +0000 |
commit | af3cd3ff34ef5da884b2c673afe1321f0cf372e7 (patch) | |
tree | a574c2155f571f216f29c44b29e333ea320322a6 /crawl-ref/source/tiletex.h | |
parent | 71ed1a7fd6819916d79d194126c061ac1f087b11 (diff) | |
download | crawl-ref-af3cd3ff34ef5da884b2c673afe1321f0cf372e7.tar.gz crawl-ref-af3cd3ff34ef5da884b2c673afe1321f0cf372e7.zip |
Large tiles-related changes. Platform-specific rendering removed and replaced with SDL/OpenGL.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6550 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tiletex.h')
-rw-r--r-- | crawl-ref/source/tiletex.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/crawl-ref/source/tiletex.h b/crawl-ref/source/tiletex.h new file mode 100644 index 0000000000..9a8f78ccd7 --- /dev/null +++ b/crawl-ref/source/tiletex.h @@ -0,0 +1,60 @@ +/* + * File: tiletex.h + * Summary: PNG and texture loading functionality + * Written by: Enne Walker + */ + +#ifndef TILETEX_H +#define TILETEX_H + +enum TextureID +{ + TEX_DUNGEON, + TEX_DEFAULT, + TEX_DOLL, + TEX_TITLE, + TEX_MAX +}; + +class GenericTexture +{ +public: + GenericTexture(); + virtual ~GenericTexture(); + + enum MipMapOptions + { + MIPMAP_CREATE, + MIPMAP_NONE, + MIPMAP_MAX + }; + + // Arbitrary post-load texture processing + typedef bool(*tex_proc_func)(unsigned char *pixels, unsigned int w, + unsigned int h); + + bool load_texture(const char *filename, MipMapOptions mip_opt, + tex_proc_func proc = NULL); + bool load_texture(unsigned char *pixels, unsigned int w, unsigned int h, + MipMapOptions mip_opt); + void unload_texture(); + + unsigned int width() const { return m_width; } + unsigned int height() const { return m_height; } + void bind(); + +protected: + unsigned int m_handle; + unsigned int m_width; + unsigned int m_height; +}; + +class TilesTexture : public GenericTexture +{ +public: + void get_texcoord(int idx, float &x, float &y, float &wx, float &wy); + + void get_texcoord_doll(int part, int idx, int ymax, float &x, float &y, float &wx, float &wy, int &wx_pix, int &wy_pix, int &ox, int &oy); +}; + +#endif |