diff options
| author | pryazha <pryadeiniv@mail.ru> | 2025-10-12 15:25:23 +0500 |
|---|---|---|
| committer | pryazha <pryadeiniv@mail.ru> | 2025-10-12 15:25:23 +0500 |
| commit | 818f818f583881156eb279c71b1359bf2c4f3580 (patch) | |
| tree | 874e8d2fdc5334bc70925aa87923791f7662ddb8 /input.c | |
| parent | 3cf987880e384140bf996c37f820ddeea38bc60e (diff) | |
change identation, maybe will change back, add own gl functions loading, and glx example
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -0,0 +1,36 @@ +#include "input.h" + +struct input +init_input(void) +{ + struct input input = {0}; + input.mouse.first = 1; + return input; +} + +void +update_input(struct input *input) +{ + input->mouse.last = input->mouse.pos; + input->mouse.offset = (v2){0.0f, 0.0f}; + input->mouse.left.last = input->mouse.left.now; + input->mouse.right.last = input->mouse.right.now; + input->right.last = input->right.now; + input->left.last = input->left.now; + input->up.last = input->up.now; + input->down.last = input->down.now; + input->forward.last = input->forward.now; + input->backward.last = input->backward.now; +} + +i32 +key_down(struct key key) +{ + return key.now; +} + +i32 +key_first(struct key key) +{ + return (!key.last && key.now); +} |
