def init_actions(self): actions = None if isinstance(CONST.actions, CONST.string_type): actions = load_json(CONST.actions) elif isinstance(CONST.actions, dict): actions = CONST.actions else: log("Error: could not load actions, Undefined type: "+str(type(CONST.actions)), 1) return for key in actions.items(): log(key) add_button(key[0], key[1])
def loop(self): add_button('quit', ['LCTRL+q']) add_button('reset', ['r']) while not self.finish: self.pre_update() update_event() self.finish = get_button('quit') f = level_manager.update_level() if f == 0: log("No scene loaded",1) break else: f(self.screen) if get_button('reset'): from levels.gamestate import GameState level_manager.switch_level(GameState(CONST.startup)) self.post_update()
def load_key_json(key_json): if key_json: for key in key_json.items(): add_button(key[0],key[1])
def __init__(self): add_button('editor', 'LCTRL+e') self.editor_click = False self.editor = False self.text_size = 50 self.mouse_clicked = (0, 0, 0) self.current_selected = None self.scale_clicked = (0, 0) #red, enlarg self.save_clicked = False add_button('scale_y_down', ['DOWN']) add_button('scale_y_up', ['UP']) add_button('scale_x_down', ['LEFT']) add_button('scale_x_up', ['RIGHT']) add_button('angle_up',['a']) add_button('angle_down',['d']) add_button('save', ['LCTRL+s']) add_button('box',['LCTRL']) self.new_obj = None self.new_obj_pos = Vector2() self.obj_init_pos = Vector2() self.mouse_init_pos = Vector2() '''GUI''' self.gui_editor_mode = Text(Vector2(0, engine.get_screen_size().y-2*self.text_size), self.text_size, "data/font/pixel_arial.ttf", "Editor mode", relative=True) self.gui_current_selected = Text(Vector2(0, engine.get_screen_size().y-self.text_size), self.text_size, "data/font/pixel_arial.ttf", "",relative=True) self.gui_saved = Text(Vector2(0,0), self.text_size, "data/font/pixel_arial.ttf", "Saved",relative=True)