diff --git a/input_8hpp_source.html b/input_8hpp_source.html index b80b642d..385bc4bb 100644 --- a/input_8hpp_source.html +++ b/input_8hpp_source.html @@ -235,65 +235,64 @@
167 }
168 };
169
-
170
-
171 // Create the input queue.
-
172 static void create_event_queue(void) {
-
173 input_event_queue = al_create_event_queue();
-
174 if (!input_event_queue) throw engine_error("Failed to create input event queue!");
-
175
-
176 if (build_options.keyboard_enabled && config::flags::keyboard_installed)
-
177 al_register_event_source(input_event_queue, al_get_keyboard_event_source());
-
178 if (build_options.mouse_enabled && config::flags::mouse_installed)
-
179 al_register_event_source(input_event_queue, al_get_mouse_event_source());
-
180 if (build_options.joystick_enabled && config::flags::joystick_installed)
-
181 al_register_event_source(input_event_queue, al_get_joystick_event_source());
-
182 if (build_options.touch_enabled && config::flags::touch_installed)
-
183 al_register_event_source(input_event_queue, al_get_touch_input_event_source());
-
184 };
-
185
-
186 // Destroy the input queue.
-
187 static void destroy_event_queue(void) {
-
188 al_destroy_event_queue(input_event_queue);
-
189 };
-
190
-
191 // Record input events
-
192 static void record_event(const int64_t& time, const ALLEGRO_EVENT& event) {
-
193 input_event_file.write(reinterpret_cast<const char*>(time), sizeof(int64_t));
-
194 input_event_file.write(reinterpret_cast<const char*>(sizeof(event)), sizeof(std::size_t));
-
195 input_event_file.write(reinterpret_cast<const char*>(&event), sizeof(event));
-
196 };
-
197
-
198 // Check the input queue for events.
-
199 static void check_events(const std::size_t& scope) {
-
200 ALLEGRO_EVENT event;
-
201 while (al_get_next_event(input_event_queue, &event)) {
-
202 if (config::flags::input_enabled) {
-
203 // Record input if enabled.
-
204 if (config::flags::record_input) record_event(engine_time::check(), event);
-
205 // Run the handles
-
206 switch (scope) {
-
207 case 0:
-
208 run_handles<SCOPE_A>(event);
-
209 break;
-
210 case 1:
-
211 run_handles<SCOPE_B>(event);
-
212 break;
-
213 case 2:
-
214 run_handles<SCOPE_C>(event);
-
215 break;
-
216 }
-
217 }
-
218 }
-
219 };
-
220
-
221 inline static ALLEGRO_EVENT_QUEUE* input_event_queue; // Input event queue.
-
222 inline static std::ofstream input_event_file; // Event record file.
-
223 inline static bool initialized = false; // Restrict to one instance.
-
224};
-
225
-
226} // end namespace wte
-
227
-
228#endif
+
170 // Create the input queue.
+
171 static void create_event_queue(void) {
+
172 input_event_queue = al_create_event_queue();
+
173 if (!input_event_queue) throw engine_error("Failed to create input event queue!");
+
174
+
175 if (build_options.keyboard_enabled && config::flags::keyboard_installed)
+
176 al_register_event_source(input_event_queue, al_get_keyboard_event_source());
+
177 if (build_options.mouse_enabled && config::flags::mouse_installed)
+
178 al_register_event_source(input_event_queue, al_get_mouse_event_source());
+
179 if (build_options.joystick_enabled && config::flags::joystick_installed)
+
180 al_register_event_source(input_event_queue, al_get_joystick_event_source());
+
181 if (build_options.touch_enabled && config::flags::touch_installed)
+
182 al_register_event_source(input_event_queue, al_get_touch_input_event_source());
+
183 };
+
184
+
185 // Destroy the input queue.
+
186 static void destroy_event_queue(void) {
+
187 al_destroy_event_queue(input_event_queue);
+
188 };
+
189
+
190 // Record input events
+
191 static void record_event(const int64_t& time, const ALLEGRO_EVENT& event) {
+
192 input_event_file.write(reinterpret_cast<const char*>(time), sizeof(int64_t));
+
193 input_event_file.write(reinterpret_cast<const char*>(sizeof(event)), sizeof(std::size_t));
+
194 input_event_file.write(reinterpret_cast<const char*>(&event), sizeof(event));
+
195 };
+
196
+
197 // Check the input queue for events.
+
198 static void check_events(const std::size_t& scope) {
+
199 ALLEGRO_EVENT event;
+
200 while (al_get_next_event(input_event_queue, &event)) {
+
201 if (config::flags::input_enabled) {
+
202 // Record input if enabled.
+
203 if (config::flags::record_input) record_event(engine_time::check(), event);
+
204 // Run the handles
+
205 switch (scope) {
+
206 case 0:
+
207 run_handles<SCOPE_A>(event);
+
208 break;
+
209 case 1:
+
210 run_handles<SCOPE_B>(event);
+
211 break;
+
212 case 2:
+
213 run_handles<SCOPE_C>(event);
+
214 break;
+
215 }
+
216 }
+
217 }
+
218 };
+
219
+
220 inline static ALLEGRO_EVENT_QUEUE* input_event_queue; // Input event queue.
+
221 inline static std::ofstream input_event_file; // Event record file.
+
222 inline static bool initialized = false; // Restrict to one instance.
+
223};
+
224
+
225} // end namespace wte
+
226
+
227#endif
wte::engine_error
Throws an engine runtime error.
Definition: exceptions.hpp:47
wte::engine_time::check
static int64_t check(void)
Check the internal engine timer.
Definition: engine_time.hpp:37
wte::engine
The main engine class.
Definition: engine.hpp:57