Debian Codegraph @

src/eventstream.cpp

raw symbols SCIP
1 /***************************************************************************
2 eventstream.cpp - description
3 -------------------
4 begin : Sat Sep 30 2000
5 copyright : (C) 2000 by Waldemar Baraldi
6 email : [email protected]
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 #include "eventstream.h"
19
20 EventStream::EventStream():Object(){
21 ul=dl=0;
22 npairs=0;
23 }
24
25 EventStream::~EventStream(){}
26
27 bool EventStream::put(SDLKey e){
28 int i;
29 for (i=0;i<npairs;i++){
30 if (emt[i].sdlKeySym==e){
31 events[ul]=emt[i].event;
32 ul=(ul + 1) % MaxEvents;
33 return true;
34 }
35 }
36 return false;
37 }
38
39 Event EventStream::get(){
40 if (dl!=ul){
41 int i=dl;
42 dl=(dl + 1) % MaxEvents;
43 return events[i];
44 }
45 return NONE;
46 }
47
48 void EventStream::clear(){
49 ul=dl;
50 }
51