diff options
author | jonas <himself@jonasgunz.de> | 2019-01-08 14:27:18 +0100 |
---|---|---|
committer | jonas <himself@jonasgunz.de> | 2019-01-08 14:27:18 +0100 |
commit | 75baef0cb96f65c500ac87cf71ebe5e05c0dae0d (patch) | |
tree | e0acfd121adc56578cbaf24d9cd7afeba2fc5150 /cInput.cpp | |
parent | 75a09cb6229b8c14ad180f05edf1b5402eed5299 (diff) | |
download | termgl-75baef0cb96f65c500ac87cf71ebe5e05c0dae0d.tar.gz |
cInputHandler now supplies cObject:onClick with click position relative to the objects origin
Diffstat (limited to 'cInput.cpp')
-rw-r--r-- | cInput.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -10,10 +10,6 @@ cInput::cInput() cfmakeraw (&raw); tcsetattr (STDIN_FILENO, TCSANOW, &raw); - // Switch to the alternate buffer screen - //write (STDOUT_FILENO, "\e[?47h", 6); - ///MOVED TO cRender - // Enable mouse tracking write (STDOUT_FILENO, "\e[?1000h", 8); } @@ -22,7 +18,6 @@ cInput::~cInput() { //revert changes to console write (STDOUT_FILENO, "\e[?1000l", 8); - //write (STDOUT_FILENO, "\e[?47l", 6); tcsetattr (STDIN_FILENO, TCSANOW, &original); } @@ -58,8 +53,8 @@ sInputEvent cInput::poll() if(buff[1] == 'M') //Mouse Event { ret.b = buff[2] - 32; - ret.x = buff[3] - 32; - ret.y = buff[4] - 32; + ret.x = buff[3] - 32 - 1; //Console sees origin at 1,1 + ret.y = buff[4] - 32 - 1; //Program at 0,0 ret.type = _EVENT_MOUSE; } else //e.g. Arrow Keys |