summaryrefslogtreecommitdiffstats
path: root/engine/include/serial
diff options
context:
space:
mode:
authorancarola <raffaele.ancarola@epfl.ch>2019-01-19 13:07:37 +0100
committerancarola <raffaele.ancarola@epfl.ch>2019-01-19 13:07:37 +0100
commit3922c797671cdc23d9233ff76909489e45fd0006 (patch)
treed385754f00159b93a8966fb5080a51dc2d0eb4a0 /engine/include/serial
parentedas (diff)
downloadflatland-3922c797671cdc23d9233ff76909489e45fd0006.tar.gz
flatland-3922c797671cdc23d9233ff76909489e45fd0006.zip
Test two completed successfully
Diffstat (limited to 'engine/include/serial')
-rw-r--r--engine/include/serial/focusable.h36
-rw-r--r--engine/include/serial/keyfocusable.h24
2 files changed, 60 insertions, 0 deletions
diff --git a/engine/include/serial/focusable.h b/engine/include/serial/focusable.h
new file mode 100644
index 0000000..325f84b
--- /dev/null
+++ b/engine/include/serial/focusable.h
@@ -0,0 +1,36 @@
+#ifndef __FOCUSABLE_H__
+#define __FOCUSABLE_H__
+
+#include "types.h"
+
+class task_s;
+union SDL_Event;
+
+class Focusable
+{
+ bool focused;
+
+ task_s * event_trigger;
+
+protected:
+
+ /* Callback to event */
+ virtual void serial_cb(const SDL_Event*) = 0;
+
+ /* Event stack specification */
+ virtual Uint32 stackID() const = 0;
+
+public:
+
+ Focusable(bool focused = true);
+
+ virtual ~Focusable();
+
+ void setFocused(bool flag);
+
+ bool isFocused() const;
+
+ void serial_precall(void*);
+};
+
+#endif
diff --git a/engine/include/serial/keyfocusable.h b/engine/include/serial/keyfocusable.h
index e69de29..02b3361 100644
--- a/engine/include/serial/keyfocusable.h
+++ b/engine/include/serial/keyfocusable.h
@@ -0,0 +1,24 @@
+#ifndef __KEYFOCUSABLE_H__
+#define __KEYFOCUSABLE_H__
+
+#include "focusable.h"
+
+struct SDL_KeyboardEvent;
+
+class KeyFocusable : public Focusable
+{
+
+ virtual void serial_cb(const SDL_Event*) override;
+
+ virtual Uint32 stackID() const override;
+
+protected:
+
+ virtual void key_cb(const SDL_KeyboardEvent*) = 0;
+
+public:
+
+ using Focusable::Focusable;
+};
+
+#endif