X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fmouse.cpp;h=1b41e3654517c2adb12d02e5cb10821df70a5764;hb=917222bae696465f99024e0e15f73ba1058add44;hp=931b204f8a2655805f18509259ffc5c3781587ea;hpb=999ca92aa9ee10585c0b2094d84364159253982f;p=libs%2Fgui.git diff --git a/source/input/mouse.cpp b/source/input/mouse.cpp index 931b204..1b41e36 100644 --- a/source/input/mouse.cpp +++ b/source/input/mouse.cpp @@ -1,28 +1,18 @@ -/* $Id$ - -This file is part of libmspgbase -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include +#include #include "mouse.h" namespace Msp { namespace Input { Mouse::Mouse(Graphics::Window &w): - window(w), - axis_scale(0.01) + window(w) { - name="Mouse"; + name = "Mouse"; buttons.resize(3); axes.resize(2); - window.signal_button_press.connect(sigc::mem_fun(this, &Mouse::button_press)); - window.signal_button_release.connect(sigc::mem_fun(this, &Mouse::button_release)); - window.signal_pointer_motion.connect(sigc::mem_fun(this, &Mouse::pointer_motion)); + window.signal_input_event.connect(sigc::mem_fun(this, &Mouse::input_event)); } std::string Mouse::get_button_name(unsigned btn) const @@ -40,24 +30,21 @@ std::string Mouse::get_button_name(unsigned btn) const case 5: return "Wheel Down"; default: - return format("Button %d", btn); + return Device::get_button_name(btn); } } -void Mouse::button_press(int, int, unsigned btn, unsigned) -{ - set_button_state(btn, true, true); -} - -void Mouse::button_release(int, int, unsigned btn, unsigned) +std::string Mouse::get_axis_name(unsigned axis) const { - set_button_state(btn, false, true); -} - -void Mouse::pointer_motion(int x, int y) -{ - set_axis_value(0, x*axis_scale, true); - set_axis_value(1, y*axis_scale, true); + switch(axis) + { + case 0: + return "X axis"; + case 1: + return "Y axis"; + default: + return Device::get_axis_name(axis); + }; } } // namespace Input