source: remote_control/puzzlebox_brainstorms_client_interface_pygame_network.py @ 103

Last change on this file since 103 was 73, checked in by sc, 11 years ago

brainstorms:

  • comprehensive file and class renaming in response to conversions

from PyGame/Twisted? frameworks to Qt

File size: 3.4 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Puzzlebox - Brainstorms - Client Interface - Pygame - Network
5#
6# Copyright Puzzlebox Productions, LLC (2010)
7#
8# This code is released under the GNU Pulic License (GPL) version 2
9# For more information please refer to http://www.gnu.org/copyleft/gpl.html
10#
11# Last Update: 2010.06.28
12#
13#####################################################################
14
15import os, sys
16
17import pygame
18#import pygame.font
19import pygame.image
20import pygame.locals
21
22from twisted.internet import reactor, protocol, defer
23
24import puzzlebox_brainstorms_configuration as configuration
25import puzzlebox_brainstorms_client_interface_pygame as client_interface
26#import puzzlebox_logger
27
28#####################################################################
29# Globals
30#####################################################################
31
32DEBUG = 1
33
34SERVER_HOST = configuration.BRAINSTORMS_SERVER_HOST
35SERVER_PORT = configuration.BRAINSTORMS_SERVER_PORT
36
37DISPLAY_WINDOW_X_COORDINATE = configuration.CLIENT_PYGAME_DISPLAY_WINDOW_X_COORDINATE
38DISPLAY_WINDOW_Y_COORDINATE = configuration.CLIENT_PYGAME_DISPLAY_WINDOW_Y_COORDINATE
39DISPLAY_WINDOW_X_DIMENSION = configuration.CLIENT_PYGAME_DISPLAY_WINDOW_X_DIMENSION
40DISPLAY_WINDOW_Y_DIMENSION = configuration.CLIENT_PYGAME_DISPLAY_WINDOW_Y_DIMENSION
41
42WINDOW_BACKGROUND_COLOR = configuration.CLIENT_PYGAME_WINDOW_BACKGROUND_COLOR
43
44#####################################################################
45# Classes
46#####################################################################
47
48#####################################################################
49# Functions
50#####################################################################
51
52#####################################################################
53# Main
54#####################################################################
55
56if __name__ == '__main__':
57       
58        #log = puzzlebox_logger.puzzlebox_logger(logfile='mcc')
59        log = None
60       
61       
62        # Collect default settings and command line parameters
63        server_host = SERVER_HOST
64        server_port = SERVER_PORT
65        display_window_x_coordinate = DISPLAY_WINDOW_X_COORDINATE
66        display_window_y_coordinate = DISPLAY_WINDOW_Y_COORDINATE
67        display_window_x_dimension = DISPLAY_WINDOW_X_DIMENSION
68        display_window_y_dimension = DISPLAY_WINDOW_Y_DIMENSION
69        window_background_color = WINDOW_BACKGROUND_COLOR
70       
71       
72        for each in sys.argv:
73               
74                if each.startswith("--host="):
75                        server_host = each[ len("--host="): ]
76                if each.startswith("--port="):
77                        server_port = each[ len("--port="): ]
78       
79       
80        # Window Defaults
81        try:
82                display_window_x_coordinate = string.atoi(sys.argv[-4])
83                display_window_y_coordinate = string.atoi(sys.argv[-3])
84                display_window_x_dimension = string.atoi(sys.argv[-2])
85                display_window_y_dimension = string.atoi(sys.argv[-1])
86        except:
87                if DEBUG > 1:
88                        print "Using default display coordinates"
89       
90       
91        interface = client_interface.puzzlebox_brainstorms_client_interface_pygame( \
92                                             log, \
93                                             display_window_x_coordinate, \
94                                             display_window_y_coordinate, \
95                                             display_window_x_dimension, \
96                                             display_window_y_dimension, \
97                                             window_background_color, \
98                                             DEBUG=DEBUG)
99       
100        reactor.callWhenRunning(interface.check_events)
101
102       
103        reactor.run()
104
Note: See TracBrowser for help on using the repository browser.