예제 #1
0
def main():
    for arg in sys.argv[1:]:
	process(arg)
    select_lang()
    global panel
    global chat_screen
    global level_setting
    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
    threades.audio.play_music(False,'soundtrack')
    
    threades.check_saved_game_level()
    model.game_controller.reset_time()
    gui_buttons.initialize_gui()
    pause_screen()
    intro_thread.join()
    
    proceduralFlow.storyboard_level = threades.current_level
    if threades.current_level != 1:
        load_resume_game()
    else:
	threades.load_initial_facilities()
        data_file = os.path.join('storyboards',str(model.storyboard_file),'data','data1.pkl')
        model.init_cons(data_file)
        model.init_obj()
        threades.initialize_facilities(True)
        proceduralFlow.openStoryBoardFile() 

     
    # loading the correct data file

    #gui_buttons.initialize_gui()

    threades.screen.fill((0,0,0))
    #panel = display_panel.display_panel()
    panel.change_labels()
    animation_obj = threades.Animation()
    animation_obj.update()
    # Starting of the threads
    #print update_thread
    message_thread = threading.Thread(target = message_window, args=[])
    message_thread.start()
    mouse_flag = False
    chat_screen=chat.chat()
    #print 'i was here'
    clock = pygame.time.Clock()
    threades.total_update_flag = True
    # The main infinite loop
    while True:
        time_passed = clock.tick()
        model.game_controller.update_level_time(threades.update_thread_pause)
        threades.update_turn(time_passed)
        animation_obj.update()

        mouse_flag = False
            
        (x,y) = (0,0)
        x,y = pygame.mouse.get_pos()
        
        if not gui_buttons.gui_obj.get_win_flag():
            if len(threades.buildFacilityPlacementFlag):
                facility_placement()               
            if (x > (threades.resize_pt_x(890)) and x < threades.resize_pt_x(930)) and y< threades.resize_pt_y(600):
                threades.transform_obj.move_free((-10,0))
                
            if x < threades.resize_pt_x(60) and y< threades.resize_pt_y(600):
                threades.transform_obj.move_free((10,0))
                
            if  y > threades.resize_pt_y(560) and y< threades.resize_pt_y(600) and x < threades.resize_pt_x(930):
                threades.transform_obj.move_free((0,-10))
                
            if y < threades.resize_pt_y(60) and x < threades.resize_pt_x(930) and x < threades.resize_pt_x(930):
                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()
        
               

        
        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 = time_passed
        model.global_time += model.iteration_time
        storyboardObj.flow()
        gui_buttons.instruction_off_flag = False
예제 #2
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()
예제 #3
0
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()