--- /dev/null
+#include <msp/core/application.h>
+#include <msp/graphics/simplewindow.h>
+#include <msp/input/keyboard.h>
+#include <msp/input/mouse.h>
+#include <msp/io/print.h>
+
+using namespace Msp;
+
+class Ev: public RegisteredApplication<Ev>
+{
+private:
+ Graphics::SimpleWindow window;
+ Input::Keyboard keyboard;
+ Input::Mouse mouse;
+
+public:
+ Ev(int, char **);
+
+private:
+ virtual void tick();
+
+ void key_press(unsigned);
+ void key_release(unsigned);
+ void button_press(unsigned);
+ void button_release(unsigned);
+ void axis_motion(unsigned, float, float);
+};
+
+Ev::Ev(int, char **):
+ window(200, 200),
+ keyboard(window),
+ mouse(window)
+{
+ window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Ev::exit), 0));
+ keyboard.signal_button_press.connect(sigc::mem_fun(this, &Ev::key_press));
+ keyboard.signal_button_release.connect(sigc::mem_fun(this, &Ev::key_release));
+ mouse.signal_button_press.connect(sigc::mem_fun(this, &Ev::button_press));
+ mouse.signal_button_release.connect(sigc::mem_fun(this, &Ev::button_release));
+ mouse.signal_axis_motion.connect(sigc::mem_fun(this, &Ev::axis_motion));
+ window.show();
+}
+
+void Ev::tick()
+{
+ window.tick();
+}
+
+void Ev::key_press(unsigned key)
+{
+ IO::print("key_press: %s\n", keyboard.get_button_name(key));
+}
+
+void Ev::key_release(unsigned key)
+{
+ IO::print("key_release: %s\n", keyboard.get_button_name(key));
+}
+
+void Ev::button_press(unsigned btn)
+{
+ IO::print("button_press: %s\n", mouse.get_button_name(btn));
+}
+
+void Ev::button_release(unsigned btn)
+{
+ IO::print("button_release: %s\n", mouse.get_button_name(btn));
+}
+
+void Ev::axis_motion(unsigned axis, float value, float rel)
+{
+ IO::print("axis_motion: %s %.3f %+.3f\n", mouse.get_axis_name(axis), value, rel);
+}