refactoring
+ wip input to server
This commit is contained in:
37
src/shared_js/class/Event.ts
Normal file
37
src/shared_js/class/Event.ts
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user