FLAGS = {} if model.FLAG_XO: import game_sharing import olpcgames.mesh as mesh select_lang_flag = 1 desktop2 = gui.Desktop() set_icon(pygame.image.load(os.path.join('data', 'WFPLOGO.png')).convert_alpha()) select_flag = 1 #Used to determine the button clicked in the main menu..Start new game or Resume Saved Level update_thread = None message_thread = None level_obj = level_change.change_level() storyboardObj = proceduralFlow.storyboardFlow() load_images.load_images() panel = display_panel.display_panel() def message_window(): font_color = (255,214,150) myfont = pygame.font.Font("font.ttf", threades.resize_pt(17)) # Custom gui.Window Style win_style = gui.defaultWindowStyle.copy() win_style['font'] = myfont win_style['bg-color'] = (0,0,0) # Calculating position and size of window from the size of the threades.desktop position_win =threades.resize_pos((375.0,42.0)) size_win =threades.resize_pos((450.0,150.0))
def main(): global panel global chat_screen global level_setting # Displaying the WFP logo intro_thread = threading.Thread(target = load_images.load_images, args=[]) intro_thread.start() # Loading and starting the sound play GameSounds.objMusic.start_music() level_setting=level_change.change_level() pause_screen() intro_thread.join() threades.initialize_facilities() #surface_middle = pygame.transform.scale(surface3,threades.resize_pos((1200,560))) # Processing regarding the storyboard proceduralFlow.openStoryBoardFile() storyboardObj = proceduralFlow.storyboardFlow() proceduralFlow.openStoryBoardFile() gui_buttons.initialize_gui() threades.screen.fill((0,0,0)) panel = display_panel.display_panel() animation_obj = threades.Animation() animation_obj.update() # Starting of the threads update_thread = threading.Thread(target = threades.update_turn, args=[]).start() message_thread = threading.Thread(target = message_window, args=[]).start() mouse_flag = False chat_screen=chat.chat() model.game_controller.reset_time() # The main infinite loop while True: #clock.tick() model.game_controller.update_level_time() mouse_flag = False (x,y) = (0,0) x,y = pygame.mouse.get_pos() if ((x < threades.new_screen_size[0]) and (x > (threades.new_screen_size[0]-60))): threades.transform_obj.move_free((0,0)) if (x < 60 and x > 0): threades.transform_obj.move_free((0,0)) if (y < threades.resize_pt_y(900)) and (y > threades.resize_pt_y(840)): threades.transform_obj.move_free((0,0)) if ((y < threades.resize_pt_y(60)) and (y > threades.resize_pt_y(0))): threades.transform_obj.move_free((0,0)) if (x > threades.resize_pt_x(0)) and (x < threades.resize_pt_x(600)) and (y > threades.resize_pt_y(845)) and (y < threades.resize_pt_y(900)): mouse_flag = True pygame.display.set_caption('FoodForce2') for e in gui.setEvents(pygame.event.get()): event_handling(e) #pygame.draw.rect(threades.screen,(209,169,106),threades.resize_rect((0,40,1200,560))) animation_obj.update() # Claculate indicators again threades.calculate_indicators_starting() #For middle surface #surface_middle = pygame.transform.scale(surface3,threades.resize_pos((1200,560))) #threades.screen.blit(surface_middle,threades.resize_pos((0,40))) rects_list = get_update_region() panel.update() if (threades.total_update_flag or threades.map_update_flag or threades.facilities_update_flag or threades.panel_update_flag or panel.res.money_flag): threades.desktop.update() threades.desktop.draw() pygame.display.update(rects_list) model.iteration_time = clock.tick() model.global_time += model.iteration_time storyboardObj.flow()
def main(): global panel global chat_screen global level_setting global update_thread global message_thread cursor = pygame.cursors.load_xbm(os.path.join('art', 'ff2_cursor.xbm'),os.path.join('art', 'ff2_cursor-mask.xbm')) #print cursor pygame.mouse.set_cursor(cursor[0],cursor[1],cursor[2],cursor[3]) # Displaying the WFP logo intro_thread = threading.Thread(target = load_images.load_images, args=[]) intro_thread.start() # Loading and starting the sound play #level_setting=level_change.change_level() #Checks the level on which he user is threades.current_level = threades.check_saved_game_level() #Resets the time model.game_controller.reset_time() #Initialises and creates the starting screen and pauses the game until the user gives an input pause_screen() #Lets the initial thread started to get completed intro_thread.join() proceduralFlow.storyboard_level = threades.current_level #Takes action according to the level if threades.current_level != 1: load_resume_game() else: threades.initialize_facilities(True) proceduralFlow.openStoryBoardFile() # Processing regarding the storyboard storyboardObj = proceduralFlow.storyboardFlow() gui_buttons.initialize_gui() threades.screen.fill((0,0,0)) panel = display_panel.display_panel() animation_obj = threades.Animation() animation_obj.update() # Starting of the threads update_thread = threading.Thread(target = threades.update_turn, args=[]) update_thread.start() #print update_thread message_thread = threading.Thread(target = message_window, args=[]) message_thread.start() mouse_flag = False chat_screen=chat.chat() # The main infinite loop while True: #clock.tick() model.game_controller.update_level_time(threades.update_thread_pause) animation_obj.update() mouse_flag = False (x,y) = (0,0) x,y = pygame.mouse.get_pos() if len(threades.buildFacilityPlacementFlag): facility_placement() if (x > (threades.resize_pt_x(890)) and x < threades.resize_pt_x(930)): threades.transform_obj.move_free((-10,0)) if x < threades.resize_pt_x(60) : threades.transform_obj.move_free((10,0)) if y > threades.resize_pt_y(560) and y< threades.resize_pt_y(600): threades.transform_obj.move_free((0,-10)) if y < threades.resize_pt_y(60): threades.transform_obj.move_free((0,10)) if (x > threades.resize_pt_x(0)) and (x < threades.resize_pt_x(600)) and (y > threades.resize_pt_y(845)) and (y < threades.resize_pt_y(900)): mouse_flag = True pygame.display.set_caption('FoodForce2') for e in gui.setEvents(pygame.event.get()): event_handling(e) # Calculate the values of the indicators threades.calculate_indicators_starting() #updating the region rects_list = get_update_region() panel.update() if (threades.total_update_flag or threades.map_update_flag or threades.facilities_update_flag or threades.panel_update_flag or panel.res.money_flag): threades.desktop.update() threades.desktop.draw() pygame.display.update(rects_list) #updates the time model.iteration_time = clock.tick() model.global_time += model.iteration_time #Calls the function which decides which action to be taken storyboardObj.flow()