Exemplo n.º 1
0
    def __init__(self, init_cb, save, load, set_ai_cb, font):
        self.app = gui.App()
        self.app.connect(gui.QUIT, self.app.quit, None)
        container = gui.Container(align=-1, valign=-1)
        self.font = font

        self.save_dlg = SaveDialog(save)
        self.load_dlg = LoadDialog(load)
        self.about_dlg = AboutDialog()
        self.dialogs = (self.save_dlg, self.load_dlg, self.about_dlg)

        menus = gui.Menus([
            ('Game/New', init_cb, True),
            ('Game/Save', self.save_dlg.open, None),
            ('Game/Load', self.load_dlg.open, None),
            ('Game/Quit', self.quit, None),
            ('AI Level/Dumb', set_ai_cb, AI_Level.dumb),
            ('AI Level/Smart', set_ai_cb, AI_Level.smart),
            ('Help/About', self.about_dlg.open, None),
        ])
        menus.rect.w, menus.rect.h = menus.resize()
        self.doc = gui.Document(width=0, height=0)  # TODO: vertical?
        self.log_box = gui.ScrollArea(self.doc,
                                      SCREEN_WIDTH,
                                      100,
                                      hscrollbar=False)
        self.log("Welcome to Battleships!")

        container.add(menus, 0, 0)
        container.add(self.log_box, 0, SCREEN_HEIGHT - 100)
        self.menus = menus
        self.elements = (menus, self.log_box)
        self.app.init(container)
Exemplo n.º 2
0
    def __init__(self, ctx, screen_width, screen_height, x, y, width, height):

        self._ctx = ctx
        self._solvers = ctx.solvers
        self._solver_label, self._solver_field = None, None
        self._solver_ui = None
        self._width = width
        self._height = height

        self._event_listeners = collections.defaultdict(list)

        self._outer_container = gui.Container(width=screen_width,
                                              height=screen_height,
                                              align=-1,
                                              valign=-1)

        # outer container where stuff goes
        self._main_container = gui.Table(width=width,
                                         height=height,
                                         hpadding=5,
                                         vpadding=5,
                                         align=-1,
                                         valign=-1)

        self._outer_container.add(self._main_container, x, y)

        self._build_ui()

        application = gui.App()
        application.init(self._outer_container)

        self._application = application
Exemplo n.º 3
0
def create_main_app(screen):
    """Create an app with a background widget."""
    app = gui.App()
    background = pygame.Surface(screen.get_size())
    widget = gui.Image(background)
    app.init(widget, screen)
    return app
Exemplo n.º 4
0
	def __init__(self, graphicsEngine):
		self.graphicsEngine = graphicsEngine
		self.state = GUI_STATS

		self.background = pygame.image.load(g.dataPath + '/gui/game_background.png')
		g.guiSurface.blit(self.background, (0, 0))

		# events
		self.pressedKeys = []

		# game GUIs
		self.mapEditorGUI = MapEditorGUI(g.guiSurface)

		# input fields (TODO: dont hardcode placement)
		self.inpChat = pygUI.pygInputField((16, 384, 480, 20), "", 40, (255, 255, 255))
		self.inpChat.restricted = '\'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\\\'()*+,-./:;<=>?@[\]^_`{|}~\''
		self.listLog = pygUI.pygList((16, 420, 480, 164), (255, 255, 255))

		# TEMPORARY: MAP EDITOR
		self.label1 = pygUI.pygLabel((544, 150, 20, 20), "Selected tile:")


		# GUI
		self.app = gui.App()

		self.guiContainer = GUIContainer(self, align=-1, valign=-1)
		self.guiContainer.updateEngines()

		self.app.init(self.guiContainer)

		# dialogs
		self.quitDialog = QuitDialog()
Exemplo n.º 5
0
    def __init__(self, surface):
        self.surface = surface
        self.backgroundImage = pygame.image.load(g.dataPath +
                                                 '/gui/menu_background.png')

        # character selection
        self.characters = []
        self.charIndex = 1

        self.charName = ""
        self.charLevel = 0
        self.charClass = "WAAZZOR"
        self.charSprite = 1

        # sprite image
        self.spriteScale = 3
        self.spriteImage = pygame.Surface(
            (PIC_X * self.spriteScale, PIC_Y * self.spriteScale))
        self.spriteImageRect = self.spriteImage.get_rect()
        self.spriteImageRect.centerx = 800 / 2
        self.spriteImageRect.centery = 600 / 2

        # GUI
        self.app = gui.App()

        self.charControl = characterControl()
        self.charControl.engine = self

        self.c = gui.Container(align=0, valign=0)
        self.c.add(self.charControl, 0, 0)

        self.app.init(self.c)
Exemplo n.º 6
0
    def __init__(self):
        self.camera = Camera(self, None)

        self.gui = pgui.App(theme)
        self.gui_container = pgui.Container(
            width=value["init.virtual_width"],
            height=value["init.virtual_height"])
        self.gui.init(self.gui_container)
Exemplo n.º 7
0
    def __init__(self, graphicsEngine):
        self.graphicsEngine = graphicsEngine
        self.state = GUI_STATS

        self.background = pygame.image.load(g.dataPath + '/gui/bg_ingame.png')
        g.guiSurface.blit(self.background, (0, 0))

        # events
        self.pressedKeys = []

        # inventory boxes
        self.inventoryBoxes = []
        for y in range(0, 3):
            for x in range(0, 3):
                self.inventoryBoxes.append(
                    pygame.Rect((524 + x * (66 + 24) + 1,
                                 90 + y * (66 + 24) + 1, 64, 64)))

        self.emptySlotSurface = pygame.image.load(
            g.dataPath + '/gui/empty_slot.png').convert_alpha()

        # spellbook boxes
        # inventory boxes
        self.spellbookBoxes = []
        for y in range(0, 3):
            for x in range(0, 3):
                self.spellbookBoxes.append(
                    pygame.Rect((524 + x * (66 + 24) + 1,
                                 90 + y * (66 + 24) + 1, 64, 64)))

        # inventory tooltip
        self.tooltipRect = pygame.Rect((0, 0, 128, 64))

        # game GUIs
        self.mapEditorGUI = MapEditorGUI(g.guiSurface)
        self.itemEditorGUI = ItemEditorGUI(g.guiSurface)
        self.spellEditorGUI = SpellEditorGUI(g.guiSurface)
        self.npcEditorGUI = NPCEditorGUI(g.guiSurface)

        # GUI
        self.app = gui.App()

        self.guiContainer = GUIContainer(self, align=-1, valign=-1)
        self.guiContainer.updateEngines()

        self.app.init(self.guiContainer)

        # dialogs
        self.quitDialog = QuitDialog()

        # dirty
        self.isDirty = True

        # init
        self.itemSprites = []
        self.spellSprites = []
        self.loadSprites()
Exemplo n.º 8
0
    def __init__(self, surface):
        self.music = True
        self.sfx = True

        self.surface = surface

        self.bg = pygame.image.load("png/bg.png")

        self.surface.blit(self.bg, (0, 0))

        self.app = gui.App(theme=gui.Theme("data/themes/clean"))
        self.app.connect(gui.QUIT, self.app.quit, None)

        self.table = gui.Table(width=self.surface.get_width(),
                               height=self.surface.get_height())

        self.table.tr()

        self.font = pygame.font.Font("font.ttf", 50)
        self.sfont = pygame.font.Font("font.ttf", 16)

        self.table.td(gui.Label("Zombie Hordes", font=self.font))

        self.table.tr()

        self.button = gui.Button("Play", width=200, font=self.sfont)
        self.button.connect(gui.CLICK, self.playgame)

        self.table.td(self.button)

        self.quit = gui.Button("Quit", width=200, font=self.sfont)
        self.quit.connect(gui.CLICK, self.app.quit, None)

        self.dlg = None

        def dlo():
            self.dlg = TestDialog(self)
            self.dlg.open()
            threading.Thread(target=dlc).start()

        def dlc():
            while self.dlg.is_open():
                pass
            self.surface.blit(self.bg, (0, 0))
            self.app.repaint()

        self.options = gui.Button("Options", width=200, font=self.sfont)
        self.options.connect(gui.CLICK, dlo)

        self.table.tr()
        self.table.td(self.options)

        self.table.tr()
        self.table.td(self.quit)

        self.game = None
Exemplo n.º 9
0
    def __init__(self, tStart, tEnd, tElapsed, **params):
        gui.Table.__init__(self, **params)
        self.speed = 1.0
        self.t = 0.0
        self.paused = False

        def cb_slider_changed(slider):
            self.t = slider.value

        def cb_faster():
            self.speed *= 2.0

        def cb_slower():
            self.speed /= 2.0

        def cb_pause():
            self.paused = True

        def cb_play():
            self.paused = False

        fg = (255, 255, 255)
        self.tr()
        # first row of buttons:
        #   - pause       ||
        #   - resume      >
        #   - slow down   <<
        #   - speedup     >>
        #   - time slider
        btn = gui.Button("||")
        btn.connect(gui.CLICK, cb_pause)
        self.td(btn)
        btn = gui.Button(">")
        btn.connect(gui.CLICK, cb_play)
        self.td(btn)
        btn = gui.Button("<<")
        btn.connect(gui.CLICK, cb_slower)
        self.td(btn)
        btn = gui.Button(">>")
        btn.connect(gui.CLICK, cb_faster)
        self.td(btn)
        self.td(gui.Label(""))
        self.td(gui.Label(""))
        self.td(gui.Label(""))
        self.timeslider = gui.HSlider(0.0,
                                      0.0,
                                      tElapsed,
                                      size=20,
                                      width=400,
                                      height=16,
                                      name='time',
                                      colspan=15)
        self.timeslider.connect(gui.CHANGE, cb_slider_changed, self.timeslider)
        self.td(self.timeslider)
        self.app = gui.App()
        self.app.init(self)
Exemplo n.º 10
0
    def __init__(self):
        # Box2D Initialization
        self.worldAABB = box2d.b2AABB()
        self.worldAABB.lowerBound = (-200.0, -100.0)
        self.worldAABB.upperBound = (200.0, 200.0)
        gravity = (0.0, -10.0)

        doSleep = True
        self.world = box2d.b2World(self.worldAABB, gravity, doSleep)
        self.destructionListener = fwDestructionListener()
        self.boundaryListener = fwBoundaryListener()
        self.contactListener = fwContactListener()
        self.debugDraw = fwDebugDraw()

        self.destructionListener.test = self
        self.boundaryListener.test = self
        self.contactListener.test = self

        self.world.SetDestructionListener(self.destructionListener)
        self.world.SetBoundaryListener(self.boundaryListener)
        self.world.SetContactListener(self.contactListener)
        self.world.SetDebugDraw(self.debugDraw)

        # Pygame Initialization
        if fwSettings.onlyInit:  # testing mode doesn't initialize pygame
            return

        pygame.init()

        caption = "Python Box2D Testbed - " + self.name
        pygame.display.set_caption(caption)

        self.screen = pygame.display.set_mode((1000, 700))
        self.debugDraw.surface = self.screen

        self.screenSize = box2d.b2Vec2(*self.screen.get_size())

        try:
            self.font = pygame.font.Font(None, 24)
        except IOError:
            try:
                self.font = pygame.font.Font("freesansbold.ttf", 24)
            except IOError:
                print "Unable to load default font or 'freesansbold.ttf'"
                print "Disabling text drawing."
                self.DrawString = lambda x, y, z: 0

        # GUI Initialization
        self.gui_app = gui.App()
        self.gui_table = fwGUI(self.settings)
        container = gui.Container(align=1, valign=-1)
        container.add(self.gui_table, 0, 0)
        self.gui_app.init(container)

        self.viewCenter = (0, 10.0 * 20.0)
Exemplo n.º 11
0
def complaint_dialog(message):
    """Create a complaint dialog"""
    app = gui.App()

    def close(_w):
        app.quit()

    app.close = close

    dialog = WarnDialog('Problem starting Fox Assault', message)
    app.run(dialog)
    sys.exit(1)
Exemplo n.º 12
0
    def __init__(self, surface):
        self.surface = surface
        self.x = 10
        self.y = 10

        self.backgroundImage = pygame.image.load(g.dataPath +
                                                 '/gui/menu_background.png')

        # class selection
        self.classIndex = 0

        # - statistics
        self.labelClassName = pygUI.pygLabel((350, 180, 100, 20),
                                             "CLASS NAME",
                                             align=pygUI.ALIGN_CENTER)

        self.labelInfoStats = pygUI.pygLabel((544, 50, 256, 20),
                                             "Class Statistics",
                                             align=pygUI.ALIGN_CENTER)

        self.labelHP = pygUI.pygLabel((544, 70, 10, 10), "HP: ")
        self.labelMP = pygUI.pygLabel((544, 90, 10, 10), "MP: ")
        self.labelSP = pygUI.pygLabel((544, 110, 10, 10), "SP: ")

        self.labelStr = pygUI.pygLabel((544, 150, 10, 10), "Strength: ")
        self.labelDef = pygUI.pygLabel((544, 170, 10, 10), "Defense:")
        self.labelSpd = pygUI.pygLabel((544, 190, 10, 10), "Speed:")
        self.labelMag = pygUI.pygLabel((544, 210, 10, 10), "Magic:")

        self.labels = (self.labelClassName, self.labelInfoStats, self.labelHP,
                       self.labelMP, self.labelSP, self.labelStr,
                       self.labelDef, self.labelSpd, self.labelMag)

        # sprite image
        self.spriteScale = 3
        self.spriteImage = pygame.Surface(
            (PIC_X * self.spriteScale, PIC_Y * self.spriteScale))
        self.spriteImageRect = self.spriteImage.get_rect()
        self.spriteImageRect.centerx = 800 / 2
        self.spriteImageRect.centery = 600 / 2

        # GUI
        self.app = gui.App()

        self.charControl = newCharControl()
        self.charControl.engine = self

        self.c = gui.Container(align=0, valign=0)
        self.c.add(self.charControl, 0, 0)

        self.app.init(self.c)
Exemplo n.º 13
0
    def __init__(self):
        pygame.init()

        # Used to manage how fast the screen updates
        self._clock = pygame.time.Clock()

        # Set the width and height of the screen [width, height]
        self._infoObject = pygame.display.Info()
        self._screen = pygame.display.set_mode(
            ((self._infoObject.current_w >> 1) + 300,
             (self._infoObject.current_h >> 1) + 300),
            pygame.HWSURFACE | pygame.DOUBLEBUF | pygame.RESIZABLE, 32)
        pygame.display.set_caption(
            "Kinect-based Gait Data Acquisition Software")

        # Loop until the user clicks the close button.
        self._done = False

        # Used to manage how fast the screen updates
        self._clock = pygame.time.Clock()

        # Kinect runtime object, we want only color and body frames
        self._kinect = PyKinectRuntime(PyKinectV2.FrameSourceTypes_Color
                                       | PyKinectV2.FrameSourceTypes_Body)

        # back buffer surface for getting Kinect color frames, 32bit color, width and height equal to the Kinect color frame size
        self._frame_surface = pygame.Surface(
            (self._kinect.color_frame_desc.Width,
             self._kinect.color_frame_desc.Height), 0, 32)

        # surface to draw skeleton
        self._skeleton_surface = pygame.Surface(
            (self._kinect.color_frame_desc.Width,
             self._kinect.color_frame_desc.Height), 0, 32)

        # here we will store skeleton data
        self._bodies = None

        self.app = gui.App()
        # app = gui.Desktop()

        self.skeletonCtrl = SkeletonControl()

        self.c = gui.Container(align=-1, valign=-1)

        self.c.add(self.skeletonCtrl,
                   self._screen.get_width() // 2,
                   self._frame_surface.get_height() // 2)
        # c.add(skeletonCtrl,300, 250)

        self.app.init(self.c)
Exemplo n.º 14
0
 def __init__(self):
     self.app = app = gui.App()
     button_send = gui.Button('Send')
     button_OK = gui.Button('OK')
     # button_send.connect(gui.CLICK, on_btn_click, 'send')
     self.rect = pygame.Rect((120, 50, 200, 50))
     table = gui.Table()
     table.tr()
     table.td(gui.Label("Button: "))
     table.td(button_send)
     table.tr()
     table.td(gui.Label("Button: "))
     table.td(button_OK)
     app.init(widget=table, screen=screen, area=self.rect)
 def __init__(self,our_surface,width,height):
     self.SURFACE_W,self.SURFACE_H = our_surface.get_size()
     self.surface = our_surface
     self.app = gui.App()
     self.container = gui.Container(align=-1,valign=-1)
     self.button_list = []
     self.button_width = width
     self.button_height = height
     self.separator = 5
     self.finalized = False
     self.button_pressed = None
     self.title = ""
     self.titlecolour = []
     self.titlesize = 0
Exemplo n.º 16
0
    def __init__(self, surface):
        self.surface = surface
        self.backgroundImage = pygame.image.load(g.dataPath + '/gui/menu_background.png')

        # GUI
        self.app = gui.App()

        regControl = registerControl()
        regControl.engine = self

        self.c = gui.Container(align=0, valign=0)
        self.c.add(regControl, 0, 0)

        self.app.init(self.c)
Exemplo n.º 17
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)
        self.speed = 1.0
        self.t = 0.0
        self.paused = False
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.port = 7060
        self.ip = "127.0.0.1"
        
        def cb_rewind():
            self.sock.sendto("REWIND", (self.ip, self.port))

        def cb_step_back():
            self.sock.sendto("STEP_BACK", (self.ip, self.port))

        def cb_pause():
            self.sock.sendto("PAUSE", (self.ip, self.port))

        def cb_step_forward():
            self.sock.sendto("STEP_FORWARD", (self.ip, self.port))

        def cb_play():
            self.sock.sendto("PLAY", (self.ip, self.port))

        self.tr()        

        btn = gui.Button("<<")
        btn.connect(gui.CLICK, cb_rewind)
        self.td(btn)

        btn = gui.Button("<")
        btn.connect(gui.CLICK, cb_step_back)
        self.td(btn)

        btn = gui.Button("||")
        btn.connect(gui.CLICK, cb_pause)
        self.td(btn)

        btn = gui.Button(">")
        btn.connect(gui.CLICK, cb_step_forward)
        self.td(btn)
        
        btn = gui.Button(">>")
        btn.connect(gui.CLICK, cb_play)
        self.td(btn)
        
        self.app = gui.App()
        self.app.init(self)
Exemplo n.º 18
0
    def __init__(self, surface):

        # GUI
        self.app = gui.App()

        loginCtrl = loginControl()
        loginCtrl.engine = self

        self.c = gui.Container(align=0, valign=0)
        self.c.add(loginCtrl, 0, 0)

        self.app.init(self.c)

        self.surface = surface
        self.x = 10
        self.y = 10

        self.backgroundImage = pygame.image.load(g.dataPath +
                                                 '/gui/menu_background.png')
Exemplo n.º 19
0
    def on_enter(self):
        """Create the Theater"""
        # The theater is the Sypral Group responsible for holding the
        # backdrop, actors, and subtitler. It is held by the Script.
        self.theater = spyral.sprite.Group(self.theaterCamera)

        bg = spyral.util.new_surface(geom['screen'].size)
        bg.fill(colors['bg'])
        self.screenCamera.set_background(bg)

        self.script = script.Script()
        self.script.setTheater(self.theater)
        self.script.setRecorder(self.recorder)
        self.script.default()

        self.gui = gui.App(theme=pgu['theme'])
        self.guiContainer = gui.Container(align=-1, valign=-1)
        if geom['frame'] != geom['screen']:
            images['main-background'] = spyral.util.load_image(
                images['main-background'])
            croppedFrame = spyral.util.new_surface(geom['screen'].size)
            croppedFrame.blit(images['main-background'],
                              geom['frame'],
                              area=geom['screen'])
            images['main-background'] = croppedFrame
        self.guiContainer.add(gui.Image(images['main-background']),
                              *geom['screen'].topleft)
        self.guiContainer.add(gui.Image(images['main-tab']),
                              *geom['tab'].topleft)

        # Tab is used to switch between the different panels
        self.tab = tab.Tab(self.script)

        # Add the tab and panel holder to the screen
        self.guiContainer.add(self.tab, *geom['tab'].topleft)
        self.guiContainer.add(self.tab.panelHolder, *geom['panel'].topleft)

        self.script.gui = self.gui

        self.gui.init(self.guiContainer)
Exemplo n.º 20
0
def run():
    init_pygame()
    app = gui.App()

    dialog = SimpleDialog()
    app.init(dialog)

    app.paint(screen)
    pygame.display.flip()
    while True:
        app.paint(screen)
        pygame.display.flip()
        for event in pygame.event.get():
            if event.type == pygame.MOUSEBUTTONDOWN:
                if event.button == 3:  # right mouse button
                    print("opening")
                    dialog.open()
                else:
                    app.event(event)
            elif event.type == pygame.QUIT:
                sys.exit()
            else:
                app.event(event)
Exemplo n.º 21
0
    def __init__(self, surface):

        # variables
        self.username = ""
        self.password = ""

        # GUI
        self.app = gui.App()

        self.loginCtrl = loginControl()
        self.loginCtrl.engine = self

        self.c = gui.Container(align=0, valign=0)
        self.c.add(self.loginCtrl, 0, 0)

        self.app.init(self.c)

        self.surface = surface
        self.x = 10
        self.y = 10

        self.backgroundImage = pygame.image.load(g.dataPath +
                                                 '/gui/bg_menu.png')
Exemplo n.º 22
0

if __name__ == "__main__":
    #app.run(host='localhost', port=5000)

    pygame.init()
    clock = pygame.time.Clock()
    screen = pygame.display.set_mode((width, height))
    mp = MapParams()
    map_file = load_map(mp)

    all_sprites = pygame.sprite.Group()
    sch = Search()
    all_sprites.add(sch)

    app = gui.App()

    dialog1 = SimpleDialog("Search")
    dialog2 = SimpleDialog("Type")

    empty = gui.Container(width=width, height=height)
    app.init(empty)

    app.paint(screen)
    pygame.display.flip()
    resp = ""
    ps = ""
    d_opened = False
    lg = False
    lg1 = False
    with open('coords.json', 'w') as outfile:
Exemplo n.º 23
0
def main():

    # A few globals.
    global env, game_window, air_track, gui_form, gui_application
    
    # Initiate pygame
    pygame.init()

    # Tuple to define window dimensions
    window_size_px = window_width_px, window_height_px = 950, 120

    # Instantiate an Environment object for converting back and forth from pixels and meters.
    # The also creates the local client.
    env = Environment(window_width_px, 1.5)

    # Instantiate the window.
    game_window = GameWindow(window_size_px)
    
    # Initialize gui...
    gui_form = gui.Form()
    env.gui_controls = TrackGuiControls()
    
    gui_container = gui.Container(align=-1, valign=-1)
    gui_container.add(env.gui_controls, 0, 0)
    
    gui_application = gui.App()
    gui_application.init( gui_container)

    # Instantiate an air track (this adds an empty car list to the track).
    air_track = AirTrack()

    # Make some cars (run demo #1).
    air_track.make_some_cars(1)

    # Instantiate clock to help control the framerate.
    myclock = pygame.time.Clock()
        
    # Control the framerate.
    framerate_limit = 400

    time_s = 0.0
    user_done = False
    
    while not user_done:
    
        # Erase everything.
        game_window.surface.fill(THECOLORS["black"])

        # Get the delta t for one frame (this changes depending on system load).
        dt_s = float(myclock.tick(framerate_limit) * 1e-3)

        # This check avoids problem when dragging the game window.
        if (dt_s < 0.10):
        
            # Check for user initiated stop or demo change.
            resetmode = env.get_local_user_input()
            
            if (resetmode in ["1p","2p","3p",1,2,3,4,5,6,7,8,9,0]):
                print "demo mode =", resetmode
                
                # This should remove all references to the cars and effectively deletes them.
                #air_track.cars = []
                
                # Now just black everything out and update the screen.
                game_window.erase_and_update()
                
                # Build new set of cars based on the reset mode.
                air_track.make_some_cars( resetmode)
            
            elif (resetmode == 'quit'):
                user_done = True
                
            elif (resetmode != None):
                print resetmode
            
            # Set object attributes based on the values returned from a query of the Gui.
            # Important to do this AFTER all initialization and car building is over, AFTER
            # any user input from the pygame event queue, and BEFORE the updates to the speed
            # and position.
            env.gui_controls.queryIt()
            
            # Calculate client related forces.
            for client_name in env.clients:
                env.clients[client_name].calc_tether_forces_on_cars()
            
            # Update velocity and x position of each car based on the dt_s for this frame.
            for car in air_track.cars:
                air_track.update_SpeedandPosition(car, dt_s)
            
            # Check for collisions and apply collision physics to determine resulting
            # velocities.
            air_track.check_for_collisions()
            
            # Draw the car at the new position.
            for car in air_track.cars:
                car.draw_car()
                
            # Draw cursor strings.
            for client_name in env.clients:
                if (env.clients[client_name].selected_car != None):
                    env.clients[client_name].draw_cursor_string()
                        
            # Update the total time since starting.
            time_s += dt_s
            
            # Paint the gui. (F2 toggles gui on/off)
            if air_track.gui_menu:
                gui_application.paint()
                    
            # Make this update visible on the screen.
            pygame.display.flip()
Exemplo n.º 24
0
# pbl2 = pgui.Label("37342km")
# pbl2.set_font(font2)
# lo.add(pbl,0,20)
# lo.add(pbl2, 150, 22)
# lo.add(button,130,25)
# selector = pgui.Select()
# selector.add("Blue", 'blue')
# selector.add("Green", 'green')
# gun = pgui.Image(texture["repair_earth"])
# selector.add(gun , 'red')
# lo.add(selector, 180, 22)
#

import my_gui

gui = pgui.App()
lo = pgui.Container(width=1920, height=1080)
img = my_gui.InfoBlock()
img.add_to_gui(lo)
import my_gui
p = my_gui.Box(system.system)
p.position = 100, 100
p.add_to_gui(lo)
p.update()
container = pgui.Container(width=300, height=100)
container.focusable = False
gah = pgui.Group()

radio_button = pgui.Radio(gah, 'Blue')
radio_button_2 = pgui.Radio(gah, 'Red')
radio_button_3 = pgui.Radio(gah, 'Yellow Mofof')
Exemplo n.º 25
0
    def run(self):
        time = timer.Timer(base.FPS)

        self.loadLevel()
        self.start()

        #global app
        maingui = gui.App()

        self.guiCont = gui.Container(align=0, valign=-1)

        self.levelSelDlg = SelectLevelDialog(self)

        # toggling dialog's visibility at certain position seems to be quite tricky
        # we need to first add the dialog in to the container ...
        self.guiCont.add(self.levelSelDlg, 0, 0)

        maingui.init(self.guiCont)

        # ... then we can remove it (so that it's invisible until we want to show it)
        self.guiCont.remove(self.levelSelDlg)
        self.levelSelDlg.isVisible = False
        #MAYO added the eztext
        txtbx = eztext.Input(
            maxlength=45,
            x=100,
            y=570,
            color=(255, 0, 0),
            prompt="Type in the missing word to repair the Bible: ")
        while 1:
            #MAYO now check to see if the word is correct.
            ev = pygame.event.get()
            if self.inputing:
                txtbx.update(ev)
                txtbx.draw(self.screen)

                pygame.display.flip()

            for e in ev:

                if (e.type is QUIT): self.nextState = base.QUITGAME
                elif (e.type is KEYDOWN):
                    #MAYO now add int the code to check for the bible being correct.
                    if ((e.key == K_RETURN) and self.inputing):
                        if txtbx.value == self.retval[2]:
                            self.num_bibles += 1
                            base.num_bibles = self.num_bibles
                            self.hud.show_dialog(_("You fixed the Bible!"))
                            txtbx.value = ""

                        else:
                            self.hud.show_dialog(
                                _("You couldn't fix the Bible!"))
                            txtbx.value = ""

                        txtbx.update(ev)
                        txtbx.draw(self.screen)

                        pygame.display.flip()
                        self.inputing = False
                    self.handleKeys(e.key)
                elif (e.type is JOYBUTTONDOWN):
                    self.handleButton(e)
                else:
                    maingui.event(e)

            if (self.nextState != base.GAMECONTINUES):
                break

            ## Paint the background.
            self.bg.view.x = self.view.x / 2
            self.bg.view.y = self.view.y / 2
            self.bg.paint(self.screen)

            ## Paint the foreground (player and such)
            self.paint(self.screen)

            ## Paint the HUD
            if self.player != None:
                self.hud.paint(self.screen)
                self.player.hudHeight = self.hud.height

            maingui.paint(self.screen)

            #if not (self.paused):
            #         if (self.exit):
            #                 break         ## exit while

            if self.player != None and (
                (self.player.rect.y + self.player.rect.height) >
                ((len(self.tlayer) - 1) * TILE_SIZE)):
                print("Whoops! Fell off the level -- try again!")
                self.daveInTrouble(-1)

            if not self.paused:

                self.frame += 1
                self.animate_background()

                # todo, the list index goes out of range in vid.py at line 427
                # when the bottom of dave's sprite rect goes out of the screen
                # edit: this bug should be fixed but leaving this here for now until
                #try:

                self.OnLoop()
                self.loop()

                # todo should we catch the "undeclared variable" errors from level scripts?
                #except NameError, e:
                #         print e, ""
                #except IndexError, e:
                #         print e , "This is known bug which should have been fixed, plese report this"

                if (self.quake):
                    self.focus_rect.x += random.randrange(-5, 5)
                    self.focus_rect.y += random.randrange(-5, 5)
                    if (self.quake > 0):
                        self.quake -= 1

                self.view.clamp_ip(self.focus_rect)

            time.tick()

            pygame.display.flip()

        return self.nextState
Exemplo n.º 26
0
 def __init__(self):
     self.app = pgui.App()
     self.layout = pgui.Container(align=-1, valign=-1)
     self.checkbox_values = {}
     self.gui_rects = []
Exemplo n.º 27
0
    def __init__(self, screen, demomode):
        #Screen vars
        Game.SCREEN_W = screen.get_size()[0]
        Game.SCREEN_H = screen.get_size()[1]
        Game.AERIALPANE_W = Game.SCREEN_H
        Game.AERIALPANE_H = Game.SCREEN_H
        Game.FSPANE_LEFT = Game.AERIALPANE_W + 3
        Game.FSPANE_H = Game.SCREEN_H - Game.FSPANE_TOP
        Game.FS_W = Game.SCREEN_W - Game.FSPANE_LEFT
        Game.FS_H = 60
        Game.RADAR_RADIUS = (Game.AERIALPANE_H - 50) / 2

        #Imagey type stuff
        self.font = pygame.font.Font(None, 30)
        self.screen = screen

        #Aircraft/destination state vars
        self.demomode = demomode
        self.gameEndCode = 0
        self.ms_elapsed = 0
        self.score = 0
        self.aircraft = []
        self.obstacles = []
        self.destinations = []
        self.aircraftspawntimes = []
        self.aircraftspawns = []

        #UI vars
        self.ac_selected = None
        self.way_clicked = None

        # Double click
        self.last_click_time = None

        #Generations functions
        self.__generateDestinations()
        self.__generateObstacles()
        self.__generateAircraftSpawnEvents()

        # Preload sounds.
        self.sound_warning = pygame.mixer.Sound("data/sounds/warning.ogg")
        self.sound_collision = pygame.mixer.Sound("data/sounds/boom.wav")
        self.channel_warning = pygame.mixer.Channel(0)
        self.channel_collision = pygame.mixer.Channel(1)

        self.app = gui.App()
        self.cnt_main = gui.Container(align=-1, valign=-1)
        self.delaytimer = 0

        if not self.demomode:
            self.btn_game_end = gui.Button(value="End Game",
                                           width=Game.FS_W - 3,
                                           height=60)
            self.btn_game_end.connect(gui.CLICK, self.__callback_User_End)
            self.cnt_main.add(self.btn_game_end, Game.FSPANE_LEFT,
                              Game.FSPANE_TOP - 65)
        else:
            pygame.mouse.set_visible(False)
            self.delaytimer = pygame.time.get_ticks()

        self.cnt_fspane = FlightStripPane(left=Game.FSPANE_LEFT,
                                          top=Game.FSPANE_TOP,
                                          width=Game.FS_W,
                                          align=-1,
                                          valign=-1)
        self.cnt_main.add(self.cnt_fspane, Game.FSPANE_LEFT, Game.FSPANE_TOP)

        self.app.init(self.cnt_main, self.screen)
Exemplo n.º 28
0
def Create_input():  #Opens screen to handle text input from the user
    global Window, input_initialized, can_execute, Frame, input_from_user
    input_initialized = True

    #App over toolbar
    app = gui.App(screen=Window, area=Frame)
    app.connect(gui.QUIT, app.quit, None)
    my_container1 = gui.Container(width=670, height=500)

    #Label to write code
    Label_code = gui.Label("Escribe/modifica tu código:")
    #Label to buttons
    Label_buttons = gui.Label("Cambios realizados:")

    #Cancel button
    cancel_btn = gui.Button("Cancelar")
    cancel_btn.connect(gui.CLICK, app.quit, None)

    #To save current input on the display
    def cb():
        global input_from_user, can_execute
        input_from_user = textarea_code.value
        can_execute = False
        app.quit()

    #Save button
    save_btn = gui.Button("Guardar")
    save_btn.connect(gui.CLICK, cb)
    #Checks for previous program
    if input_from_user == "":
        previous_text = "miPrograma Uno;\n{\ncrearPersonaje Nombre;\nvar Mi numero = 3;\nMi = 5;\nNombre.abajo(1);\n}"
    else:
        previous_text = input_from_user
    textarea_code = gui.TextArea(value=previous_text, width=235, height=360)

    def help():
        global Window, Frame, input_from_user
        #Saves changes on the input
        input_from_user = textarea_code.value
        #App over toolbar
        second_app = gui.Desktop(screen=Window, area=Frame)
        my_container2 = gui.Container(width=670, height=500)
        second_app.connect(gui.QUIT, second_app.quit, None)
        second_app.connect(gui.QUIT, app.quit, None)
        #Exit button
        cancel_btn = gui.Button("Regresar")
        cancel_btn.connect(gui.CLICK, second_app.quit, None)
        cancel_btn.connect(gui.CLICK, app.quit, None)
        #Add items to container
        my_container2.add(
            gui.Image(const.imagespath + "Instrucciones_Background.png"), 0, 0)
        my_container2.add(cancel_btn, 575, 10)
        second_app.run(my_container2)
        pygame.display.flip()

    #Help button
    help_btn = gui.Button("Instrucciones")
    help_btn.connect(gui.CLICK, help)

    def file_treat():
        global Window, Frame
        #TODO Agregar imagen a botones y estilo a fondo
        third_app = gui.Desktop(screen=Window, area=Frame)
        third_app.connect(gui.QUIT, third_app.quit, None)
        third_app.connect(gui.QUIT, app.quit, None)
        my_container3 = gui.Container(width=670, height=500)
        #Open button
        open_btn = gui.Button("Abrir")
        open_btn.connect(gui.CLICK, open_file_browser, True)
        #Save button
        save_btn = gui.Button("Guardar")
        save_btn.connect(gui.CLICK, open_file_browser, False)
        #Continue button / close file treatment
        ok_btn = gui.Button("Listo!")
        ok_btn.connect(gui.CLICK, third_app.quit, None)
        ok_btn.connect(gui.CLICK, app.quit, None)
        #Cancel button
        cancel_btn = gui.Button("Cancelar")
        cancel_btn.connect(gui.CLICK, third_app.quit, None)
        cancel_btn.connect(gui.CLICK, app.quit, None)

        #Add elements to container
        my_container3.add(
            gui.Image(const.imagespath + "Archivo_Background.png"), 0, 0)
        my_container3.add(open_btn, 155, 330)
        my_container3.add(save_btn, 455, 330)
        my_container3.add(ok_btn, 310, 375)
        my_container3.add(cancel_btn, 580, 10)
        third_app.run(my_container3)
        pygame.display.flip()

    #file treatment
    file_btn = gui.Button("Archivo")
    file_btn.connect(gui.CLICK, file_treat)

    # Display the background when playing as beginner
    def hint():
        global numero_hint, Window
        #Window.fill(const.green)
        if numero_hint < 5:
            numero_hint = numero_hint + 1
        else:
            numero_hint = 1
        #Hint images for level 1
        if dificulty_level == 1:
            if numero_hint == 1:
                img = images[0]
            elif numero_hint == 2:
                img = images[1]
            elif numero_hint == 3:
                img = images[2]
            elif numero_hint == 4:
                img = images[3]
            elif numero_hint == 5:
                img = images[4]
            img.set_colorkey(RLEACCEL)
            rect = Rect((-8, 35), (0, 0))
            #Window.fill(const.green)
            Window.blit(img, rect)
            #Update_display()
            pygame.display.flip()

    #Next tip button
    hint_btn = gui.Button("Siguiente tip")
    hint_btn.connect(gui.CLICK, hint)

    #Add items to container
    my_container1.add(Label_buttons, 462, 30)
    my_container1.add(cancel_btn, 450, 50)
    my_container1.add(save_btn, 550, 50)
    my_container1.add(file_btn, 500, 5)
    my_container1.add(Label_code, 419, 75)
    my_container1.add(textarea_code, 419, 95)
    my_container1.add(help_btn, 480, 470)
    if dificulty_level == 1:
        my_container1.add(hint_btn, 145, 415)
    app.run(my_container1)
Exemplo n.º 29
0
def main():
   os.environ['SDL_VIDEO_CENTERED'] = '1'
   pygame.mixer.init()
   pygame.init()
   pygame.display.set_caption("连连看 powered by Python")
   global dc,psubft,psubfts
   dc = pygame.display.set_mode((SW, SH),pygame.DOUBLEBUF)
   appico=pygame.image.load('data/app.png').convert_alpha()
   pygame.display.set_icon(appico)
   psubft=pygame.font.Font('data/shaonv.ttf', 35)
   psubfts=pygame.font.Font('data/shaonv.ttf', 18)
   global gamecm,gamemap,gamepm
   gamecm = gameComm()
   #gamemap = Imap(dc,0,SW,SH)
   #mymap = gamemap.cellinfo
   #gamepm= PathManager(mymap)
   gamecm.set_background(color=(25,50,24))
   
   app=gui.App()
   c=gui.Container(width=SW,align=0,valign=-1)
   #print c.style.x
   global mainmenu,meswin,misswin
   mainmenu=MenuControl()
   #print mainmenu.rect
   c.add(mainmenu, (SW-166)/2, 200)
   app.init(c)
   #print mainmenu.rect
   global clearsp
   _quit = 0
   clock = pygame.time.Clock()
   pausewin=PauseDialog()
   
   #meswin.connect(gui.K_ESCAPE, quitGame,None)
   #meswin.connect(gui.K_SPACE, show_mainmenu,c)
   qmeswin=MessageDialog(u"你要放弃此游戏返回主菜单吗?", psubft)
   misswin=MessageDialog(u"通过此关,进入下一关!",psubft)
   misswina=MessageDialog(u"恭喜你通关了!",psubft)
   global clicksnd,lasersnd
   clicksnd=load_sound('click.wav')
   clicksnd.set_volume(0.2)
   lasersnd=load_sound('laser.wav')
   lasersnd.set_volume(0.2)
   if pygame.mixer:
        menumusic = os.path.join('data', 'menu.wav')
        pygame.mixer.music.load(menumusic)
        pygame.mixer.music.set_volume(0.2)
        
   gameTime=0    #程序运行总时间
   playTime=0    #游戏中玩的时间
   tmpTime=0     #不在玩的时间
   playTime1=0
   sprizeTime=0
  
   miscid=0
   #pausewin.connect(gui.K_F7, pausewin.close())
   while not _quit:
       delta=clock.tick(30)
       
       gameTime=pygame.time.get_ticks()
       dc.blit(gamecm.backgd,(0,0))
       #pygame.draw.line(dc, (255,0,2), (SW/2,0), (SW/2,SH))       
       for evt in pygame.event.get():
            if evt.type == pygame.QUIT: _quit = 1
            if evt.type == pygame.KEYDOWN:
               if evt.key == pygame.K_ESCAPE: 
                   if mainmenu.selectedm==gameState.gameRun:          #弹出信息窗口
                         mainmenu.selectedm=gameState.gameMess
                         qmeswin.open()
                         pygame.mixer.music.pause()
                   elif mainmenu.selectedm==gameState.gameMess:     #退出信息窗口或退出游戏
                       if qmeswin in app.windows:
                            mainmenu.selectedm=gameState.gameRun
                            pygame.mixer.music.unpause()
                            qmeswin.close()
                       elif meswin in app.windows:
                            _quit=1
                       #elif misswin in app.windows:
                           
               elif evt.key == pygame.K_SPACE or evt.key == pygame.K_RETURN:   ##超时或生命没有了或放弃游戏信息窗口返回主菜单
                   if mainmenu.selectedm==gameState.gameMess:
                         mainmenu.selectedm=gameState.gameBegin
                         if qmeswin in app.windows:
                              qmeswin.close()
                         elif meswin in app.windows:
                              meswin.close()
                         c.add(mainmenu,(SW-166)/2, 200)               
                         gamecm.reinit()
                         pygame.mixer.music.load(menumusic)
                   elif mainmenu.selectedm==gameState.gameNextmiss:   #下一关
                         mainmenu.selectedm=gameState.gameRun
                         gamecm.update_heart(1)
                         #gamecm.update_misslv(1)
                         gamecm.update_score(2000)
                         gamemap.reset_map()
                         gamepm.set_map(gamemap.cellinfo)
                         playTime=0
                         pygame.mixer.music.unpause()
                         misswin.close() 
                   elif mainmenu.selectedm==gameState.gameWin:        #通关-返回主菜单
                         mainmenu.selectedm=gameState.gameBegin
                         misswina.close()
                         c.add(mainmenu,(SW-166)/2, 200)               
                         gamecm.reinit()
                         pygame.mixer.music.load(menumusic) 
               elif evt.key == pygame.K_F8:                        #弹出暂停窗口
                   if mainmenu.selectedm==gameState.gameRun:
                       mainmenu.selectedm=gameState.gamePause
                       pygame.mixer.music.pause()
                       pausewin.open()
                       #c.add(pausewin,(SW-500)/2, 200)
                   elif mainmenu.selectedm==gameState.gamePause:
                       mainmenu.selectedm=gameState.gameRun
                       pygame.mixer.music.unpause()
                       pausewin.close()
               elif evt.key == pygame.K_F4:                       #提示功能
                   if gamecm.hintcount>0:
                       if gamepm.search_path():
                          if gamepm.pot1!=gamepm.pot2 and gamepm.pot1!=(0,0):
                              gamecm.update_hint(-1)
                              gamemap.add_hint(gamepm.pot1)
                              gamemap.add_hint(gamepm.pot2)
                              
            if evt.type == pygame.MOUSEBUTTONDOWN and evt.button == 1:
                 if mainmenu.selectedm==gameState.gameRun:
                     update_Game()
            elif evt.type == pygame.MOUSEBUTTONUP:
                   pygame.event.set_grab(0)
                                           
            if mainmenu.selectedm!=gameState.gameRun: app.event(evt)
            
       
       if mainmenu.selectedm!=gameState.gameRun:           #非游戏进行中
           app.paint(dc)
           tmpTime=gameTime
           playTime1=(gamecm.sptime-0)
           if mainmenu.selectedm==gameState.gameBegin:
               gamemap=None
               gamepm=None
               if not pygame.mixer.music.get_busy(): pygame.mixer.music.play(-1)
           elif mainmenu.selectedm==gameState.gameEnd:  
               _quit=1
           elif mainmenu.selectedm==gameState.gameOver:          #时间超时/无生命点弹出信息窗口
               mainmenu.selectedm=gameState.gameMess
               meswin.open()
           

       elif mainmenu.selectedm==gameState.gameRun:        #游戏进行中
           if mainmenu in c.widgets: c.remove(mainmenu)
           
           if not pygame.mixer.music.get_busy():
               pygame.mixer.music.load('data/'+backmisc[miscid]+'.mid')
               pygame.mixer.music.play()
               print (miscid)
               miscid=miscid+1 
           
           if gamemap is None:
               gamemap=Imap(dc, mainmenu.diflevel,mainmenu.styleset, SW, SH)
               gamecm.reinit()
               playTime=0
           if gamepm is None:
               gamepm=PathManager(gamemap.cellinfo)
           mx,my=pygame.mouse.get_pos()
           px, py = gamemap.transPoint((mx,my))
           if gameTime>tmpTime:
                #playTime=playTime1 + gameTime - tmpTime - sprizeTime
                playTime=playTime+clock.get_time()
                #print gtt,playTime
                if clearsp==True:
                    #sprizeTime=playTime<3000 and playTime or 3000
                    if playTime<3000: 
                        sprizeTime=playTime
                    else:
                        sprizeTime=3000
                    playTime = playTime-sprizeTime
                    #print sprizeTime
                    #playTime1=(playTime-3000)>0 and (playTime1-3000) or playTime1
           if not gamecm.set_spendTime(playTime): 
               mainmenu.selectedm=gameState.gameOver
               meswin=MessageDialog(u"时间到!返回主菜单或退出程序?",psubft)
               pygame.mixer.music.stop()
           gamecm.show_gameinfo(dc)
           gamemap.draw_sprites()
           #if clearsp==True: 
           gamemap.draw_rect(px, py)
           gamemap.draw_hint(clock.get_time(), 300)   
           if clearsp==True: gamepm.draw_line(dc)    

       
       pygame.display.flip()     
       if clearsp==True:
            
            gamemap.remove_cell(gamepm.selected_cell[1])
            gamemap.remove_cell(gamepm.selected_cell[0])
            gamepm.clear_selected_cell()
            gamemap.clear_select()
            lasersnd.play()
            clearsp=False
            pygame.time.delay(150)
            gamemap.map_change(gamecm.misslv)
            spcount,sptemp=gamemap.get_spcount()
            #print spcount
            if spcount==0:  #消除完
                 gamecm.update_misslv(1)
                 if gamecm.misslv>9:      #通关
                     mainmenu.selectedm=gameState.gameWin
                     misswina.open()
                     pygame.mixer.music.stop()
                 else:                        #下一关
                     mainmenu.selectedm=gameState.gameNextmiss
                     misswin.open()
                     pygame.mixer.music.pause()
            else:
                 if not gamepm.search_path():   #没有可消除的
                     if gamecm.heart>0:
                         gamecm.update_heart(-1)
                         gamemap.refresh_map()
                     else:
                         mainmenu.selectedm=gameState.gameOver
                         meswin=MessageDialog(u"你的生命点数没有了!",psubft)
                         pygame.mixer.music.stop()
Exemplo n.º 30
0
    def __init__(self):
        self.npcSurface = pygame.Surface((16 * 32, 16 * 32))
        self.buttons = Buttons()
        self.buttons.engine = self
        self.bgBox = pygame.Rect(width / 2 - 128, height / 3 - 128, 256, 256)
        self.surfaceNormal = pygame.Surface((256, 256))
        self.surfaceNormal.fill((249, 221, 138))
        self.Facing = 0
        self.hat = 1
        self.shirt = 0
        self.shoes = 0
        self.face = 1
        self.playing = False
        self.Map = MapClass()
        self.maps = []
        self.tempImage = pygame.image.load(
            g.dataPath + "/sprites/char.png").convert_alpha()
        self.tempHatImage = pygame.image.load(
            g.dataPath + "/sprites/hat.png").convert_alpha()
        self.tempShirtImage = pygame.image.load(
            g.dataPath + "/sprites/shirt.png").convert_alpha()
        self.tempShoesImage = pygame.image.load(
            g.dataPath + "/sprites/shoes.png").convert_alpha()
        self.tempFaceImage = pygame.image.load(
            g.dataPath + "/sprites/face.png").convert_alpha()
        self.tempSprite = pygame.Surface((32, 32), pygame.SRCALPHA)
        self.tempHatSprite = pygame.Surface((32, 32), pygame.SRCALPHA)
        self.tempShirtSprite = pygame.Surface((32, 32), pygame.SRCALPHA)
        self.tempShoesSprite = pygame.Surface((32, 32), pygame.SRCALPHA)
        self.tempFaceSprite = pygame.Surface((32, 32), pygame.SRCALPHA)
        self.spriteScale = 2
        self.spriteImage = pygame.Surface(
            (TILESIZE * self.spriteScale, TILESIZE * self.spriteScale))
        self.spriteHatImage = pygame.Surface(
            (TILESIZE * self.spriteScale, TILESIZE * self.spriteScale))
        self.spriteShirtImage = pygame.Surface(
            (TILESIZE * self.spriteScale, TILESIZE * self.spriteScale))
        self.spriteShoesImage = pygame.Surface(
            (TILESIZE * self.spriteScale, TILESIZE * self.spriteScale))
        self.spriteFaceImage = pygame.Surface(
            (TILESIZE * self.spriteScale, TILESIZE * self.spriteScale))
        self.spriteImageRect = self.spriteImage.get_rect()
        self.spriteImageRect.centerx = width / 2
        self.spriteImageRect.centery = height / 3
        self.testPlay = TestPlay()
        self.testPlay.engine = self
        self.spriteButtons = charControl()
        self.spriteButtons.engine = self
        self.textarea = textarea()
        self.textarea.engine = self
        self.mapButtons = mapButtons()
        self.mapButtons.engine = self
        c = gui.Container(align=-1, valign=-1)
        c.add(self.buttons, 0, 0)
        c.add(self.spriteButtons, 0, 160 + 32)
        c.add(self.textarea, 6, 256 + 160 + 32)
        c.add(self.mapButtons, 6, 544)
        self.app = gui.App()
        self.app.init(c)
        self.updateCharSprite()
        self.tileSheets = []
        groundSheets = []
        for x in range(999):
            try:
                tmpSurface = pygame.image.load('data/tilesets/ground/' +
                                               str(x) +
                                               '.png').convert_alpha()
                groundSheets.append(
                    pygame.transform.scale(tmpSurface,
                                           (tmpSurface.get_rect().width * 2,
                                            tmpSurface.get_rect().height * 2)))
            except:
                break
        self.tileSheets.append(groundSheets)

        wallSheets = []
        for x in range(999):
            try:
                tmpSurface = pygame.image.load('data/tilesets/wall/' + str(x) +
                                               '.png').convert_alpha()
                wallSheets.append(
                    pygame.transform.scale(tmpSurface,
                                           (tmpSurface.get_rect().width * 2,
                                            tmpSurface.get_rect().height * 2)))
            except:
                break
        self.tileSheets.append(wallSheets)

        treesSheets = []
        for x in range(999):
            try:
                tmpSurface = pygame.image.load('data/tilesets/trees/' +
                                               str(x) +
                                               '.png').convert_alpha()
                treesSheets.append(
                    pygame.transform.scale(tmpSurface,
                                           (tmpSurface.get_rect().width * 2,
                                            tmpSurface.get_rect().height * 2)))
            except:
                break
        self.tileSheets.append(treesSheets)

        propsSheets = []
        for x in range(999):
            try:
                tmpSurface = pygame.image.load('data/tilesets/props/' +
                                               str(x) +
                                               '.png').convert_alpha()
                propsSheets.append(
                    pygame.transform.scale(tmpSurface,
                                           (tmpSurface.get_rect().width * 2,
                                            tmpSurface.get_rect().height * 2)))
            except:
                break
        self.tileSheets.append(propsSheets)

        buildingSheets = []
        for x in range(999):
            try:
                tmpSurface = pygame.image.load('data/tilesets/building/' +
                                               str(x) +
                                               '.png').convert_alpha()
                buildingSheets.append(
                    pygame.transform.scale(tmpSurface,
                                           (tmpSurface.get_rect().width * 2,
                                            tmpSurface.get_rect().height * 2)))
            except:
                break
        self.tileSheets.append(buildingSheets)

        otherSheets = []
        for x in range(999):
            try:
                tmpSurface = pygame.image.load('data/tilesets/other/' +
                                               str(x) +
                                               '.png').convert_alpha()
                otherSheets.append(
                    pygame.transform.scale(tmpSurface,
                                           (tmpSurface.get_rect().width * 2,
                                            tmpSurface.get_rect().height * 2)))
            except:
                break
        self.tileSheets.append(otherSheets)