input handlers

This commit is contained in:
2025-05-18 16:34:33 +02:00
parent e0797d2cfc
commit 102c1f59dc
18 changed files with 595 additions and 376 deletions

View File

@@ -5,6 +5,7 @@ import { GdRoot } from './data/GdRoot';
import { SimCommand } from './sim/commands/SimCommand';
import { VisMain } from './vis/VisMain';
import { SplashComponent } from '../splash/splash.component';
import { SimCommandStartNextWave } from './sim/commands/SimCommandStartNextWave';
@Component({
selector: 'app-game',
@@ -27,7 +28,6 @@ export class GameComponent {
const gdRoot = await this.loadGdRoot();
this.simMain.setGdRoot(gdRoot);
this.visMain = new VisMain(this.simMain, SplashComponent.assetPreloader, this.wrapperRef.nativeElement, this.canvasRef.nativeElement);
window.addEventListener('resize', _ => this.visMain.onResized());
}
start() {
@@ -35,15 +35,24 @@ export class GameComponent {
}
stop() {
this.visMain.start();
this.visMain.stop();
}
step() {
this.simMain.step();
this.visMain.onRender();
}
rewind() {
//this.simMain.rewindToZero();
if (this.simMain.currentLevel)
this.simMain.currentLevel.currentStep = -1;
this.simMain.currentStep = -1;
}
startNextWave() {
this.simMain.addCommand(new SimCommandStartNextWave());
this.simMain.currentLevel!.paused = false;
}
fastForward() {