Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

input.cpp

Go to the documentation of this file.
00001 /*
00002         $Id: input.cpp,v 1.2 2001/03/15 12:14:46 mbn Exp $
00003 
00004         ------------------------------------------------------------------------
00005         ClanLib, the platform independent game SDK.
00006 
00007         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00008         version 2. See COPYING for details.
00009 
00010         For a total list of contributers see CREDITS.
00011 
00012         ------------------------------------------------------------------------
00013 */
00014 
00015 #include "Core/precomp.h"
00016 
00017 #include <API/Display/Input/input.h>
00018 #include <API/Display/Input/inputdevice.h>
00019 #include <API/Display/Input/inputbutton.h>
00020 #include <API/Display/Input/inputcursor.h>
00021 #include <API/Display/Input/keyboard.h>
00022 #include <API/Display/Input/mouse.h>
00023 
00024 std::vector<CL_Keyboard*> CL_Input::keyboards;
00025 std::vector<CL_InputDevice*> CL_Input::joysticks;
00026 std::vector<CL_InputDevice*> CL_Input::pointers;
00027 
00028 CL_Signal_v2<CL_InputDevice *, const CL_Key&> CL_Input::sig_button_press;
00029 CL_Signal_v2<CL_InputDevice *, const CL_Key&> CL_Input::sig_button_release;
00030 CL_Signal_v3<CL_InputDevice *, int, int> CL_Input::sig_mouse_move;
00031 
00032 bool CL_Keyboard::get_keycode(int button_no)
00033 {
00034         return CL_Input::keyboards[0]->get_button(button_no)->is_pressed();
00035 }
00036 
00037 int CL_Mouse::get_x()
00038 {
00039         return (int) CL_Input::pointers[0]->get_cursor(0)->get_x();
00040 }
00041 
00042 int CL_Mouse::get_y()
00043 {
00044         return (int) CL_Input::pointers[0]->get_cursor(0)->get_y();
00045 }
00046 
00047 bool CL_Mouse::left_pressed()
00048 {
00049         return CL_Input::pointers[0]->get_button(0)->is_pressed();
00050 }
00051 
00052 bool CL_Mouse::middle_pressed()
00053 {
00054         return CL_Input::pointers[0]->get_button(1)->is_pressed();
00055 }
00056 
00057 bool CL_Mouse::right_pressed()
00058 {
00059         return CL_Input::pointers[0]->get_button(2)->is_pressed();
00060 }

Generated at Wed Apr 4 19:54:00 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001