Fixed compilation errors

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-06-02 01:39:30 +02:00
parent 7384ffc5b7
commit 04b3879946
Signed by: Florian Bouillon
GPG Key ID: 50BD648F12C86AB6
2 changed files with 17 additions and 18 deletions

View File

@ -1,5 +1,5 @@
/* eslint-disable max-classes-per-file */ /* eslint-disable max-classes-per-file */
import GameEngine, { Component2D, ComponentState, Scene, SoundManager } from 'GameEngine' import { Component2D, ComponentState, SoundManager } from 'GameEngine'
const globalState: { const globalState: {
playerTurn: 'X' | 'O' playerTurn: 'X' | 'O'
@ -17,7 +17,7 @@ const globalState: {
] ]
} }
class Item extends Component2D { export class Item extends Component2D {
public size = { public size = {
width: .9, width: .9,
@ -126,7 +126,7 @@ class Item extends Component2D {
} }
} }
class Line extends Component2D { export class Line extends Component2D {
public constructor(direction: number, index: number) { public constructor(direction: number, index: number) {
super() super()
@ -145,17 +145,3 @@ class Line extends Component2D {
} }
} }
const ge = new GameEngine('#test', {
caseCount: 3,
background: 'blue'
})
const scene = new Scene('TicTacToe')
scene.addComponent(
...Array.from(new Array(2)).map((_, index) => new Line(0, index)),
...Array.from(new Array(2)).map((_, index) => new Line(1, index)),
...Array.from(new Array(9)).map((_, index) => new Item(index)),
)
ge.start()
ge.setScene(scene)

View File

@ -1,9 +1,22 @@
import { Text, Link } from '@dzeio/components' import { Text, Link } from '@dzeio/components'
import GameEngine, { Scene } from 'GameEngine'
import React from 'react' import React from 'react'
import { Item, Line } from '../../games/tictactoe'
export default class Snake extends React.PureComponent { export default class Snake extends React.PureComponent {
public async componentDidMount() { public async componentDidMount() {
await import('./Game') const ge = new GameEngine('#test', {
caseCount: 3,
background: 'blue'
})
const scene = new Scene('TicTacToe')
scene.addComponent(
...Array.from(new Array(2)).map((_, index) => new Line(0, index)),
...Array.from(new Array(2)).map((_, index) => new Line(1, index)),
...Array.from(new Array(9)).map((_, index) => new Item(index)),
)
ge.start()
ge.setScene(scene)
} }
public render = () => ( public render = () => (
<> <>