1 /* -*- Mode: C++; c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil -*- 2 * 3 * Quadra, an action puzzle game 4 * Copyright (C) 1998-2000 Ludus Design 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 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 GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 21 #ifndef _HEADER_INPUT 22 #define _HEADER_INPUT 23 24 #include "SDL.h" 25 26 #include "types.h" 27 28 #define PRESSED 1 29 #define RELEASED 2 30 31 #define MAXKEY 32 32 33 class Input { 34 public: 35 struct { 36 Byte button[4]; 37 int quel; 38 int wheel; 39 } mouse; 40 SDLKey key_sym_buf[MAXKEY]; 41 char key_buf[MAXKEY]; 42 unsigned int key_pending; 43 Byte keys[SDLK_LAST]; 44 bool pause; 45 bool allow_repeat; 46 SDL_keysym last_key; 47 static Input* New(bool dumb = false); 48 Input(); ~Input()49 virtual ~Input() { }; 50 void clear_key(); 51 virtual void check() = 0; 52 void allow_key_repeat(bool _allow); 53 }; 54 55 extern Input* input; 56 57 #endif 58