45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "Ball.hpp"
|
|
#include "render/GlutRender.hpp"
|
|
|
|
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);
|
|
void periodic_update();
|
|
|
|
void periodic_kb_handler(unsigned char key, int, int);
|
|
void periodic_kb_up_handler(unsigned char key, int, int);
|