/src/app/app.h
https://bitbucket.org/vivkin/gam3b00bs/ · C Header · 59 lines · 28 code · 15 blank · 16 comment · 0 complexity · 3d9a7db9c2ad79d2cf37ae1406148cd9 MD5 · raw file
- #pragma once
- //
- // app.h - application interface: global initialization and teardown, etc.
- //
-
- #include "common.h"
-
- #define INPUT_KEYS_MAX 256
- #define INPUT_BUTTONS_MAX 5
-
- namespace app
- {
- struct timings
- {
- double T;
- float dt;
- };
-
- namespace input
- {
- // PRESSED - key or button is held down more than one tick
- enum state { UP = 0, DOWN, PRESSED };
-
- bool init();
- void term();
-
- // reset input relative
- bool tick();
-
- // get keyboard key state
- state get_key_state(uint16 key);
-
- // get mouse button state
- // 0 - left, 1 - right, 2 - middle, 3 - xbutton1, 4 - xbutton2
- state get_button_state(uint16 button);
-
- // get mouse wheel relative
- int16 get_wheel_rel();
-
- // get current cursor position
- void get_cursor_pos(int16 *x, int16 *y);
-
- // get relative to last query position
- void get_cursor_rel(int16 *xr, int16 *yr);
- }
-
- // initializes the C++ part of the program: renderer, sound, network
- // return false on error
- bool init();
- void term();
-
- // moves the frame time,
- // returns false if the program wants to terminate
- bool tick();
-
- // returns timings for the last tick
- struct timings time();
-
- }