Added more keys to control stuff, also very nice shaders
This commit is contained in:
parent
f9015fe05d
commit
070ec974da
2 changed files with 45 additions and 4 deletions
|
@ -139,6 +139,34 @@ namespace games {
|
|||
sim.balls.clear();
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_q]){
|
||||
music_speed = 0.5;
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_w]){
|
||||
music_speed = 1.0;
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_e]){
|
||||
music_speed = 2.0;
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_z]){
|
||||
sim_speed = 0.5;
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_x]){
|
||||
sim_speed = 1.0;
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_c]){
|
||||
sim_speed = 2.0;
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_p]){
|
||||
pause = !pause;
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_l]){
|
||||
lines.clear();
|
||||
sim.lines.clear();
|
||||
|
@ -151,11 +179,15 @@ namespace games {
|
|||
}
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_k]){
|
||||
if(input.keys_went_down[SDLK_s]){
|
||||
scene->update_shader_pipeline();
|
||||
game_renderer.load_shaders();
|
||||
}
|
||||
|
||||
if(input.keys_went_down[SDLK_a]){
|
||||
auto_pilot = !auto_pilot;
|
||||
}
|
||||
|
||||
for(char n = '0'; n <= '9'; ++n){
|
||||
if(input.keys_went_down[n]){
|
||||
scale = scales[n - '0'];
|
||||
|
@ -178,13 +210,14 @@ namespace games {
|
|||
|
||||
float dt2 = dt;
|
||||
if(dt2 > 1.0/70.0 && dt2 < 1.0/55.0) dt2 = 1.0/60.0;
|
||||
if(pause) dt2 = 0.0;
|
||||
|
||||
// simulation
|
||||
for(auto l : lines){
|
||||
l->update(dt2);
|
||||
}
|
||||
|
||||
for(auto x : sim.update(dt2)){
|
||||
for(auto x : sim.update(sim_speed * dt2)){
|
||||
x.line.information->play();
|
||||
}
|
||||
|
||||
|
@ -192,7 +225,7 @@ namespace games {
|
|||
sim.balls.emplace_back(n.x, n.y, 0, 0, balluid++);
|
||||
}
|
||||
|
||||
if(!chords.update(music_speed * dt2).empty()){
|
||||
if(!chords.update(music_speed * dt2).empty() && auto_pilot){
|
||||
std::cout << std::distance(chord_progression.cbegin(), chord_progression_it) + 1 << "th chord\n";
|
||||
scale = scales[*chord_progression_it];
|
||||
update_pitches(*this);
|
||||
|
|
|
@ -18,8 +18,12 @@
|
|||
/*
|
||||
Controls:
|
||||
1, .. 9, 0: change chord (will also be done automatically)
|
||||
q, w, e: music speed (= generation of balls)
|
||||
z, x, c: simulation speed
|
||||
a: toggle autopilot
|
||||
p: pause
|
||||
r: reload scales (aka chords)
|
||||
k: reload shaders
|
||||
s: reload shaders
|
||||
b: clear balls
|
||||
l: clear lines
|
||||
*/
|
||||
|
@ -42,6 +46,9 @@ namespace games {
|
|||
beat_type beat;
|
||||
beat_type chords;
|
||||
|
||||
float sim_speed{1.0};
|
||||
bool pause{false};
|
||||
|
||||
void add_line(cheap_line_type const & line);
|
||||
|
||||
// Sound part
|
||||
|
@ -74,6 +81,7 @@ namespace games {
|
|||
};
|
||||
|
||||
float music_speed{1.0};
|
||||
bool auto_pilot{false};
|
||||
|
||||
// Graphics
|
||||
GameRenderer game_renderer;
|
||||
|
|
Reference in a new issue