forked from bymayanksingh/connect4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.py
More file actions
44 lines (30 loc) · 795 Bytes
/
events.py
File metadata and controls
44 lines (30 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
Holds the global event bus and the classes holding data for the event messages.
"""
from event_bus import EventBus
bus = EventBus()
class MouseHoverEvent:
"""
Fired when a user has moved their mouse to place a piece.
"""
def __init__(self, posx):
self.posx = posx
class MouseClickEvent:
"""
Fired when the user has clicked the mouse.
"""
def __init__(self, posx):
self.posx = posx
class GameOver:
"""
Fired when the game is over, including tie games.
"""
def __init__(self, was_tie=True, winner=None):
self.was_tie = was_tie
self.winner = winner
class PieceDropEvent:
"""
Fired when a game piece is dropped into an open slot.
"""
def __init__(self, side):
self.side = side