def newScreen(self, old, option):

        if option == 'p':
            self.begin(old, option, [], [])

        elif option == 'e':
            self.exitCheck = menus.ErrorScreen(
                'Are you sure you want to quit?', 'e', self)

        else:

            old.discard()
            if option == 'b':
                m = menus.MainMenu(window, self)
                m.create()

            if option == 'l':
                self.simulationDB = saves.Database()
                self.saveData = self.simulationDB.load_for_menu()

                load_menu = menus.LoadMenu('Saved Simulations', window,
                                           self.saveData, self)
                load_menu.create()
                load_menu.updateDesc()

            if option == 'c':
                collisions_menu = menus.BaseMenu('Collisions Settings', window,
                                                 3, 6, self)
                collisions_menu.display(self.top1, self.bottom1, option)

            if option == 'a':
                acceleration_menu = menus.BaseMenu(
                    'Variable Acceleration Settings', window, 5, 4, self)
                acceleration_menu.display(self.top2, self.bottom2, option)
Beispiel #2
0
 def __init__(self, game):
     self.menu = 0
     self.menu_list = list()
     self.menu_list.append(menus.MainMenu(game, self))
     self.menu_list.append(menus.PauseMenu(game, self))
     self.menu_list.append(menus.GameOverMenu(game, self))
     self.menu_list.append(menus.WinMenu(game, self))
     self.menu_list.append(menus.OptionMenu(game, self))
Beispiel #3
0
def main() -> None:
    pygame.init()
    pygame.font.init()
    DISPLAY = (constants.SCREEN_WIDTH, constants.SCREEN_HEIGHT)
    screen = pygame.display.set_mode(DISPLAY)
    background = constants.BACKGROUND.convert()
    bird = Bird(constants.BIRD_WIDTH, constants.BIRD_HEIGHT,
                constants.BIRD_JUMP_SPEED,
                constants.BIRD_STARTING_POSITION,
                constants.SFX_WING_PATH, constants.SFX_POINT_PATH,
                constants.SFX_HIT_PATH, constants.SFX_DIE_PATH,
                constants.BIRD_SPRITE_SHEET_PATH,
                constants.BIRD_FRAMES_COORDINATES)

    level_list = list()
    level_list.append(Level01(bird, background))
    current_level_no = 0
    current_level = level_list[current_level_no]
    current_level.create_level()
    bird.level = current_level

    clock = pygame.time.Clock()
    main_menu = menus.MainMenu(bird, background, constants.MENU_ASSETS)
    get_ready_menu = menus.GetReadyMenu(bird, background, constants.MENU_ASSETS)
    game_over_screen = menus.GameOverScreen()

    # Game start
    main_menu_stage(main_menu, screen)
    while True:
        get_ready_stage(get_ready_menu, screen, bird)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                raise SystemExit('QUIT')
            elif event.type == pygame.KEYUP and event.key in (pygame.K_PAUSE, pygame.K_p):
                paused = not paused
            elif event.type == pygame.MOUSEBUTTONUP or (event.type == pygame.KEYUP and
                                                        event.key in (pygame.K_UP, pygame.K_RETURN, pygame.K_SPACE)):
                bird.jump
        start_time = time.time() - 4
        delta_time = start_time - time.time()

        current_level.update()
        current_level.draw(screen)

        screen.blit(bird.animate, bird.rect)
        bird.update(delta_time / 100)

        if bird.is_obstacle_hit:
            game_over_stage(game_over_screen, screen, current_level)
            break

        clock.tick(65)
        pygame.display.flip()
Beispiel #4
0
 def launch_main_menu(self):
     self.menu = menus.MainMenu(self)
Beispiel #5
0
    def __init__(self, parent):
        self.YEAR_LIMITS = self._set_search_limits()

        wxgui_api.install_bundled_icon("wxtasklist", '@activealarms',
                                                    ("activealarms16.png", ))
        wxgui_api.install_bundled_icon("wxtasklist", '@dismiss',
                                                        ("dismiss16.png", ))
        wxgui_api.install_bundled_icon("wxtasklist", '@navigator',
                                                ("Tango", "navigator16.png"))
        wxgui_api.install_bundled_icon("wxtasklist", '@scroll',
                                                    ("Tango", "scroll16.png"))
        wxgui_api.install_bundled_icon("wxtasklist", '@snooze',
                                                            ("snooze16.png", ))
        wxgui_api.install_bundled_icon("wxtasklist", '@snoozedialog',
                                                    ("snoozedialog48.png", ))
        wxgui_api.install_bundled_icon("wxtasklist", '@tasklist',
                                                ("Tango", "tasklist16.png"))

        self.config = coreaux_api.get_plugin_configuration('wxtasklist')

        aconfig = self.config("ContextualShortcuts")
        accelerators = {
            aconfig["prev_page"]:
                            lambda event: self.navigator.show_previous_page(),
            aconfig["next_page"]:
                                lambda event: self.navigator.show_next_page(),
            aconfig["apply"]: lambda event: self.navigator.apply(),
            aconfig["set"]: lambda event: self.navigator.set(),
            aconfig["reset"]: lambda event: self.navigator.reset(),
            aconfig["autoscroll"]:
                        lambda event: self.list_.autoscroll.execute_force(),
            aconfig["toggle_autoscroll"]:
                                lambda event: self.list_.autoscroll.toggle(),
            aconfig["find"]: lambda event: self.list_.find_in_tree(),
            aconfig["edit"]: lambda event: self.list_.edit_items(),
            aconfig["snooze"]:
                lambda event: self.list_.snooze_selected_alarms_for_custom(),
            aconfig["snooze_all"]:
                    lambda event: self.list_.snooze_all_alarms_for_custom(),
            aconfig["dismiss"]:
                            lambda event: self.list_.dismiss_selected_alarms(),
            aconfig["dismiss_all"]:
                                lambda event: self.list_.dismiss_all_alarms(),
            aconfig["toggle_navigator"]:
                                lambda event: self.navigator.toggle_shown(),
            aconfig["toggle_gaps"]: lambda event: self.list_.toggle_gaps(),
            aconfig["toggle_overlappings"]:
                                lambda event: self.list_.toggle_overlappings(),
        }
        accelerators.update(wxgui_api.get_right_nb_generic_accelerators())
        acctable = wxgui_api.generate_right_nb_accelerators(accelerators)

        # Note that the remaining border is due to the SplitterWindow, whose
        # border cannot be removed because it's used to highlight the sash
        # See also http://trac.wxwidgets.org/ticket/12413
        # and http://trac.wxwidgets.org/changeset/66230
        self.panel = TaskListPanel(parent, self, acctable)
        self.pbox = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.pbox)

        self.nb_icon_index = wxgui_api.add_right_nb_image(
                                    wxgui_api.get_notebook_icon('@tasklist'))
        self.nb_icon_refresh_index = wxgui_api.add_right_nb_image(
                                    wxgui_api.get_notebook_icon('@refresh'))

        # filters.Navigator must be instantiated *before*
        # list_.OccurrencesView, because the former sets the filter for the
        # latter; note that inverting the order would work anyway because of a
        # usually favorable race condition (the list is refreshed after an
        # asynchronous delay), but of course that shouldn't be relied on
        self.navigator = filters.Navigator(self, self.YEAR_LIMITS)
        self.warningsbar = WarningsBar(self.panel)
        self.list_ = list_.OccurrencesView(self, self.navigator, self.YEAR_LIMITS)

        self.mainmenu = menus.MainMenu(self)
        self.viewmenu = menus.ViewMenu(self)
        self.panel.init_tab_menu(self)
        self.list_._init_context_menu(self.mainmenu)

        self.pbox.Add(self.warningsbar.get_panel(), flag=wx.EXPAND)
        self.pbox.Add(self.list_.listview, 1, flag=wx.EXPAND)

        self._show()

        wxgui_api.bind_to_show_main_window(self._handle_show_main_window)
        wxgui_api.bind_to_hide_main_window(self._handle_hide_main_window)
        core_api.bind_to_exit_app_1(self._handle_exit_application)
Beispiel #6
0
player = entities.player.Player(sequence.current, main_cam)

entity_handler = entities.handler.Handler()
entity_handler.list = [player]

static_level_surf = pygame.Surface((const.SCRN_W, const.SCRN_H))
static_level_surf.set_colorkey(const.TRANSPARENT)
draw_background(static_level_surf)
sequence.current.draw_static(static_level_surf, main_cam)

# sound.play_music()

editor_key = events.Keybind([pygame.K_e])

main_menu = menus.MainMenu()
pause_menu = menus.PauseMenu(player)
splash_screen = splash.SplashScreen()
credits_screen = menus.Credits()

# If we're not on the first level, change menu text from "start" to "continue"
if sequence.level_num != -1:
    main_menu.start_action = "continue"

GAME = 0
EDITOR = 1
MENU = 2
SPLASH_SCREEN = 3
PAUSE = 4
CREDITS = 5
state = SPLASH_SCREEN
    def run(self):
        m = menus.MainMenu(window, self)
        m.create()

        window.mainloop()
Beispiel #8
0
import config
import vte
import misc
import menus
import alarms
import passwords

# backup of colors for palette commands
lights_global = 0
darks_global = 0

stopwatch_global = 0
mainmenu_global = menus.MainMenu()
brightness_global = menus.BrightnessMenu(mainmenu_global)
fontmenu_global = menus.FontMenu(mainmenu_global)


def unhex(h):
    return int(h, base=16)


class KMInput():
    def noop(*k):
        pass

    def __init__(self):
        self.kcb = self.noop
        self.ckcb = self.noop
        self.pcb = self.noop
        self.ispcb = 0