refactoring

+ wip input to server
This commit is contained in:
LuckyLaszlo
2022-11-17 11:12:32 +01:00
parent a873b23d0f
commit 6fb1470dbb
19 changed files with 197 additions and 131 deletions

View File

@@ -0,0 +1,37 @@
/* Server */
enum EventTypes {
gameUpdate = 1,
start,
pause,
resume
}
interface EventData {
type: EventTypes;
}
class EventGameUpdate implements EventData {
type: EventTypes = EventTypes.gameUpdate;
player1 = {y: 0};
player2 = {y: 0};
ball = {x: 0, y: 0, speed: 0};
}
/* Client */
enum InputEnum {
up = 1,
down
}
class EventInput {
input: InputEnum;
constructor(input: InputEnum = 0) {
this.input = input;
}
}
export {
EventTypes, EventData, EventGameUpdate,
InputEnum, EventInput
}