1 /***************************************************************************
2                           eventstream.h  -  description
3                              -------------------
4     begin                : Sat Sep 30 2000
5     copyright            : (C) 2000 by Waldemar Baraldi
6     email                : baraldi@lacasilla.com.ar
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef EVENT_STREAM_H
19 #define EVENT_STREAM_H
20 
21 #include "object.h"
22 #include "SDL.h"
23 
24 enum Event {NONE, UP, DOWN, LEFT, RIGHT, HIT, GO, BACK, QUIT};
25 
26 class EventStream : public Object{
27 
28   public:
29 
30     static const int MaxEvents=16;
31 
32     EventStream();
33     ~EventStream();
34 
35     /** Retornar� true si el evento pertenece a este stream y
36         fue agregado, caso contrario retornar� false.*/
37     bool put(SDLKey e);
38 
39     /** Retorna el proximo evento en la cola, None si no hay ninguno.*/
40     Event get();
41 
42     void clear();
43 
44   protected:
45 
46     static const int MaxPairs=16;
47 
48     struct EMT{
49       SDLKey sdlKeySym;
50       Event event;
51     }emt[MaxPairs];
52 
53     int npairs;
54 
55     Event events[MaxEvents];
56     int ul, dl;
57 };
58 
59 #endif
60 
61 
62