1 | #ifndef UTIL_H |
1 | #ifndef UTIL_H |
2 | #define UTIL_H |
2 | #define UTIL_H |
3 | |
3 | |
4 | #include <cmath> |
4 | #include <cmath> |
5 | #include <vector> |
5 | #include <vector> |
6 | #include <list> |
|
|
7 | #include <map> |
|
|
8 | #include "callback.h" |
|
|
9 | |
6 | |
10 | using namespace std; |
7 | using namespace std; |
11 | |
8 | |
12 | #include <GL/gl.h> |
9 | #include <GL/gl.h> |
13 | |
10 | |
… | |
… | |
170 | |
167 | |
171 | static void frame (); |
168 | static void frame (); |
172 | timer (); |
169 | timer (); |
173 | } timer; |
170 | } timer; |
174 | |
171 | |
|
|
172 | /* |
175 | #define MAX_EVENT_TYPES 10 |
173 | #define MAX_EVENT_TYPES 10 |
176 | enum event_type { TIMER_EV }; |
174 | enum event_type { TIMER_EV }; |
177 | struct event { |
175 | struct event { |
178 | event_type type; |
176 | event_type type; |
179 | }; |
177 | }; |
… | |
… | |
199 | list<event_cb> &l = event_lists[e.type]; |
197 | list<event_cb> &l = event_lists[e.type]; |
200 | for (list<event_cb>::iterator it = l.begin (); it != l.end (); it++) { |
198 | for (list<event_cb>::iterator it = l.begin (); it != l.end (); it++) { |
201 | (*it)(e); |
199 | (*it)(e); |
202 | } |
200 | } |
203 | }; |
201 | }; |
204 | /* |
|
|
205 | void check_events () { |
202 | void check_events () { |
206 | while (!events.empty ()) { |
203 | while (!events.empty ()) { |
207 | event &e = events.pop_front (); |
204 | event &e = events.pop_front (); |
208 | list<event_cb> &l = event_lists[e->name]; |
205 | list<event_cb> &l = event_lists[e->name]; |
209 | for (list<event_cb>::iterator it = l.begin (); it !+ l.end (); it++) { |
206 | for (list<event_cb>::iterator it = l.begin (); it !+ l.end (); it++) { |
210 | (*it)(e); |
207 | (*it)(e); |
211 | } |
208 | } |
212 | delete e; // ugly slow? hai hai..... 183G |
209 | delete e; // ugly slow? hai hai..... 183G |
213 | } |
210 | } |
214 | } |
211 | } |
215 | */ |
|
|
216 | }; |
212 | }; |
217 | |
213 | |
218 | extern skedjuhlar main_scheduler; |
214 | extern skedjuhlar main_scheduler; |
|
|
215 | */ |
219 | |
216 | |
220 | #endif |
217 | #endif |
221 | |
218 | |