diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | LICENSE | 21 | ||||
-rw-r--r-- | Readme.md | 16 | ||||
-rw-r--r-- | src/cInput.cpp | 5 |
4 files changed, 34 insertions, 10 deletions
@@ -6,3 +6,5 @@ build/* doc/* version.h +tags +*.swp @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jonas Gunz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. @@ -8,14 +8,14 @@ TermGL is a library for displaying ASCII-graphics in a xterm compatible console List of current features: - - Automatic terminal size detection, online resizing - - Framerate target - - Simple drawing functions - - Object Handling: - - Movement - - Collision - - Input handling with object mapping - - 3D wiremeshes (mostly useless eye-candy) +- Automatic terminal size detection, online resizing +- Framerate target +- Simple drawing functions +- Object Handling: + - Movement + - Collision +- Input handling with object mapping +- 3D wiremeshes (mostly useless eye-candy) For more information on how to use, consult the documentation (`make doc`) and look at the example programs in `example/`. diff --git a/src/cInput.cpp b/src/cInput.cpp index 6384c91..32da417 100644 --- a/src/cInput.cpp +++ b/src/cInput.cpp @@ -23,8 +23,9 @@ cInput::~cInput() sInputEvent cInput::poll() { + const unsigned int buff_len = 5; sInputEvent ret; - unsigned char buff [6]; + unsigned char buff [buff_len]; //setup for select fd_set rfds; @@ -47,7 +48,7 @@ sInputEvent cInput::poll() } else if (buff[0] == '\x1B') //Escape sequence { - read (STDIN_FILENO, &buff, 5); + read (STDIN_FILENO, &buff, buff_len); if(buff[0] == '[') { if(buff[1] == 'M') //Mouse Event |