EventArchiver< Archiver > Class Template Reference

Read or write event data. More...

List of all members.

Public Member Functions

template<>
void ArchiveKey (tRecordingBlock &archive, SDL_KeyboardEvent &orig)

Static Public Member Functions

static void ArchiveKey (Archiver &archive, SDL_KeyboardEvent &key)
static bool Archive (SDL_Event &event, REAL &time, bool &ret)


Detailed Description

template<class Archiver>
class EventArchiver< Archiver >

Read or write event data.

Definition at line 114 of file uInputQueue.cpp.


Member Function Documentation

template<class Archiver>
static void EventArchiver< Archiver >::ArchiveKey ( Archiver &  archive,
SDL_KeyboardEvent &  key 
) [inline, static]

Definition at line 118 of file uInputQueue.cpp.

00119     {
00120         archive.Archive(key.state).Archive(key.keysym.scancode).Archive(key.keysym.sym).Archive(key.keysym.mod).Archive(key.keysym.unicode);
00121     }

template<class Archiver>
static bool EventArchiver< Archiver >::Archive ( SDL_Event &  event,
REAL time,
bool &  ret 
) [inline, static]

Definition at line 124 of file uInputQueue.cpp.

References recordingSection.

Referenced by su_GetSDLInput().

00125     {
00126         // start archive block if archiving is active
00127         Archiver archive;
00128         if ( archive.Initialize( recordingSection ) )
00129         {
00130 #ifndef DEDICATED
00131             archive.Archive( ret );
00132             if ( !ret )
00133                 return false;
00134 
00135             // write or read data
00136             archive.Archive(time).Archive(event.type);
00137             switch ( event.type )
00138             {
00139             case SDL_ACTIVEEVENT:
00140             {
00141                 SDL_ActiveEvent & active = event.active;
00142 
00143                 archive.Archive(active.gain).Archive(active.state);
00144             }
00145             break;
00146             case SDL_KEYDOWN:
00147             case SDL_KEYUP:
00148             {
00149                 SDL_KeyboardEvent & key = event.key;
00150                 ArchiveKey( archive, key );
00151             }
00152             break;
00153             case SDL_MOUSEMOTION:
00154             {
00155                 SDL_MouseMotionEvent & motion = event.motion;
00156 
00157                 archive.Archive(motion.state).Archive(motion.x).Archive(motion.y).Archive(motion.xrel).Archive(motion.yrel);
00158             }
00159             break;
00160             case SDL_MOUSEBUTTONUP:
00161             case SDL_MOUSEBUTTONDOWN:
00162             {
00163                 SDL_MouseButtonEvent & button = event.button;
00164 
00165                 archive.Archive(button.button).Archive(button.state).Archive(button.x).Archive(button.y);
00166             }
00167             break;
00168             default:
00169                 // do nothing
00170                 break;
00171             }
00172 
00173 #endif  // DEDICATED
00174 
00175             return true;
00176         }
00177 
00178         return false;
00179     }

Here is the caller graph for this function:

template<>
void EventArchiver< tRecordingBlock >::ArchiveKey ( tRecordingBlock archive,
SDL_KeyboardEvent &  orig 
) [inline]

Definition at line 185 of file uInputQueue.cpp.

References tRecordingBlock::Archive(), and uInputScrambler::Scrambled().

00186 {
00187     SDL_KeyboardEvent key = orig;
00188     if ( uInputScrambler::Scrambled() )
00189     {
00190         switch( key.keysym.sym )
00191         {
00192         case SDLK_ESCAPE:
00193         case SDLK_SPACE:
00194         case SDLK_KP_ENTER:
00195         case SDLK_RETURN:
00196         case SDLK_UP:
00197         case SDLK_DOWN:
00198         case SDLK_LEFT:
00199         case SDLK_RIGHT:
00200         case SDLK_BACKSPACE:
00201         case SDLK_DELETE:
00202             break;
00203         default:
00204             key.keysym.mod = KMOD_NONE;
00205             key.keysym.sym = SDLK_x;
00206             key.keysym.scancode = 0;
00207             key.keysym.unicode = '*';
00208         }
00209     }
00210 
00211     archive.Archive(key.state).Archive(key.keysym.scancode).Archive(key.keysym.sym).Archive(key.keysym.mod).Archive(key.keysym.unicode);
00212 }

Here is the call graph for this function:


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:30:59 2008 for Armagetron Advanced by  doxygen 1.5.4