2021-02-14 23:58:32 +00:00
|
|
|
from multiprocessing import Queue
|
|
|
|
from typing import Any, Callable, List
|
|
|
|
|
|
|
|
# Main controller class. All implementations of controller support should inherit this.
|
|
|
|
class Controller():
|
|
|
|
callbacks: List[Callable] = []
|
|
|
|
player_to_q: List[Queue]
|
|
|
|
player_from_q: List[Queue]
|
|
|
|
|
|
|
|
def __init__(self, player_to_q: List[Queue], player_from_q: List[Queue]):
|
2021-03-22 00:33:14 +00:00
|
|
|
self.handler()
|
2021-02-14 23:58:32 +00:00
|
|
|
return
|
|
|
|
|
2021-04-05 21:13:53 +00:00
|
|
|
def _state_handler(self):
|
|
|
|
return
|
|
|
|
|
2021-02-14 23:58:32 +00:00
|
|
|
# Registers a function for the controller class to call to tell BAPSicle to do something.
|
|
|
|
def register_callback(self, callback: Callable):
|
|
|
|
self.callbacks.append(callback)
|
|
|
|
return
|
|
|
|
|
|
|
|
# Loop etc in here to process the data from your controller and call the callbacks.
|
2021-03-22 00:33:14 +00:00
|
|
|
def handler(self):
|
2021-02-14 23:58:32 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|