add hacky implementation of C1 speech/thought bubbles, unfinished
[openc2e.git] / Engine.h
blobefe804545119047caed839170f0c2c0ff32971a3
1 /*
2 * Engine.h
3 * openc2e
5 * Created by Alyssa Milburn on Tue Nov 28 2006.
6 * Copyright (c) 2006 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #ifndef _ENGINE_H
21 #define _ENGINE_H
23 #include "caosVar.h"
24 #include <map>
25 #include <boost/filesystem/path.hpp>
27 class Backend;
28 class AudioBackend;
29 struct SomeEvent;
31 class Engine {
32 protected:
33 unsigned int tickdata;
34 unsigned int ticktimes[10];
35 unsigned int ticktimeptr;
36 unsigned int lasttimestamp;
38 bool w_down, a_down, s_down, d_down;
39 unsigned char *palette;
41 bool cmdline_enable_sound;
42 bool cmdline_norun;
43 std::vector<std::string> cmdline_bootstrap;
45 std::string gamename;
47 std::map<std::string, boost::shared_ptr<Backend> > possible_backends;
48 std::map<std::string, boost::shared_ptr<class AudioBackend> > possible_audiobackends;
49 std::string preferred_backend, preferred_audiobackend;
51 public:
52 std::map<caosVar, caosVar, caosVarCompare> eame_variables; // non-serialised
54 boost::shared_ptr<Backend> backend;
55 boost::shared_ptr<class AudioBackend> audio;
56 std::string getBackendName() { return preferred_backend; }
57 std::string getAudioBackendName() { return preferred_audiobackend; }
59 unsigned char *getPalette() { return palette; }
61 std::string getGameName() { return gamename; }
63 bool done;
64 bool dorendering, fastticks, refreshdisplay;
65 unsigned int version;
66 bool bmprenderer;
68 Engine();
69 ~Engine();
70 void setBackend(boost::shared_ptr<Backend> b);
71 std::string executeNetwork(std::string in);
72 bool needsUpdate();
73 unsigned int msUntilTick();
74 void update();
75 bool tick();
76 void handleKeyboardScrolling();
77 void processEvents();
78 void handleResizedWindow(SomeEvent &event);
79 void handleMouseMove(SomeEvent &event);
80 void handleMouseButton(SomeEvent &event);
81 void handleKeyDown(SomeEvent &event);
82 void handleSpecialKeyDown(SomeEvent &event);
83 void handleSpecialKeyUp(SomeEvent &event);
85 void addPossibleBackend(std::string, boost::shared_ptr<Backend>);
86 void addPossibleAudioBackend(std::string, boost::shared_ptr<AudioBackend>);
88 bool parseCommandLine(int argc, char *argv[]);
89 bool initialSetup();
90 void shutdown();
92 bool noRun() { return cmdline_norun; }
94 boost::filesystem::path homeDirectory();
95 boost::filesystem::path storageDirectory();
98 extern Engine engine;
99 #endif
100 /* vim: set noet: */