diff options
Diffstat (limited to 'crawl-ref/source/viewgeom.h')
-rw-r--r-- | crawl-ref/source/viewgeom.h | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/crawl-ref/source/viewgeom.h b/crawl-ref/source/viewgeom.h index 6913849679..72e68ce3ec 100644 --- a/crawl-ref/source/viewgeom.h +++ b/crawl-ref/source/viewgeom.h @@ -1,19 +1,29 @@ #ifndef VIEWGEOM_H #define VIEWGEOM_H +template<typename T> class crawl_view_buffer { public: - crawl_view_buffer(); - ~crawl_view_buffer(); - void size(const coord_def &size); - operator screen_buffer_t * () { return (buffer); } + crawl_view_buffer() : buffer(NULL) {} + ~crawl_view_buffer() { delete [] buffer; } + + void size(const coord_def &sz) + { + delete [] buffer; + buffer = new T[sz.x * sz.y * 2]; + } + + operator T * () { return (buffer); } - void draw(); private: - screen_buffer_t *buffer; + T *buffer; }; +#ifdef USE_TILE +typedef unsigned int tile_buffer_t; +#endif + struct crawl_view_geometry { public: @@ -28,7 +38,12 @@ public: coord_def mlistp; // Left-top pos of the monster list. coord_def mlistsz; // Size of the monster list. - crawl_view_buffer vbuf; // Buffer for drawing the main game map. + crawl_view_buffer<screen_buffer_t> vbuf; + // Buffer for drawing the main game map. +#ifdef USE_TILE + crawl_view_buffer<tile_buffer_t> tbuf; + // Tiles buffer. +#endif coord_def vgrdc; // What grid pos is at the centre of the view // usually you.pos(). |