sdlterm/demo.cc
changeset 47 537d7c6b48a2
child 48 1f00e90fd72a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sdlterm/demo.cc	Sat Jan 05 00:40:27 2013 +0100
@@ -0,0 +1,56 @@
+#include "sdlterm.h"
+
+
+class Application
+{
+public:
+	Terminal term;
+	bool done;
+
+	Application() : term(), done(false) {};
+
+	void init();
+	void wait_and_process_event();
+};
+
+
+void Application::init()
+{
+	term.resize(800, 600);
+	term.select_font("font/DejaVuSansMono.ttf", "font/DejaVuSansMono-Bold.ttf", 12);
+	term.erase();
+	term.putch(5, 5, 'W');
+	term.commit();
+}
+
+
+void Application::wait_and_process_event()
+{
+	Event event;
+	term.get_next_event(event);
+
+	switch (event.type)
+	{
+		case EventType::quit:
+			done = true;
+			break;
+
+		default:
+			break;
+	}
+}
+
+
+int main(int argc, char *argv[])
+{
+	Application app;
+	app.init();
+
+    while (!app.done)
+    {
+    	app.wait_and_process_event();
+    }
+
+    return 0;
+}
+