erebus
changeset 10:506e114b7ca2
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 24 May 2014 17:43:46 +0300 |
parents | d38e13d6063c |
children | 788f74d597a2 |
files | liberebus/src/erebus.cc src/main.cc |
diffstat | 2 files changed, 36 insertions(+), 9 deletions(-) [+] |
line diff
1.1 --- a/liberebus/src/erebus.cc Sat May 24 17:22:53 2014 +0300 1.2 +++ b/liberebus/src/erebus.cc Sat May 24 17:43:46 2014 +0300 1.3 @@ -57,6 +57,8 @@ 1.4 return 0; 1.5 } 1.6 1.7 + rnd_gen.seed(time(0)); 1.8 + 1.9 ctx->scn = 0; 1.10 ctx->cur_time = 0; 1.11 ctx->cur_rect = INVALID_RECT; 1.12 @@ -216,6 +218,13 @@ 1.13 if(ctx->keystate.size() <= key) ctx->keystate.resize(key < 256 ? 256 : key + 1); 1.14 1.15 ctx->keystate[key] = pressed; 1.16 + 1.17 + if(pressed) { 1.18 + switch(key) { 1.19 + case '=': 1.20 + case '-': 1.21 + } 1.22 + } 1.23 return false; 1.24 } 1.25 1.26 @@ -227,11 +236,29 @@ 1.27 ctx->bnstate[bn] = pressed; 1.28 ctx->mouse_pos[0] = x; 1.29 ctx->mouse_pos[1] = y; 1.30 + return false; 1.31 } 1.32 1.33 -bool erb_input_mouse_motion(struct erebus *ctx, int x, int y); 1.34 -bool erb_input_6dof_button(struct erebus *ctx, int bn, bool pressed); 1.35 -bool erb_input_6dof_motion(struct erebus *ctx, float x, float y, float z); 1.36 +bool erb_input_mouse_motion(struct erebus *ctx, int x, int y) 1.37 +{ 1.38 + if(!ctx) return false; 1.39 + 1.40 + ctx->mouse_pos[0] = x; 1.41 + ctx->mouse_pos[1] = y; 1.42 + return false; 1.43 +} 1.44 + 1.45 +bool erb_input_6dof_button(struct erebus *ctx, int bn, bool pressed) 1.46 +{ 1.47 + if(!ctx) return false; 1.48 + return false; 1.49 +} 1.50 + 1.51 +bool erb_input_6dof_motion(struct erebus *ctx, float x, float y, float z) 1.52 +{ 1.53 + if(!ctx) return false; 1.54 + return false; 1.55 +} 1.56 1.57 1.58 } // extern "C"
2.1 --- a/src/main.cc Sat May 24 17:22:53 2014 +0300 2.2 +++ b/src/main.cc Sat May 24 17:43:46 2014 +0300 2.3 @@ -178,42 +178,42 @@ 2.4 break; 2.5 } 2.6 2.7 - if(erb_input_keyboard(key, true)) { 2.8 + if(erb_input_keyboard(erb, key, true)) { 2.9 glutPostRedisplay(); 2.10 } 2.11 } 2.12 2.13 static void keyb_up(unsigned char key, int x, int y) 2.14 { 2.15 - if(erb_input_keyboard(key, false)) { 2.16 + if(erb_input_keyboard(erb, key, false)) { 2.17 glutPostRedisplay(); 2.18 } 2.19 } 2.20 2.21 static void mouse(int bn, int st, int x, int y) 2.22 { 2.23 - if(erb_input_mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y)) { 2.24 + if(erb_input_mouse_button(erb, bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y)) { 2.25 glutPostRedisplay(); 2.26 } 2.27 } 2.28 2.29 static void motion(int x, int y) 2.30 { 2.31 - if(erb_input_mouse_move(x, y)) { 2.32 + if(erb_input_mouse_move(erb, x, y)) { 2.33 glutPostRedisplay(); 2.34 } 2.35 } 2.36 2.37 static void sball_button(int bn, int state) 2.38 { 2.39 - if(erb_input_6dof_button(bn, state == GLUT_DOWN)) { 2.40 + if(erb_input_6dof_button(erb, bn, state == GLUT_DOWN)) { 2.41 glutPostRedisplay(); 2.42 } 2.43 } 2.44 2.45 static void sball_motion(int x, int y, int z) 2.46 { 2.47 - if(erb_input_6dof_motion(x / 65536.0, y / 65536.0, z / 65536.0)) { 2.48 + if(erb_input_6dof_motion(erb, x / 65536.0, y / 65536.0, z / 65536.0)) { 2.49 glutPostRedisplay(); 2.50 } 2.51 }