Ejemplo n.º 1
0
    def __init__(self, config):

        # Dictionary to hold active clients.
        self.clients = {}

        # Set up logging.
        # TODO: Use config parameters here.
        self.log = Logger()

        # Logging target.
        log_observer = textFileLogObserver(sys.stdout)
        # Filter out levels to the specified severity.
        logging_level_predicate = [LogLevelFilterPredicate(LogLevel.debug)]
        # Set up an Observer to actually perform the filtering.
        log_filter = FilteringLogObserver(textFileLogObserver(sys.stdout),
                                          predicates=logging_level_predicate)
        # And register global logging for the filtering observer.
        globalLogBeginner.beginLoggingTo([log_filter])

        # Passed-in game configuration.
        self.configuration = config

        # Game data.
        self.game = game.GameData()

        # Init main game loop.
        self.game_loop = task.LoopingCall(self.GameLoop)
        self.game_loop.start(30)

        # Holds a (cancelable! - just "self.shutdown.cancel()") callback for shutting down the server as needed.
        self.shutdown = None
Ejemplo n.º 2
0
    def __init__(self):
        self.CLOSE_GAME = False
        self.width = 1200
        self.height = 800
        self.chunkSize = 735
        self.screen = pygame.display.set_mode([
            self.width,  # x size of the screen
            self.height  # y size of the screen
        ])
        self.currScreen = 'menu'
        self.screens = (
            'menu',
            'game',
        )
        self.brightness = 50  # out of a max of 100

        self.songsFolder = 'Music/'
        self.song = ''
        self.animationFrameTime = 1 / 60
        self.mainMenu = mainMenu.MainMenu(self, self.screen)

        self.emptyGameData = game.GameData
        self.gameDifficulty = 1  # normal difficulty
        # we need to define the gameData only when we have an acceptable file path
        if os.path.isfile(self.song):
            self.gameData = game.GameData(self, self.screen, self.song)
            self.audioThread = self.gameData.musicThread
        else:
            self.gameData = None
Ejemplo n.º 3
0
def create_data():      Ref.data=game.GameData()
def dlvl():             return Ref.data.dlvl() #current dungeon level of player
Ejemplo n.º 4
0
import GUI
#import testGUI as GUI
import socket
import time
#import _thread as thread
import thread

PCARS = game.GameUDP('', 5606, 1367)


def setup_game_mode(currGame):
    UDP.setup_client(currGame.host, currGame.port, currGame.exp_length)


gameModeIsSetup = False
telemetry = game.GameData()
setup_game_mode(PCARS)  #Should be setup later to take multiple games


def get_and_handle_data(args):
    telemetry = args
    while True:
        try:
            data = UDP.get_udp_data()
        except socket.timeout:
            print("UDP client timed out")
        else:
            dataParser.PCars2_protocol1_parser(data, telemetry)

        #LED.led_control(telemetry)
Ejemplo n.º 5
0
 def create_data(cls):
     cls.data = game.GameData()