# HG changeset patch # User John Tsiombikas # Date 1400942626 -10800 # Node ID 506e114b7ca295a04c05af5a777bf974e3c81092 # Parent d38e13d6063c726744c9d51ef6bc5d636320c468 foo diff -r d38e13d6063c -r 506e114b7ca2 liberebus/src/erebus.cc --- a/liberebus/src/erebus.cc Sat May 24 17:22:53 2014 +0300 +++ b/liberebus/src/erebus.cc Sat May 24 17:43:46 2014 +0300 @@ -57,6 +57,8 @@ return 0; } + rnd_gen.seed(time(0)); + ctx->scn = 0; ctx->cur_time = 0; ctx->cur_rect = INVALID_RECT; @@ -216,6 +218,13 @@ if(ctx->keystate.size() <= key) ctx->keystate.resize(key < 256 ? 256 : key + 1); ctx->keystate[key] = pressed; + + if(pressed) { + switch(key) { + case '=': + case '-': + } + } return false; } @@ -227,11 +236,29 @@ ctx->bnstate[bn] = pressed; ctx->mouse_pos[0] = x; ctx->mouse_pos[1] = y; + return false; } -bool erb_input_mouse_motion(struct erebus *ctx, int x, int y); -bool erb_input_6dof_button(struct erebus *ctx, int bn, bool pressed); -bool erb_input_6dof_motion(struct erebus *ctx, float x, float y, float z); +bool erb_input_mouse_motion(struct erebus *ctx, int x, int y) +{ + if(!ctx) return false; + + ctx->mouse_pos[0] = x; + ctx->mouse_pos[1] = y; + return false; +} + +bool erb_input_6dof_button(struct erebus *ctx, int bn, bool pressed) +{ + if(!ctx) return false; + return false; +} + +bool erb_input_6dof_motion(struct erebus *ctx, float x, float y, float z) +{ + if(!ctx) return false; + return false; +} } // extern "C" diff -r d38e13d6063c -r 506e114b7ca2 src/main.cc --- a/src/main.cc Sat May 24 17:22:53 2014 +0300 +++ b/src/main.cc Sat May 24 17:43:46 2014 +0300 @@ -178,42 +178,42 @@ break; } - if(erb_input_keyboard(key, true)) { + if(erb_input_keyboard(erb, key, true)) { glutPostRedisplay(); } } static void keyb_up(unsigned char key, int x, int y) { - if(erb_input_keyboard(key, false)) { + if(erb_input_keyboard(erb, key, false)) { glutPostRedisplay(); } } static void mouse(int bn, int st, int x, int y) { - if(erb_input_mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y)) { + if(erb_input_mouse_button(erb, bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y)) { glutPostRedisplay(); } } static void motion(int x, int y) { - if(erb_input_mouse_move(x, y)) { + if(erb_input_mouse_move(erb, x, y)) { glutPostRedisplay(); } } static void sball_button(int bn, int state) { - if(erb_input_6dof_button(bn, state == GLUT_DOWN)) { + if(erb_input_6dof_button(erb, bn, state == GLUT_DOWN)) { glutPostRedisplay(); } } static void sball_motion(int x, int y, int z) { - if(erb_input_6dof_motion(x / 65536.0, y / 65536.0, z / 65536.0)) { + if(erb_input_6dof_motion(erb, x / 65536.0, y / 65536.0, z / 65536.0)) { glutPostRedisplay(); } }