]> git.tdb.fi Git - libs/gui.git/blob - source/input/cocoa/mouse.cpp
Basic OS X support
[libs/gui.git] / source / input / cocoa / mouse.cpp
1 #include <msp/graphics/window_private.h>
2 #include "mouse.h"
3
4 namespace Msp {
5 namespace Input {
6
7 void Mouse::input_event(const Graphics::Window::Event &event)
8 {
9         switch(event.cevent.type)
10         {
11         case LEFT_MOUSE_DOWN:
12         case LEFT_MOUSE_UP:
13         case RIGHT_MOUSE_DOWN:
14         case RIGHT_MOUSE_UP:
15         case OTHER_MOUSE_DOWN:
16         case OTHER_MOUSE_UP:
17                 set_button_state(event.cevent.button.button, event.cevent.button.state, true);
18                 break;
19         case MOUSE_MOVED:
20                 set_axis_value(0, event.cevent.motion.x*2.0/window.get_width()-1.0, true);
21                 set_axis_value(1, event.cevent.motion.y*2.0/window.get_height()-1.0, true);
22                 break;
23         default:;
24         }
25 }
26
27 } // namespace Input
28 } // namespace Msp