mpri-graphics-project/periodic_updates.hpp

46 lines
1.1 KiB
C++
Raw Normal View History

2018-02-12 18:40:05 +01:00
#pragma once
#include "Ball.hpp"
2018-02-14 14:06:35 +01:00
#include "render/GlutRender.hpp"
2018-02-12 18:40:05 +01:00
2018-02-14 14:06:35 +01:00
struct KeyMappings {
static KeyMappings qwerty() {
return KeyMappings('w', 's', 'a', 'd', 'q', 'e');
}
static KeyMappings azerty() {
return KeyMappings('z', 's', 'q', 'd', 'a', 'e');
}
KeyMappings(
unsigned char mv_fwd,
unsigned char mv_bck,
unsigned char mv_left,
unsigned char mv_right,
unsigned char turn_left,
unsigned char turn_right)
:
mv_fwd(mv_fwd),
mv_bck(mv_bck),
mv_left(mv_left),
mv_right(mv_right),
turn_left(turn_left),
turn_right(turn_right)
{}
unsigned char
mv_fwd,
mv_bck,
mv_left,
mv_right,
turn_left,
turn_right;
};
void init_periodic_static(Ball* ball, GlutRender* render);
void set_key_mapping(const KeyMappings& mapping);
2018-02-12 18:40:05 +01:00
void periodic_update();
void periodic_kb_handler(unsigned char key, int, int);
2018-02-14 14:06:35 +01:00
void periodic_kb_up_handler(unsigned char key, int, int);