1
// $Id: mouse_pointer.cpp 3059 2007-09-02 03:48:52Z grumbel $
3
// Pingus - A free Lemmings clone
4
// Copyright (C) 2000 Ingo Ruhnke <grumbel@gmx.de>
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 2
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#include "mouse_pointer.hpp"
25
MousePointer::MousePointer()
29
Controller::add_mouse_callback(MousePointer::move_signal, this);
33
MousePointer::get_x_pos() const
39
MousePointer::get_y_pos() const
45
MousePointer::set_pos(float new_x, float new_y)
47
SDL_WarpMouse(static_cast<int>(new_x), static_cast<int>(new_y));
51
MousePointer::update(float)
56
MousePointer::move_signal(const SDL_Event& event, void* userdata)
58
if (event.type != SDL_MOUSEMOTION)
61
MousePointer* mp = (MousePointer*)userdata;
62
mp->x_pos = (float)event.motion.x;
63
mp->y_pos = (float)event.motion.y;
66
} // namespace Pointers