def aao2pywright(self): assets = self.assets sw,sh = self.sw,self.sh settings_menu.firstpane = "saves" self.base() line = gui.pane([0,30],[sw,20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Autosave?")) class myb(gui.checkbox): def click_down_over(self,*args): super(myb,self).click_down_over(*args) if self.checked: assets.autosave = 1 else: assets.autosave = 0 wini(assets) line.children.append(myb("autosave")) cb = line.children[-1] if assets.autosave: cb.checked = True line = gui.pane([0,50],[sw,20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Minutes between autosave")) class mymin(gui.editbox): def insert(self,val): if val not in u"0123456789": return super(mymin,self).insert(val) def set(self,val): super(mymin,self).set(val) if not val: val = 0 assets.autosave_interval = int(val) wini(assets) self.autosave_interval = str(assets.autosave_interval) line.children.append(mymin(self,"autosave_interval")) line = gui.pane([0,70],[sw,20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Autosave backups")) class mye(gui.editbox): def insert(self,val): if val not in u"0123456789": return super(mye,self).insert(val) def set(self,val): super(mye,self).set(val) if not val: val = 0 assets.autosave_keep = int(val) wini(assets) self.autosave_keep = str(assets.autosave_keep) line.children.append(mye(self,"autosave_keep"))
def debug(self): assets = self.assets sw,sh = self.sw,self.sh settings_menu.firstpane = "debug" self.base() line = gui.pane([0,30],[sw,20]) line.align = "horiz" self.children.append(line) self.go_script = "" line.children.append(gui.editbox(self,"go_script")) class myb(gui.button): def click_down_over(s,*args): assets.cur_script.safe_exec(assets.cur_script.execute_line,self.go_script) self.close() line.children.append(myb(None,"execute")) line = gui.pane([0,50],[sw,20]) line.align = "horiz" self.children.append(line) class myb(gui.button): def click_down_over(s,*args): print "debugging game" s = assets.DebugScript() s.debug_game("current","run") print "finished" line.children.append(myb(None,"Debug current script")) line = gui.pane([0,70],[sw,20]) line.align = "horiz" self.children.append(line) class myb(gui.button): def click_down_over(s,*args): print "debugging game" s = assets.DebugScript() s.debug_game("all","run") print "finished" line.children.append(myb(None,"Debug entire game (slow)")) line = gui.pane([0,90],[sw,20]) line.align = "horiz" self.children.append(line) class myb(gui.button): def click_down_over(s,*args): print "debugging game" s = assets.DebugScript() s.debug_game("all","quote") print "finished" line.children.append(myb(None,"Find quote errors"))
def apply(self): assets = self.assets sw,sh = self.sw,self.sh for r in self.reses: if r.checked: self.oldwidth,self.oldheight = assets.swidth,assets.sheight self.timer = 5.0 self.really_applyb = gui.pane() self.really_applyb.is_applyb = True self.really_applyb.width = 1000 self.really_applyb.height = 1000 self.really_applyb.pri = -1002 self.really_applyb.z = 11002 #self.really_applyb.align = False e = gui.editbox(None,"") e.draw_back = False self.really_applyb.children.append(e) self.really_applyb.timer = e b = gui.button(self,"save_resolution",[0,0]) self.really_applyb.children.append(b) assets.cur_script.obs.append(self.really_applyb) assets.swidth,assets.sheight = [int(x) for x in (r.text[r.text.find("(")+1:r.text.find(")")]).split("x")] self.old_fullscreen = assets.fullscreen assets.fullscreen = 0 if self.fs.checked: assets.fullscreen = 1 self.old_num_screens = assets.num_screens assets.num_screens = 1 if self.ds.checked: assets.num_screens = 2 assets.screen_compress = 1 if self.vds.checked: assets.screen_compress = 0 assets.smoothscale = 0 if self.smoothscale.checked: assets.smoothscale = 1 assets.make_screen() self.display() wini(assets)
def apply(self): assets = self.assets sw, sh = self.sw, self.sh for r in self.screens: if r.checked: assets.screen_mode = r.text for r in self.reses: if r.checked: self.oldwidth, self.oldheight = assets.swidth, assets.sheight self.timer = 5.0 self.really_applyb = gui.pane() self.really_applyb.is_applyb = True self.really_applyb.width = 1000 self.really_applyb.height = 1000 self.really_applyb.pri = -1002 self.really_applyb.z = 11002 #self.really_applyb.align = False e = gui.editbox(None, "") e.draw_back = False self.really_applyb.children.append(e) self.really_applyb.timer = e b = gui.button(self, "save_resolution", [0, 0]) self.really_applyb.children.append(b) assets.cur_script.obs.append(self.really_applyb) assets.swidth, assets.sheight = [ int(x) for x in (r.text[r.text.find("(") + 1:r.text.find(")")]).split("x") ] self.old_fullscreen = assets.fullscreen assets.fullscreen = 0 if self.fs.checked: assets.fullscreen = 1 self.old_num_screens = assets.num_screens assets.smoothscale = 0 if self.smoothscale.checked: assets.smoothscale = 1 assets.make_screen() self.display() wini(assets)
def sound(self): assets = self.assets sw,sh = self.sw,self.sh settings_menu.firstpane = "sound" self.base() ermsg = gui.label("") ermsg.rpos = [0,140] ermsg.textcol = [255,0,0] line = gui.pane([0,130],[sw,20]) line.align = "horiz" self.children.append(line) class myb(gui.checkbox): def click_down_over(self,*args): super(myb,self).click_down_over(*args) if self.checked: assets.set_mute_sound(True) else: assets.set_mute_sound(False) line.children.append(myb("mute sound")) if assets.mute_sound: line.children[-1].checked = True if android: return line = gui.pane([0,30],[sw,20]) line.align = "horiz" self.children.append(line) class newr(gui.radiobutton): def click_down_over(s,*args): ermsg.text = "" gui.radiobutton.click_down_over(s,*args) assets.sound_format = int(s.text) if not assets.init_sound(True): ermsg.text = "Sound not initialized" else: assets.play_sound("phoenix/objection.ogg") wini(assets) line.children.append(gui.label("Format:")) line.children.append(newr("11025","formchoice")) line.children.append(newr("22050","formchoice")) line.children.append(newr("44100","formchoice")) for t in line.children: if t.text==str(assets.sound_format): t.checked = True line = gui.pane([0,50],[sw,20]) line.align = "horiz" self.children.append(line) class newr(gui.radiobutton): def click_down_over(s,*args): ermsg.text = "" gui.radiobutton.click_down_over(s,*args) assets.sound_bits = int(s.text) if not assets.init_sound(True): ermsg.text = "Sound not initialized" else: assets.play_sound("phoenix/objection.ogg") wini(assets) line.children.append(gui.label("Bits:")) line.children.append(newr("8","bitschoice")) line.children.append(newr("16","bitschoice")) for t in line.children: if t.text==str(assets.sound_bits): t.checked = True line = gui.pane([0,70],[sw,20]) line.align = "horiz" self.children.append(line) class newr(gui.radiobutton): def click_down_over(s,*args): ermsg.text = "" gui.radiobutton.click_down_over(s,*args) assets.sound_buffer = int(s.text) if not assets.init_sound(True): ermsg.text = "Sound not initialized" else: assets.play_sound("phoenix/objection.ogg") wini(assets) line.children.append(gui.label("Buffer:")) line.children.append(newr("512","bufchoice")) line.children.append(newr("1024","bufchoice")) line.children.append(newr("2048","bufchoice")) line.children.append(newr("4096","bufchoice")) for t in line.children: if t.text==str(assets.sound_buffer): t.checked = True line = gui.pane([0,90],[sw,20]) line.align = "horiz" self.children.append(line) self.snd_line = gui.label("SoundVolume: %d"%assets.sound_volume) def mod(amt,min,max,var,play): def modit(): ermsg.text = "" if not assets.init_sound(): ermsg.text = "Sound not initialized" else: n = getattr(assets,var) + amt if n>max: n = max if n<min: n=min setattr(assets,var,n) self.snd_line.text = "SoundVolume: %d"%assets.sound_volume self.mv_line.text = "MusicVolume: %d"%assets.music_volume play() wini(assets) return modit line.children.append(self.snd_line) line.children.append(gui.button(None,"less")) line.children[-1].less = mod(-10,0,100,"sound_volume",lambda:assets.play_sound("phoenix/objection.ogg")) line.children.append(gui.button(None,"more")) line.children[-1].more = mod(10,0,100,"sound_volume",lambda:assets.play_sound("phoenix/objection.ogg")) line = gui.pane([0,110],[sw,20]) line.align = "horiz" self.children.append(line) self.mv_line = gui.label("MusicVolume: %d"%assets.music_volume) line.children.append(self.mv_line) line.children.append(gui.button(None,"less")) line.children[-1].less = mod(-10,0,100,"music_volume",lambda:assets.play_music("Ding.ogg",loop=1,pre="data/sfx/",reset_track=False)) line.children.append(gui.button(None,"more")) line.children[-1].more = mod(10,0,100,"music_volume",lambda:assets.play_music("Ding.ogg",loop=1,pre="data/sfx/",reset_track=False)) self.children.append(ermsg)
def saves(self): assets = self.assets sw,sh = self.sw,self.sh settings_menu.firstpane = "saves" self.base() line = gui.pane([0,30],[sw,20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Autosave?")) class myb(gui.checkbox): def click_down_over(self,*args): super(myb,self).click_down_over(*args) if self.checked: assets.autosave = 1 else: assets.autosave = 0 wini(assets) line.children.append(myb("autosave")) cb = line.children[-1] if assets.autosave: cb.checked = True line = gui.pane([0,50],[sw,20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Minutes between autosave")) class mymin(gui.editbox): def insert(self,val): if val not in u"0123456789": return super(mymin,self).insert(val) def set(self,val): super(mymin,self).set(val) if not val: val = 0 assets.autosave_interval = int(val) wini(assets) self.autosave_interval = str(assets.autosave_interval) line.children.append(mymin(self,"autosave_interval")) line = gui.pane([0,70],[sw,20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Autosave backups")) class mye(gui.editbox): def insert(self,val): if val not in u"0123456789": return super(mye,self).insert(val) def set(self,val): super(mye,self).set(val) if not val: val = 0 assets.autosave_keep = int(val) wini(assets) self.autosave_keep = str(assets.autosave_keep) line.children.append(mye(self,"autosave_keep")) line = gui.pane([0,90],[sw,20]) line.align = "horiz" self.children.append(line) if not assets.variables.get("_allow_saveload","true"): line.children.append(gui.label("Save/Load currently disabled by game")) else: line.children.append(gui.label("Save/Load")) line.children.append(gui.button(self,"save_game")) line.children.append(gui.button(self,"load_game"))
def debug(self): assets = self.assets sw,sh = self.sw,self.sh settings_menu.firstpane = "debug" self.base() #Create debug mode option if we aren't running a game if assets.game == "games": line = gui.pane([0,90],[sw,20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Debug mode?")) class myb(gui.checkbox): def click_down_over(self,*args): super(myb,self).click_down_over(*args) if self.checked: assets.debug_mode = True else: assets.debug_mode = False line.children.append(myb("debug_mode")) cb = line.children[-1] if assets.debug_mode: cb.checked = True return line = gui.pane([0,30],[sw,20]) line.align = "horiz" self.children.append(line) self.go_script = "" line.children.append(gui.editbox(self,"go_script")) class myb(gui.button): def click_down_over(s,*args): assets.cur_script.safe_exec(assets.cur_script.execute_line,self.go_script) self.close() line.children.append(myb(None,"execute")) line = gui.pane([0,50],[sw,20]) line.align = "horiz" self.children.append(line) class myb(gui.button): def click_down_over(s,*args): print "debugging game" s = assets.DebugScript() s.debug_game("current","run") print "finished" line.children.append(myb(None,"Debug current script")) line = gui.pane([0,70],[sw,20]) line.align = "horiz" self.children.append(line) class myb(gui.button): def click_down_over(s,*args): print "debugging game" s = assets.DebugScript() s.debug_game("all","run") print "finished" line.children.append(myb(None,"Debug entire game (slow)")) line = gui.pane([0,90],[sw,20]) line.align = "horiz" self.children.append(line) class myb(gui.button): def click_down_over(s,*args): print "debugging game" s = assets.DebugScript() s.debug_game("all","quote") print "finished" line.children.append(myb(None,"Find quote errors")) line = gui.pane([0,110],[sw,20]) line.align = "horiz" self.children.append(line) class newr(gui.radiobutton): def click_down_over(s,*args): gui.radiobutton.click_down_over(s,*args) assets.game_speed = int(s.text) line.children.append(gui.label("Game speed")) line.children.append(newr("1","gamespeed")) line.children.append(newr("2","gamespeed")) line.children.append(newr("6","gamespeed")) for t in line.children: if t.text==str(assets.game_speed): t.checked = True
def aao2pywright(self): assets = self.assets sw, sh = self.sw, self.sh settings_menu.firstpane = "saves" self.base() line = gui.pane([0, 30], [sw, 20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Autosave?")) class myb(gui.checkbox): def click_down_over(self, *args): super(myb, self).click_down_over(*args) if self.checked: assets.autosave = 1 else: assets.autosave = 0 wini(assets) line.children.append(myb("autosave")) cb = line.children[-1] if assets.autosave: cb.checked = True line = gui.pane([0, 50], [sw, 20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Minutes between autosave")) class mymin(gui.editbox): def insert(self, val): if val not in u"0123456789": return super(mymin, self).insert(val) def set(self, val): super(mymin, self).set(val) if not val: val = 0 assets.autosave_interval = int(val) wini(assets) self.autosave_interval = str(assets.autosave_interval) line.children.append(mymin(self, "autosave_interval")) line = gui.pane([0, 70], [sw, 20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Autosave backups")) class mye(gui.editbox): def insert(self, val): if val not in u"0123456789": return super(mye, self).insert(val) def set(self, val): super(mye, self).set(val) if not val: val = 0 assets.autosave_keep = int(val) wini(assets) self.autosave_keep = str(assets.autosave_keep) line.children.append(mye(self, "autosave_keep"))
def sound(self): assets = self.assets sw, sh = self.sw, self.sh settings_menu.firstpane = "sound" self.base() ermsg = gui.label("") ermsg.rpos = [0, 140] ermsg.textcol = [255, 0, 0] line = gui.pane([0, 130], [sw, 20]) line.align = "horiz" self.children.append(line) class myb(gui.checkbox): def click_down_over(self, *args): super(myb, self).click_down_over(*args) if self.checked: assets.set_mute_sound(True) else: assets.set_mute_sound(False) line.children.append(myb("mute sound")) if assets.mute_sound: line.children[-1].checked = True if android: return line = gui.pane([0, 30], [sw, 20]) line.align = "horiz" self.children.append(line) class newr(gui.radiobutton): def click_down_over(s, *args): ermsg.text = "" gui.radiobutton.click_down_over(s, *args) assets.sound_format = int(s.text) if not assets.init_sound(True): ermsg.text = "Sound not initialized" else: assets.play_sound("phoenix/objection.ogg") wini(assets) line.children.append(gui.label("Format:")) line.children.append(newr("11025", "formchoice")) line.children.append(newr("22050", "formchoice")) line.children.append(newr("44100", "formchoice")) for t in line.children: if t.text == str(assets.sound_format): t.checked = True line = gui.pane([0, 50], [sw, 20]) line.align = "horiz" self.children.append(line) class newr(gui.radiobutton): def click_down_over(s, *args): ermsg.text = "" gui.radiobutton.click_down_over(s, *args) assets.sound_bits = int(s.text) if not assets.init_sound(True): ermsg.text = "Sound not initialized" else: assets.play_sound("phoenix/objection.ogg") wini(assets) line.children.append(gui.label("Bits:")) line.children.append(newr("8", "bitschoice")) line.children.append(newr("16", "bitschoice")) for t in line.children: if t.text == str(assets.sound_bits): t.checked = True line = gui.pane([0, 70], [sw, 20]) line.align = "horiz" self.children.append(line) class newr(gui.radiobutton): def click_down_over(s, *args): ermsg.text = "" gui.radiobutton.click_down_over(s, *args) assets.sound_buffer = int(s.text) if not assets.init_sound(True): ermsg.text = "Sound not initialized" else: assets.play_sound("phoenix/objection.ogg") wini(assets) line.children.append(gui.label("Buffer:")) line.children.append(newr("512", "bufchoice")) line.children.append(newr("1024", "bufchoice")) line.children.append(newr("2048", "bufchoice")) line.children.append(newr("4096", "bufchoice")) for t in line.children: if t.text == str(assets.sound_buffer): t.checked = True line = gui.pane([0, 90], [sw, 20]) line.align = "horiz" self.children.append(line) self.snd_line = gui.label("SoundVolume: %d" % assets.sound_volume) def mod(amt, min, max, var, play): def modit(): ermsg.text = "" if not assets.init_sound(): ermsg.text = "Sound not initialized" else: n = getattr(assets, var) + amt if n > max: n = max if n < min: n = min setattr(assets, var, n) self.snd_line.text = "SoundVolume: %d" % assets.sound_volume self.mv_line.text = "MusicVolume: %d" % assets.music_volume play() wini(assets) return modit line.children.append(self.snd_line) line.children.append(gui.button(None, "less")) line.children[-1].less = mod( -10, 0, 100, "sound_volume", lambda: assets.play_sound("phoenix/objection.ogg")) line.children.append(gui.button(None, "more")) line.children[-1].more = mod( 10, 0, 100, "sound_volume", lambda: assets.play_sound("phoenix/objection.ogg")) line = gui.pane([0, 110], [sw, 20]) line.align = "horiz" self.children.append(line) self.mv_line = gui.label("MusicVolume: %d" % assets.music_volume) line.children.append(self.mv_line) line.children.append(gui.button(None, "less")) line.children[-1].less = mod( -10, 0, 100, "music_volume", lambda: assets.play_music( "Ding.ogg", loop=1, pre="sfx/", reset_track=False)) line.children.append(gui.button(None, "more")) line.children[-1].more = mod( 10, 0, 100, "music_volume", lambda: assets.play_music( "Ding.ogg", loop=1, pre="sfx/", reset_track=False)) self.children.append(ermsg)
def saves(self): assets = self.assets sw, sh = self.sw, self.sh settings_menu.firstpane = "saves" self.base() line = gui.pane([0, 30], [sw, 20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Autosave?")) class myb(gui.checkbox): def click_down_over(self, *args): super(myb, self).click_down_over(*args) if self.checked: assets.autosave = 1 else: assets.autosave = 0 wini(assets) line.children.append(myb("autosave")) cb = line.children[-1] if assets.autosave: cb.checked = True line = gui.pane([0, 50], [sw, 20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Minutes between autosave")) class mymin(gui.editbox): def insert(self, val): if val not in u"0123456789": return super(mymin, self).insert(val) def set(self, val): super(mymin, self).set(val) if not val: val = 0 assets.autosave_interval = int(val) wini(assets) self.autosave_interval = str(assets.autosave_interval) line.children.append(mymin(self, "autosave_interval")) line = gui.pane([0, 70], [sw, 20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Autosave backups")) class mye(gui.editbox): def insert(self, val): if val not in u"0123456789": return super(mye, self).insert(val) def set(self, val): super(mye, self).set(val) if not val: val = 0 assets.autosave_keep = int(val) wini(assets) self.autosave_keep = str(assets.autosave_keep) line.children.append(mye(self, "autosave_keep")) line = gui.pane([0, 90], [sw, 20]) line.align = "horiz" self.children.append(line) if not assets.variables.get("_allow_saveload", "true"): line.children.append( gui.label("Save/Load currently disabled by game")) else: line.children.append(gui.label("Save/Load")) line.children.append(gui.button(self, "save_game")) line.children.append(gui.button(self, "load_game"))
def debug(self): assets = self.assets sw, sh = self.sw, self.sh settings_menu.firstpane = "debug" self.base() #Create debug mode option if we aren't running a game if assets.game == "games": line = gui.pane([0, 90], [sw, 20]) line.align = "horiz" self.children.append(line) line.children.append(gui.label("Debug mode?")) class myb(gui.checkbox): def click_down_over(self, *args): super(myb, self).click_down_over(*args) if self.checked: assets.debug_mode = True else: assets.debug_mode = False line.children.append(myb("debug_mode")) cb = line.children[-1] if assets.debug_mode: cb.checked = True return line = gui.pane([0, 30], [sw, 20]) line.align = "horiz" self.children.append(line) self.go_script = "" line.children.append(gui.editbox(self, "go_script")) class myb(gui.button): def click_down_over(s, *args): assets.cur_script.safe_exec(assets.cur_script.execute_line, self.go_script) self.close() line.children.append(myb(None, "execute")) line = gui.pane([0, 50], [sw, 20]) line.align = "horiz" self.children.append(line) class myb(gui.button): def click_down_over(s, *args): print "debugging game" s = assets.DebugScript() s.debug_game("current", "run") print "finished" line.children.append(myb(None, "Debug current script")) line = gui.pane([0, 70], [sw, 20]) line.align = "horiz" self.children.append(line) class myb(gui.button): def click_down_over(s, *args): print "debugging game" s = assets.DebugScript() s.debug_game("all", "run") print "finished" line.children.append(myb(None, "Debug entire game (slow)")) line = gui.pane([0, 90], [sw, 20]) line.align = "horiz" self.children.append(line) class myb(gui.button): def click_down_over(s, *args): print "debugging game" s = assets.DebugScript() s.debug_game("all", "quote") print "finished" line.children.append(myb(None, "Find quote errors")) line = gui.pane([0, 110], [sw, 20]) line.align = "horiz" self.children.append(line) class newr(gui.radiobutton): def click_down_over(s, *args): gui.radiobutton.click_down_over(s, *args) assets.game_speed = int(s.text) line.children.append(gui.label("Game speed")) line.children.append(newr("1", "gamespeed")) line.children.append(newr("2", "gamespeed")) line.children.append(newr("6", "gamespeed")) for t in line.children: if t.text == str(assets.game_speed): t.checked = True