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 
00043 class EventHandlingMutex {
00044    public:
00045       EventHandlingMutex();
00046       ~EventHandlingMutex();
00047 };
00048 
00049 
00050 extern void exit_asc( int returnresult );
00051 
00052 class ThreadExitException {};
00053 
00054 extern bool redrawScreen;
00055 
00056 /***************************************************************************
00057  *                                                                         *
00058  *   Mouse handling routines                                               *
00059  *                                                                         *
00060  ***************************************************************************/
00061 
00062 
00063 struct tmouserect {
00064        int x1, y1;
00065        int x2, y2;
00066        tmouserect operator+ ( const tmouserect& b ) const;
00067 //       tmouserect ( int _x1, int _y1, int _x2, int _y2 ) : x1(_x1), y1(_y1), x2(_x2), y2(_y2 ) {};
00068 //       tmouserect(){ x1=0;y1=0;x2=0;y2=0;};
00069 };
00070 
00071 extern void mousevisible( int an );
00072 extern int getmousestatus ();
00073 
00074 extern void setmouseposition ( int x, int y );
00075 
00076 extern void setnewmousepointer ( void* picture, int hotspotx, int hotspoty );
00077 
00078 extern int mouseinrect ( int x1, int y1, int x2, int y2 );
00079 
00080 
00081 extern int mouseinrect ( const tmouserect* rect );
00082 
00083 class tmousesettings {
00084   public:
00085    int x;
00086    int y;
00087    int x1;
00088    int y1;
00089    int altx;
00090    int alty;
00091    void *background;
00092    void *pictpointer;
00093    int xsize;
00094    int ysize;
00095    char taste;
00096    char status;
00097    tmouserect off;
00098    int hotspotx;
00099    int hotspoty;
00100    int backgroundsize;
00101    tmousesettings ( ) { x=0;y=0;x1=0;y1=0;altx=0;alty=0;
00102                         background=NULL;pictpointer=NULL;
00103                         xsize=0;ysize=0;taste=0;status=0;
00104                         hotspotx=0;hotspoty=0;backgroundsize=0;
00105                         off.x1=0;off.y1=0;off.x2=0;off.y2=0;
00106                       };
00107 };
00108 
00109 
00110 
00111 
00112 
00113 extern void mouseintproc2( void );
00114 extern volatile tmousesettings mouseparams;
00115 
00116 
00117 /***************************************************************************
00118  *                                                                         *
00119  *   Keyboard handling routines                                            *
00120  *                                                                         *
00121  ***************************************************************************/
00122 
00123 
00124   #include "sdl/keysymbols.h"
00125 
00126  typedef int tkey;
00127 
00128  extern char  skeypress( tkey keynr);
00129  extern char *get_key(tkey keynr);
00130  extern int keypress(void);
00131  extern void wait(void);
00132  extern tkey char2key (int ch);
00133  extern void getkeysyms ( tkey* keysym, int* keyprnt );
00134 
00135  extern int exitprogram;
00136 
00137 
00138  extern bool isKeyPressed(SDLKey key);
00139 
00140 /***************************************************************************
00141  *                                                                         *
00142  *   Timer routines                                                        *
00143  *                                                                         *
00144  ***************************************************************************/
00145 
00146 
00147     extern volatile int ticker;
00148     extern void ndelay(int time);
00149 
00150     extern void starttimer(void); //resets Timer
00151     extern char time_elapsed(int time); //check if time msecs are elapsed, since starttimer
00152     extern int  releasetimeslice( void );
00153 
00154     extern int getTicker();
00155 
00157     extern bool getQueuedEvent ( SDL_Event& event );
00158 
00160     extern bool peekEvent ( SDL_Event& event );
00161 
00163     extern void setMouseUpdateFlag( const bool* flag );
00164     
00165 
00166 #endif

Generated on Mon May 21 01:26:32 2012 for Advanced Strategic Command by  doxygen 1.5.1