mirror of
https://github.com/FMS-Cat/condition.git
synced 2025-08-12 00:43:56 +02:00
dev: add more keyboard controls
This commit is contained in:
11
src/main.ts
11
src/main.ts
@@ -1,6 +1,7 @@
|
|||||||
import { BufferRenderTarget } from './heck/BufferRenderTarget';
|
import { BufferRenderTarget } from './heck/BufferRenderTarget';
|
||||||
import { Component } from './heck/components/Component';
|
import { Component } from './heck/components/Component';
|
||||||
import { START_POSITION } from './config';
|
import { MUSIC_BPM, START_POSITION } from './config';
|
||||||
|
import { automaton } from './globals/automaton';
|
||||||
import { canvas } from './globals/canvas';
|
import { canvas } from './globals/canvas';
|
||||||
import { dog } from './scene';
|
import { dog } from './scene';
|
||||||
import { getCheckboxActive, getDivCanvasContainer } from './globals/dom';
|
import { getCheckboxActive, getDivCanvasContainer } from './globals/dom';
|
||||||
@@ -52,6 +53,14 @@ if ( process.env.DEV ) {
|
|||||||
dog.root.active = false;
|
dog.root.active = false;
|
||||||
music.isPlaying = false;
|
music.isPlaying = false;
|
||||||
checkboxActive.checked = false;
|
checkboxActive.checked = false;
|
||||||
|
} else if ( event.key === ' ' ) {
|
||||||
|
music.isPlaying = !music.isPlaying;
|
||||||
|
} else if ( event.key === 'ArrowLeft' ) {
|
||||||
|
music.time -= 480.0 / MUSIC_BPM;
|
||||||
|
automaton.reset();
|
||||||
|
} else if ( event.key === 'ArrowRight' ) {
|
||||||
|
music.time += 480.0 / MUSIC_BPM;
|
||||||
|
automaton.reset();
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user