def __init__(self, ns): adonthell.win_container.__init__(self) self.namespace = ns self.history = [] self.hist_idx = 0 # read the old history self.read_history() self.py_signal_connect(self.on_update, adonthell.win_event_UPDATE) # -- get font and theme self.font = adonthell.win_manager_get_font("silverleaf") self.theme = adonthell.win_manager_get_theme("silverleaf") self.move(10, 150) self.resize(300, 80) self.set_border(self.theme) self.set_background(self.theme) self.set_trans_background(1) self.info = adonthell.win_label() self.info.thisown = 0 self.info.move(5, 5) self.info.resize(290, 15) self.info.set_cursor_visible(0) self.info.set_cursor_moveable(0) self.info.set_font(adonthell.win_manager_get_font("blue")) self.info.set_text("Python console (type 'quit' to exit)") self.info.pack() self.entry = adonthell.win_write() self.entry.thisown = 0 self.entry.py_signal_connect(self.on_execute, adonthell.win_event_ACTIVATE_KEY) self.entry.move(5, 20) self.entry.resize(290, 55) # -- causes a crash: # self.entry.set_form (label_AUTO_HEIGHT) self.entry.set_font(self.font) self.entry.set_cursor_visible(1) self.entry.set_cursor_moveable(1) self.entry.set_text("") self.entry.pack() self.add(self.info) self.add(self.entry) self.set_focus_object(self.entry) self.set_visible_background(1) self.set_visible_border(1) self.set_visible_all(1) self.set_activate(1) self.entry.set_focus(1) self.entry.set_activate(1)
def __init__(self): adonthell.win_container.__init__(self) # -- get font and theme self.font = adonthell.win_manager_get_font("original") self.theme = adonthell.win_manager_get_theme("original") self.move(60, 55) self.resize(200, 110) self.set_border(self.theme) self.set_background(self.theme) self.set_trans_background(1) # -- The window title self.title = adonthell.win_label() self.title.thisown = 0 self.title.resize(0, 20) self.title.set_font(self.font) self.title.set_form(adonthell.label_AUTO_SIZE) self.title.set_text(_("Enter your character's name")) self.title.pack() self.title.move((self.length() - self.title.length()) / 2, 10) # -- The character image self.image = adonthell.win_image() self.image.thisown = 0 self.image.move(10, 35) self.image.resize(64, 64) self.image.load_pnm("gfx/portraits/player.pnm") self.image.set_mask(1) self.image.pack() # -- The text entry self.entry = adonthell.win_write() self.entry.thisown = 0 self.entry.py_signal_connect(self.on_enter, adonthell.win_event_ACTIVATE_KEY) self.entry.move(90, 62) self.entry.resize(100, 20) self.entry.set_font(self.font) self.entry.set_cursor_visible(1) self.entry.set_cursor_moveable(1) self.entry.set_text("Banec") self.entry.pack() self.add(self.title) self.add(self.image) self.add(self.entry) self.set_focus_object(self.entry) self.set_visible_background(1) self.set_visible_border(1) self.set_visible_all(1) self.set_activate(1) self.entry.set_focus(1) self.entry.set_activate(1)
def __init__(self, ns): adonthell.win_container.__init__(self) self.namespace = ns self.history = [] self.hist_idx = 0 # read the old history self.read_history () self.py_signal_connect (self.on_update, adonthell.win_event_UPDATE) # -- get font and theme self.font = adonthell.win_manager_get_font ("silverleaf") self.theme = adonthell.win_manager_get_theme ("silverleaf") self.move (10, 150) self.resize (300, 80) self.set_border (self.theme) self.set_background (self.theme) self.set_trans_background (1) self.info = adonthell.win_label () self.info.thisown = 0 self.info.move (5, 5) self.info.resize (290, 15) self.info.set_cursor_visible (0) self.info.set_cursor_moveable (0) self.info.set_font (adonthell.win_manager_get_font ("blue")) self.info.set_text ("Python console (type 'quit' to exit)") self.info.pack () self.entry = adonthell.win_write () self.entry.thisown = 0 self.entry.py_signal_connect (self.on_execute, adonthell.win_event_ACTIVATE_KEY) self.entry.move (5, 20) self.entry.resize (290, 55) # -- causes a crash: # self.entry.set_form (label_AUTO_HEIGHT) self.entry.set_font (self.font) self.entry.set_cursor_visible (1) self.entry.set_cursor_moveable (1) self.entry.set_text ("") self.entry.pack () self.add (self.info) self.add (self.entry) self.set_focus_object (self.entry) self.set_visible_background (1); self.set_visible_border (1); self.set_visible_all (1); self.set_activate (1) self.entry.set_focus (1) self.entry.set_activate (1)
def __init__(self): adonthell.win_container.__init__(self) # -- get font and theme self.font = adonthell.win_manager_get_font ("original") self.theme = adonthell.win_manager_get_theme ("original") self.move (60, 55) self.resize (200, 110) self.set_border (self.theme) self.set_background (self.theme) self.set_trans_background (1) # -- The window title self.title = adonthell.win_label () self.title.thisown = 0 self.title.resize (0, 20) self.title.set_font (self.font) self.title.set_form (adonthell.label_AUTO_SIZE) self.title.set_text (_("Enter your character's name")) self.title.pack () self.title.move ((self.length () - self.title.length ())/2, 10) # -- The character image self.image = adonthell.win_image () self.image.thisown = 0 self.image.move (10, 35) self.image.resize (64, 64) self.image.load_pnm ("gfx/portraits/player.pnm") self.image.set_mask (1) self.image.pack () # -- The text entry self.entry = adonthell.win_write () self.entry.thisown = 0 self.entry.py_signal_connect (self.on_enter, adonthell.win_event_ACTIVATE_KEY) self.entry.move (90, 62) self.entry.resize (100, 20) self.entry.set_font (self.font) self.entry.set_cursor_visible (1) self.entry.set_cursor_moveable (1) self.entry.set_text ("Banec") self.entry.pack () self.add (self.title) self.add (self.image) self.add (self.entry) self.set_focus_object (self.entry) self.set_visible_background (1) self.set_visible_border (1) self.set_visible_all (1) self.set_activate (1) self.entry.set_focus (1) self.entry.set_activate (1)
def make_credit_label(self, ypos): if self.index > 0: ypos = ypos + (self.credits[self.index - 1][1] - 1) * 14 label = adonthell.win_label() label.resize(10, 0) label.set_font(adonthell.win_manager_get_font("white")) label.set_align(adonthell.win_base_ALIGN_CENTER) label.set_form(adonthell.label_AUTO_SIZE) label.set_text(self.credits[self.index][0]) label.move(label.x(), ypos) label.set_visible(1) label.thisown = 0 label.pack() self.labels.append(label) self.window.add(label) self.index = self.index + 1
def make_credit_label (self, ypos): if self.index > 0: ypos = ypos + (self.credits[self.index - 1][1] - 1) * 14 label = adonthell.win_label () label.resize (10, 0) label.set_font (adonthell.win_manager_get_font ("white")) label.set_align (adonthell.win_base_ALIGN_CENTER) label.set_form (adonthell.label_AUTO_SIZE) label.set_text (self.credits[self.index][0]) label.move (label.x (), ypos) label.set_visible (1) label.thisown = 0 label.pack () self.labels.append (label) self.window.add (label) self.index = self.index + 1
def __init__(self): adonthell.win_container.__init__(self) self.py_signal_connect (self.on_update, adonthell.win_event_UPDATE) self.state = 1 # -- get font and theme self.font = adonthell.win_manager_get_font ("original") self.theme = adonthell.win_manager_get_theme ("original") self.move (58, 75) self.resize (205, 70) self.set_border (self.theme, adonthell.win_border_MINI) self.set_background (self.theme) self.set_trans_background (1) # -- The window text self.text = adonthell.win_label () self.text.thisown = 0 self.text.resize (120, 0) self.text.set_font (self.font) self.text.set_form (adonthell.label_AUTO_HEIGHT) self.text.set_text (_("Upon opening the chest, a small green something catches your attention ...")) self.text.pack () self.text.move (80, (self.height () - self.text.height ())/2) # -- The character image self.image = adonthell.win_image () self.image.thisown = 0 self.image.move (10, 3) self.image.resize (64, 64) self.image.load_pnm ("gfx/cutscene/gem.pnm") self.image.set_mask (1) self.image.pack () self.add (self.text) self.add (self.image) self.set_visible_background (1) self.set_visible_border (1) self.set_visible_all (1)
def fade_to_forest(self): # -- drawing area self.da = adonthell.drawing_area() self.da.resize(adonthell.screen_length(), adonthell.screen_height()) self.da.move(0, 0) # -- load images self.wood1 = adonthell.image() self.wood1.load_raw("gfx/cutscene/forest3.img") self.wood2 = adonthell.image() self.wood2.load_raw("gfx/cutscene/forest2.img") self.wood2.set_mask(1) self.wood3 = adonthell.image() self.wood3.load_raw("gfx/cutscene/forest1.img") self.wood3.set_mask(1) self.alek_run = adonthell.animation() self.alek_run.load("gfx/cutscene/running_alek.anim") self.alek_run.play() self.black = adonthell.win_image() self.black.resize(320, 240) self.black.fillrect(0, 0, 320, 240, 0) self.black.thisown = 0 self.black.pack() # -- label self.label = adonthell.win_label() self.label.set_font(adonthell.win_manager_get_font("white")) self.label.resize(240, 90) self.label.move(40, 30) self.label.thisown = 0 self.label.pack() # -- window self.window = adonthell.win_container() self.window.move(0, 0) self.window.resize(320, 240) self.window.set_visible_border(0) self.window.set_trans_background(1) self.window.add(self.black) self.window.add(self.label) self.window.set_activate(1) self.window.set_visible_all(1) # -- audio adonthell.audio_fade_out_background(500) # -- misc stuff self.step = 0 # -- for the extro control self.a1 = 0 self.a2 = 0 self.a3 = 0 # -- for the forest animation control self.index = 0 # -- index in the typeover array self.delay = 0 # -- delay before adding new text self.cursor = 0 # -- cursor in the typeover text self.x = [0, 0, 0] # -- offsets of the 3 forest pics and Alek adonthell.gamedata_engine().set_update_map(0) self.letsexit = 0 adonthell.gametime_update() while self.letsexit != 1: for i in range(0, adonthell.gametime_frames_to_skip()): self.forest_animation() self.alek_run.update() self.window.update() adonthell.gametime_update() if self.letsexit != 1: self.window.draw() adonthell.screen_show() adonthell.gamedata_engine().main(self.window, 'fmv') # -- quit! adonthell.audio_fade_out_background(500) adonthell.gamedata_engine().main_quit()
def fade_to_forest (self): # -- drawing area self.da = adonthell.drawing_area () self.da.resize (adonthell.screen_length (), adonthell.screen_height ()) self.da.move (0, 0) # -- load images self.wood1 = adonthell.image () self.wood1.load_raw ("gfx/cutscene/forest3.img") self.wood2 = adonthell.image () self.wood2.load_raw ("gfx/cutscene/forest2.img") self.wood2.set_mask (1) self.wood3 = adonthell.image () self.wood3.load_raw ("gfx/cutscene/forest1.img") self.wood3.set_mask (1) self.alek_run = adonthell.animation () self.alek_run.load ("gfx/cutscene/running_alek.anim") self.alek_run.play () self.black = adonthell.win_image () self.black.resize (320, 240) self.black.fillrect (0, 0, 320, 240, 0) self.black.thisown = 0 self.black.pack () # -- label self.label = adonthell.win_label () self.label.set_font (adonthell.win_manager_get_font ("white")) self.label.resize (240, 90) self.label.move (40, 30) self.label.thisown = 0 self.label.pack () # -- window self.window = adonthell.win_container () self.window.move (0, 0) self.window.resize (320, 240) self.window.set_visible_border (0) self.window.set_trans_background (1) self.window.add (self.black) self.window.add (self.label) self.window.set_activate (1) self.window.set_visible_all (1) # -- audio adonthell.audio_fade_out_background (500) # -- misc stuff self.step = 0 # -- for the extro control self.a1 = 0 self.a2 = 0 self.a3 = 0 # -- for the forest animation control self.index = 0 # -- index in the typeover array self.delay = 0 # -- delay before adding new text self.cursor = 0 # -- cursor in the typeover text self.x = [0, 0, 0] # -- offsets of the 3 forest pics and Alek adonthell.gamedata_engine ().set_update_map (0) self.letsexit = 0 adonthell.gametime_update () while self.letsexit != 1: for i in range (0, adonthell.gametime_frames_to_skip ()): self.forest_animation () self.alek_run.update () self.window.update () adonthell.gametime_update () if self.letsexit != 1: self.window.draw () adonthell.screen_show () adonthell.gamedata_engine ().main (self.window, 'fmv') # -- quit! adonthell.audio_fade_out_background (500) adonthell.gamedata_engine ().main_quit ()