123456789101112131415161718192021 |
- import { FiniteStateMachine } from "../libraries/FiniteStateMachine.js";
- import { LevelEditorState } from "./states/LevelEditorState.js";
- export class EditorView {
- constructor() {
- this.stateMachine = new FiniteStateMachine();
- this.stateMachine.registerState("leveleditor", new LevelEditorState(this))
- }
- async init() {
- this.stateMachine.setCurrentState("leveleditor");
- this.stateMachine.getCurrentState().enter();
- }
- draw(ctx, scaledCanvas) {
- this.stateMachine.getCurrentState().draw(ctx, scaledCanvas);
- }
- update(delta) {
- this.stateMachine.getCurrentState().update(delta);
- }
- }
|