summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg-title.cc
diff options
context:
space:
mode:
authorEnne Walker <ennewalker@users.sourceforge.net>2010-04-19 20:00:06 -0400
committerEnne Walker <ennewalker@users.sourceforge.net>2010-04-25 19:33:13 -0400
commit8305dc11a61b732984b4bf2a2f8c8f48af84630e (patch)
tree9f605e327b60ab79111ae7c25bec938ed2261a0b /crawl-ref/source/tilereg-title.cc
parentedacdc0db313c0f5385631dfcf560f1fdf8e7c8a (diff)
downloadcrawl-ref-8305dc11a61b732984b4bf2a2f8c8f48af84630e.tar.gz
crawl-ref-8305dc11a61b732984b4bf2a2f8c8f48af84630e.zip
Split tilereg.h/cc into multiple files.
No functional changes, just rearranging and exposing functions where needed.
Diffstat (limited to 'crawl-ref/source/tilereg-title.cc')
-rw-r--r--crawl-ref/source/tilereg-title.cc89
1 files changed, 89 insertions, 0 deletions
diff --git a/crawl-ref/source/tilereg-title.cc b/crawl-ref/source/tilereg-title.cc
new file mode 100644
index 0000000000..0ae6a20cf8
--- /dev/null
+++ b/crawl-ref/source/tilereg-title.cc
@@ -0,0 +1,89 @@
+/*
+ * File: tilereg-title.cc
+ *
+ * Created by: ennewalker on Sat Jan 5 01:33:53 2008 UTC
+ */
+
+#include "AppHdr.h"
+
+#ifdef USE_TILE
+
+#include "tilereg-title.h"
+
+#include <SDL_opengl.h>
+
+#include "libutil.h"
+#include "macro.h"
+
+TitleRegion::TitleRegion(int width, int height, FontWrapper* font) :
+ m_buf(&m_img, GLW_QUADS), m_font_buf(font)
+{
+ sx = sy = 0;
+ dx = dy = 1;
+
+ if (!m_img.load_texture("title.png", MIPMAP_NONE))
+ return;
+
+ // Center
+ wx = width;
+ wy = height;
+ ox = (wx - m_img.orig_width()) / 2;
+ oy = (wy - m_img.orig_height()) / 2;
+
+ {
+ PTVert &v = m_buf.get_next();
+ v.pos_x = 0;
+ v.pos_y = 0;
+ v.tex_x = 0;
+ v.tex_y = 0;
+ }
+ {
+ PTVert &v = m_buf.get_next();
+ v.pos_x = 0;
+ v.pos_y = m_img.height();
+ v.tex_x = 0;
+ v.tex_y = 1;
+ }
+ {
+ PTVert &v = m_buf.get_next();
+ v.pos_x = m_img.width();
+ v.pos_y = m_img.height();
+ v.tex_x = 1;
+ v.tex_y = 1;
+ }
+ {
+ PTVert &v = m_buf.get_next();
+ v.pos_x = m_img.width();
+ v.pos_y = 0;
+ v.tex_x = 1;
+ v.tex_y = 0;
+ }
+}
+
+void TitleRegion::render()
+{
+#ifdef DEBUG_TILES_REDRAW
+ cprintf("rendering TitleRegion\n");
+#endif
+ set_transform();
+ m_buf.draw(NULL, NULL);
+ m_font_buf.draw(NULL, NULL);
+}
+
+void TitleRegion::run()
+{
+ mouse_control mc(MOUSE_MODE_MORE);
+ getchm();
+}
+
+/**
+ * We only want to show one line of message by default so clear the
+ * font buffer before adding the new message.
+ */
+void TitleRegion::update_message(std::string message)
+{
+ m_font_buf.clear();
+ m_font_buf.add(message, VColour::white, 0, 0);
+}
+
+#endif