def ymlShowBattleScreen(self, attacker, region): index = SYAML.createWindow("./data/layouts/battle.yml")[0] # turn off unit animations SGFX.gui.pauseFlashing() # setup dirty rect stuff SGFX.gui.addDirtyRect(SGFX.gui.windows[index].drawWindow(), SGFX.gui.windows[index].rect) return True
def widgetTest(handle, xpos, ypos): index = SYAML.createWindow("./data/layouts/widget_test.yml")[0] SGFX.gui.keyboard.addKey(K_q, killModalWindow) SGFX.gui.keyboard.addKey(K_RETURN, killModalWindow) SGFX.gui.keyboard.setModalKeys(2) # turn off unit animations for the moment and thats it SGFX.gui.pauseFlashing() # add the dirty rect details SGFX.gui.addDirtyRect(SGFX.gui.windows[index].drawWindow(), SGFX.gui.windows[index].rect) return True
def menuPreferences(handle, xpos, ypos): """Display the user preferences window. You can only really play with the music and volume settings for now""" index = SYAML.createWindow("./data/layouts/menu_pref.yml")[0] # add the new key event: o = ok SGFX.gui.keyboard.addKey(K_o, killModalWindow) SGFX.gui.keyboard.setModalKeys(1) # turn off unit animations SGFX.gui.pauseFlashing() # setup dirty rect stuff SGFX.gui.addDirtyRect(SGFX.gui.windows[index].drawWindow(), SGFX.gui.windows[index].rect) return True
def windowTest(handle, xpos, ypos): """Routine to test whatever the latest version of the window code is. Does nothing clever really""" # get the window from a yaml file and this returns a list of indexes # incase we import more than 1 window we get their indexes # here we have 1 window so we get the first index index = SYAML.createWindow("./data/layouts/window_test.yml")[0] # we have to add modal keypresses ourselves SGFX.gui.keyboard.setModalKeys(1) # turn off unit animations SGFX.gui.pauseFlashing() # add the window as a dirty image win_img = SGFX.gui.windows[index].drawWindow() SGFX.gui.addDirtyRect(win_img, SGFX.gui.windows[index].rect) return True
def windowTest(handle, xpos, ypos): """Routine to test whatever the latest version of the window code is. Does nothing clever really""" # get the window from a yaml file and this returns a list of indexes # incase we import more than 1 window we get their indexes # here we have 1 window so we get the first index index = SYAML.createWindow("../data/layouts/window_test.yml")[0] SGFX.gui.windows[index].modal = True # we have to add modal keypresses ourselves SGFX.gui.keyboard.setModalKeys(1) # turn off unit animations SGFX.gui.unitFlashAndOff() # add the window as a dirty image win_img = SGFX.gui.windows[index].drawWindow() SGFX.gui.addDirtyRect(win_img, SGFX.gui.windows[index].rect) return True
def welcomeScreen(handle, xpos, ypos): """Routine displays opening screen, with load/save/new/about buttons. Always returns True after doing it's work""" index = SYAML.createWindow("./data/layouts/welcome.yml")[0] # add the modal key events: n=new, l=load, o=options, a=about, q=quit SGFX.gui.keyboard.addKey(K_n, startGame) SGFX.gui.keyboard.addKey(K_l, menuLoad) SGFX.gui.keyboard.addKey(K_o, menuPreferences) SGFX.gui.keyboard.addKey(K_a, menuHelpAbout) SGFX.gui.keyboard.addKey(K_q, quitSpqr) SGFX.gui.keyboard.setModalKeys(5) # turn off unit animations #SGFX.gui.pauseFlashing() # add the window as a dirty image SGFX.gui.addDirtyRect(SGFX.gui.windows[index].drawWindow(), SGFX.gui.windows[index].rect) return True