File: mainloop.h

package info (click to toggle)
amoeba 1.1-13
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 732 kB
  • ctags: 971
  • sloc: cpp: 8,315; makefile: 178
file content (76 lines) | stat: -rw-r--r-- 1,186 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef _MAINLOOP_H
#define _MAINLOOP_H

#if WIN32
#include <windows.h>
#endif

#include <expat.h>

#include "main/event.h"
#include "main/factory.h"
#include "main/piprecalc.h"
#include "packer/file.h"
#include "opengl/glwindow.h"
#include "util/hashtable.h"

class Factory;
class MusicHandler;
class DirectSoundAudioDriver;

class MainLoop {
public:
	int next_evnum; 
	
	MainLoop(int argc, char **argv);
	~MainLoop();

	void parse(File *demoscript);
	
	void add_handler(Factory *handler_factory);
	void process_element(const char *el, const char **attr);

	float get_time();
	
	void run();
	void run(bool infloop);

	/* ick */
	Event **events;
	int num_events;
	
	Event *curr_event;
	
	Event *evlist[256];
	int num_play_events;
	
	XML_Parser p;

	friend class MusicHandler;
	friend class DirectSoundAudioDriver;
	
protected:
	void parse_commandline(int argc, char **argv, Hashtable *attr_hash);

	Factory **factories;	
	int num_factories;
	
	Hashtable *markers;
	MusicHandler *timer;

	int argc;
	char **argv;

	GLWindow *win;
	bool sound;

	PiPrecalc *precalc;

#ifdef WIN32
	LARGE_INTEGER tmstart, tmfreq;
#else
	struct timeval tmstart;
#endif
};

#endif /* defined(_MAINLOOP_H) */