aboutsummaryrefslogtreecommitdiff
path: root/AmpelJonas/cInput.h
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2018-12-26 21:18:09 +0100
committerGravatar jonas <himself@jonasgunz.de> 2018-12-26 21:18:09 +0100
commit616951a353caf398908e6e6ce7dddf34a65513e5 (patch)
tree36a5ac46861b3f2c21777d383359f8463676e404 /AmpelJonas/cInput.h
parent905f5ad1f16d2ea719eb40c311609f8fad46fd95 (diff)
downloadtermgl-616951a353caf398908e6e6ce7dddf34a65513e5.tar.gz
Added cInput input handler class
cRender: +setConsoleCursor(bool) to disable console cursor main: Example workign with cInput cInput: Input handler class
Diffstat (limited to 'AmpelJonas/cInput.h')
-rw-r--r--AmpelJonas/cInput.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/AmpelJonas/cInput.h b/AmpelJonas/cInput.h
new file mode 100644
index 0000000..8e3481c
--- /dev/null
+++ b/AmpelJonas/cInput.h
@@ -0,0 +1,48 @@
+/*
+* cInput is responsible for Handling everything related to setting up and managing the console window
+* as well as decoding keyboard and mouse events.
+* Compatible with xterm compatible terminal emulators
+*/
+
+#ifndef CINPUT_H_
+#define CINPUT_H_
+
+#include <stdio.h>
+#include <unistd.h>
+#include <termios.h>
+#include <sys/select.h>
+
+#ifdef __linux__
+#elif _WIN32
+ #error "Platforn not supported"
+#else
+ #error "Platforn not supported"
+#endif
+
+#define _EVENT_NULL 0
+#define _EVENT_CHAR 1
+#define _EVENT_KEY 2
+#define _EVENT_MOUSE 3
+
+struct sInputEvent
+{
+ unsigned int type;
+ unsigned char c;
+ unsigned int b;
+ unsigned int x, y;
+};
+
+class cInput
+{
+public:
+ cInput();
+
+ ~cInput();
+
+ sInputEvent poll();
+
+private:
+ struct termios original, raw;
+};
+
+#endif /* end of include guard: */