renderer module
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { Board } from "../modules/board.js";
|
||||
import { Renderer } from "../modules/renderer.js";
|
||||
|
||||
export const globalStore = defineStore("globalStore", {
|
||||
state: () => {
|
||||
@ -22,9 +23,6 @@ export const globalStore = defineStore("globalStore", {
|
||||
name: "Conway's Game of Life",
|
||||
description: "The most popular 2d automata",
|
||||
},
|
||||
canvasWidth: 0,
|
||||
canvasHeight: 0,
|
||||
refreshRate: 300,
|
||||
initial1dState: "onecell",
|
||||
drawingDirection: "y",
|
||||
board: new Board(),
|
||||
@ -39,17 +37,18 @@ export const globalStore = defineStore("globalStore", {
|
||||
activeSubMenu: "",
|
||||
loop: false,
|
||||
lastAction: "drawfromlast",
|
||||
renderer: new Renderer(),
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
setBoardWidth() {
|
||||
this.board.width = Math.floor(
|
||||
this.canvasWidth / this.board.cellProperties.size
|
||||
this.renderer.width / this.board.cellProperties.size
|
||||
);
|
||||
},
|
||||
setBoardHeight() {
|
||||
this.board.height = Math.floor(
|
||||
this.canvasHeight / this.board.cellProperties.size
|
||||
this.renderer.height / this.board.cellProperties.size
|
||||
);
|
||||
},
|
||||
setCellProperties(name, value) {
|
||||
|
||||
Reference in New Issue
Block a user