Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

events.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           events.h  -  description
00003                              -------------------
00004     begin                : Wed Oct 18 2000
00005     copyright            : (C) 2000 by Martin Bickel
00006     email                : bickel@asc-hq.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 
00019 /***************************************************************************
00020  *                                                                         *
00021  *   Event handling routines                                               *
00022  *                                                                         *
00023  ***************************************************************************/
00024 
00025 #ifndef events_h_included
00026 #define events_h_included
00027 
00028 #include <SDL.h>
00029 
00036 extern bool setEventRouting( bool queue, bool legacy );
00037 
00038 extern bool legacyEventSystemActive();
00039 
00040 extern int initializeEventHandling ( int (*fn)(void *) , void *data );
00041 
00042 extern SDL_mutex* eventHandlingMutex;
00043 
00044 extern void exit_asc( int returnresult );
00045 
00046 class ThreadExitException {};
00047 
00048 extern bool redrawScreen;
00049 
00050 /***************************************************************************
00051  *                                                                         *
00052  *   Mouse handling routines                                               *
00053  *                                                                         *
00054  ***************************************************************************/
00055 
00056 
00057 struct tmouserect {
00058        int x1, y1;
00059        int x2, y2;
00060        tmouserect operator+ ( const tmouserect& b ) const;
00061 //       tmouserect ( int _x1, int _y1, int _x2, int _y2 ) : x1(_x1), y1(_y1), x2(_x2), y2(_y2 ) {};
00062 //       tmouserect(){ x1=0;y1=0;x2=0;y2=0;};
00063 };
00064 
00065 extern void mousevisible( int an );
00066 extern int getmousestatus ();
00067 
00068 extern void setmouseposition ( int x, int y );
00069 
00070 extern void setnewmousepointer ( void* picture, int hotspotx, int hotspoty );
00071 
00072 extern int mouseinrect ( int x1, int y1, int x2, int y2 );
00073 
00074 
00075 extern int mouseinrect ( const tmouserect* rect );
00076 
00077 class tmousesettings {
00078   public:
00079    int x;
00080    int y;
00081    int x1;
00082    int y1;
00083    int altx;
00084    int alty;
00085    void *background;
00086    void *pictpointer;
00087    int xsize;
00088    int ysize;
00089    char taste;
00090    char status;
00091    tmouserect off;
00092    int hotspotx;
00093    int hotspoty;
00094    int backgroundsize;
00095    tmousesettings ( ) { x=0;y=0;x1=0;y1=0;altx=0;alty=0;
00096                         background=NULL;pictpointer=NULL;
00097                         xsize=0;ysize=0;taste=0;status=0;
00098                         hotspotx=0;hotspoty=0;backgroundsize=0;
00099                         off.x1=0;off.y1=0;off.x2=0;off.y2=0;
00100                       };
00101 };
00102 
00103 
00104 
00105 
00106 
00107 extern void mouseintproc2( void );
00108 extern volatile tmousesettings mouseparams;
00109 
00110 
00111 /***************************************************************************
00112  *                                                                         *
00113  *   Keyboard handling routines                                            *
00114  *                                                                         *
00115  ***************************************************************************/
00116 
00117 
00118  #ifdef _SDL_
00119   #include "sdl/keysymbols.h"
00120  #endif
00121 
00122  typedef int tkey;
00123 
00124  extern char  skeypress( tkey keynr);
00125  extern char *get_key(tkey keynr);
00126  extern tkey r_key(void);
00127  extern int  rp_key(void);
00128  extern int keypress(void);
00129  extern void wait(void);
00130  extern tkey char2key (int ch);
00131  extern void getkeysyms ( tkey* keysym, int* keyprnt );
00132 
00133  extern int exitprogram;
00134 
00135 
00136 /***************************************************************************
00137  *                                                                         *
00138  *   Timer routines                                                        *
00139  *                                                                         *
00140  ***************************************************************************/
00141 
00142 
00143     extern volatile int ticker;
00144     extern void ndelay(int time);
00145 
00146     extern void starttimer(void); //resets Timer
00147     extern char time_elapsed(int time); //check if time msecs are elapsed, since starttimer
00148     extern int  releasetimeslice( void );
00149 
00150     extern int getTicker();
00151 
00153     extern bool getQueuedEvent ( SDL_Event& event );
00154 
00156     extern bool peekEvent ( SDL_Event& event );
00157 
00159     extern void setMouseUpdateFlag( const bool* flag );
00160     
00161 
00162 #endif

Generated on Tue Jun 24 01:27:41 2008 for Advanced Strategic Command by  doxygen 1.4.2