Ejemplo n.º 1
0
def menu(pantalla,X_Screen,Y_Screen):
	opcionEscogida=False
	menuJuego = Menu(ANCHO,ALTO)
	menuJuego.cargarImgMenu()
	pantalla.blit(menuJuego.obtenerImg(),(X_Screen,Y_Screen))
	pygame.display.flip()
	while True:
		tecla = pygame.key.get_pressed()
		tecla = pygame.key.get_pressed()
		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				sys.exit()
			if tecla[K_DOWN]:
				menuJuego.flechaAbajo()
				imagen=menuJuego.obtenerImg()
				pantalla.blit(imagen,(0,0))
				pygame.display.flip()
			if tecla[K_UP]:
				menuJuego.flechaArriba()
				imagen=menuJuego.obtenerImg()
				pantalla.blit(imagen,(0,0))
				pygame.display.flip()
			if tecla[K_RETURN]:
				if(menuJuego.OpcionActual==0):
					dibujarNuevoJuego(pantalla,X_Screen,Y_Screen)
					print"jfdgkhfdg"			
def conversao_decimais():

    while(True):

        print("Pra voltar ao MENU INTERATIVO, digite 'voltar'\n")

        num = input("digite um número inteiro: ")
        if num.lower() == 'voltar':
            os.system('cls')
            print("Até logo\n")
            os.system('pause')
            os.system('cls')
            Menu.menu_principal()
            return(None)
        elif num.isnumeric() == False:
            os.system('cls')
            print("Por favor digite um valor válido\n")
            os.system('pause')
            os.system('cls')
            continue
        else:
            num = int(num)
            os.system('cls')
            print (f"O {num} convertido para binário é: {bin(num)[2:]}\n ")
            os.system('pause')
            os.system('cls')
def get_files_menu_opt3_func():
    file = AF.read_input_files() + str(
        input(
            'Enter the mutations file name to process in order to get the Id2Gene file (EnsemblID + Hugo_Symbol): '
        ))
    if os.path.exists(file):
        wg = AF.read_input_files() + str(
            input(
                'Enter the name of the file that cointains the genes names to reduct: '
            ))
        if os.path.exists(wg):
            AF.waiting_message()
            try:
                final = OMF.get_id2gene_file(file, wg)
                TRF.write_file_feedback(final)
                return AF.back_or_quit()
            except:
                print(
                    '\nWrong file or structure file. Please, read the help menu and try again.'
                )
                return M.MainMenu()
        else:
            TRF.wrong_filename()
            return M.get_files_menu()
    else:
        TRF.wrong_filename()
        return M.get_files_menu()
Ejemplo n.º 4
0
def winner(name):
    pygame.init()
    pygame.mixer.music.load("sounds/winscreen.mp3")
    pygame.mixer.music.play(-1)
    screen = pygame.display.get_surface()                                   
    screen = pygame.display.set_mode((800, 600), pygame.RESIZABLE) 
    level = pygame.image.load("background/winScreen.jpg").convert()        
    levelRect = level.get_rect(center=(400, 300))
    screen.blit(level, (0, 0))
    myfont = pygame.font.Font("fonts/moonhouse.ttf", 50)
    winner = name + " Wins!!!"
    label = myfont.render(winner, 1, (0, 255, 0))
    textpos = label.get_rect()
    textpos.centerx = level.get_rect().centerx
    textpos.centery = level.get_rect().centery
    while 1:
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                keypressed = pygame.key.name(event.key)
                if keypressed == pygame.key.name(pygame.K_ESCAPE):
                    Menu.main()
                    sys.exit(0)
        screen.blit(level, (0,0))
        screen.blit(label, textpos)
        pygame.display.flip()
Ejemplo n.º 5
0
def run_dialog(d, txt, speaker=''):
    """Lance un texte dans la boite de dialogue, en tenant compte de sa taille (
ajoute des retours à la ligne si elle est trop longue, et des pages si il y a
trop de lignes)"""

    ROWS, COLS = d["ROWS"], d["COLS"]
    pages = txt.split('\n\n')  # Sépare tout d'abord les pages

    for page in pages:
        resized_txt_lst = [
            resized_line for line in page.splitlines()
            for resized_line in resize_line(line, d["xlen"], '\n')
        ]
        for t in range(0, len(resized_txt_lst),
                       d["ylen"] - int(bool(speaker))):
            text = "".join(resized_txt_lst[t:t + d["ylen"] -
                                           int(bool(speaker))])
            if speaker:
                text = Tools.reformat(
                    '<bold><underlined>{0} :</>\n'.format(speaker) + text
                )  # Si l'éméteur est précisé, on l'affiche en haut de chaque page en gras souligné
            m = Menu.create(
                [[(text, lambda: None)]],
                d["x"],
                d["y"],
                COLS,
                d['ylen'] + 2,
                text_align="left"
            )  # On utilise un menu d'une seule case pour afficher chaque page
            Menu.run(m)
Ejemplo n.º 6
0
def eliminaUtente(database):
    rows = database.select_utenti(None)
    print("Quali tra i seguenti utenti vuoi eliminare? ")
    print(
        tabulate(
            rows,
            headers=["ID", "Nome", "Cognome", "Data registrazione", "Stato"],
            tablefmt="github"))
    id = input()
    # controllo che il numero inserito sia un intero altrimenti genero un errore
    try:
        id = int(id)
    except ValueError:
        print("Errore inserirsci un id corretto! ")
        Menu.scelta3(database)

    try:
        database.delete_utenti(id)
    except:
        print(
            "Impossibile eliminare utente perchè è già stato utilizzato in un altra tabella "
        )
        Menu.scelta2(database)
    database.conn_db.commit()
    M.menu(database)
Ejemplo n.º 7
0
def atmTransaction():
    atmType = str(input("Would you like to deposit or withdraw money?"))
    if atmType == "withdraw":
        atmWithdrawMoney = int(
            input("How much money would you like to withdraw?"))
        if atmWithdrawMoney <= Balance.getBalance() and atmWithdrawMoney > 0:
            Balance.amountToDeduct(atmWithdrawMoney)
            print("You have successfully withdrew $", atmWithdrawMoney)

            Menu.displayMenu()
        else:
            print(
                "You cannot withdraw that amount of money. Please enter a number within your balance."
            )
            atmTransaction()

    elif atmType == "deposit":
        atmDepositMoney = int(
            input("How much money would you like to deposit?"))
        if atmDepositMoney <= 500000 and atmDepositMoney > 0:
            Balance.amountToAdd(atmDepositMoney)
            print("You have successfully deposited $", atmDepositMoney)

            Menu.displayMenu()
        else:
            print(
                "You cannot deposit that amount of money. Please enter a number within $1-$500,000."
            )
            atmTransaction()
    else:
        print("You can only deposit or withdraw money. Please try again.")
        atmTransaction()
Ejemplo n.º 8
0
    def run(self):
        self.cat = Category.Category()
        self.cat_name = self.cat.get_category()
        if self.cat_name == None: return
        self.run_game()

        def go_back():
            return Menu.MenuStatus.DONE

        def new_category():
            try:
                self.cat_name = self.cat.get_category()
                if self.cat_name == None: return Menu.MenuStatus.OK
                self.run_game()
                self.cat_menu_item.set_title(
                    self.catMenuTitle.format(self.cat_name))

            except Exception as e:
                print_error(e)
            return Menu.MenuStatus.OK

        def same_category():
            self.run_game()
            return Menu.MenuStatus.OK

        men = Menu.MenuX("Hangman:Menu")
        self.cat_menu_item = Menu.MenuItem(
            self.catMenuTitle.format(self.cat.get_name()), same_category)
        men.add(self.cat_menu_item)
        men.add(Menu.MenuItem("Change category", new_category))
        men.add(Menu.MenuItem("Go Back", go_back))
        while men.run() == Menu.MenuStatus.OK:
            pass
Ejemplo n.º 9
0
def stage_select():
    # Screen
    screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))
    ACTUAL_STAGE
    #Background
    background = pygame.image.load(os.path.join('', 'images', 'menu_bg.jpg'))
    background = background.convert()
    
    #Cursor
    pygame.mouse.set_visible(False)
    cursor = Cursor(16,16,'images/cursor.png')
    
    #Put Here the Stages of the game
    stage1 = Option(100,150,250,327,'images/fase1_small.jpg','images/fase1.jpg',stage1_function,1.2,0.05,True)
    stage2 = Option(400,400,250,278,'images/fase2.jpg','images/fase2_big.jpg',stage2_function,1.2,0.05,True)
    # ...
    
    
    # Create menu
    select_menu = Menu()
    select_menu.append(stage1)
    select_menu.append(stage2)
    # ...
    
    select_menu.main_loop(cursor,screen,background)
Ejemplo n.º 10
0
 def run(self):
     
     #self.menu.run(self.screen,self.pointergroup)
     #Game.run(self.screen,self.pointergroup)
     
     clock = pygame.time.Clock()
     scenario = Scenario.Menu()
     scenario.load()
     
     #loop principale
     while True:
         for event in pygame.event.get():
             if event.type == (pygame.QUIT):
                 print "fine"
                 sys.exit()
                 
             if event.type == (pygame.KEYDOWN):
                 print event.dict
                 if event.dict['key'] == 27:
                     print "fine"
                     Menu.run(screen,pointergroup)
                     #sys.exit()
         if scenario.running == True:    
             scenario.Update(self.pointergroup,clock,event)
             scenario.Render(self.screen)
         if scenario.change == True:
             scenario = scenario.load()
         
         #Render.render(self.screen,scenario,self.pointergroup)
         clock.tick()
     return 0
Ejemplo n.º 11
0
def jogar():
    acertou = False
    enforcou = False
    errou = 0

    palavra_secreta = carrega_arquivo_palavras(arquivo="palavras.txt")
    letras_acertadas = carrega_acertos(palavra_secreta)
    imprime_mensagem_boas_vindas()

    while (not acertou and not enforcou):

        chute = solicita_chute(letras_acertadas)

        if (chute in palavra_secreta):
            letras_acertadas = letra_correta(chute, letras_acertadas,
                                             palavra_secreta)
        else:
            errou += 1
            desenha_forca(errou)

        enforcou = errou == 7
        acertou = '_' not in letras_acertadas

    if (acertou):
        imprime_mensagem_vencedor()
    else:
        imprime_mensagem_perdedor(palavra_secreta)

    Menu.menu()
Ejemplo n.º 12
0
 def on_mouse_press(self, x, y, button, modifiers):
     # Mouse input to control menu
     if not self.game_start or self.paused:
         self.menu_page = Menu.menu_switch(self.menu_page, x, y)
     else:
         if self.player_sprite.dead:
             Menu.player_dead(self, x, y)
Ejemplo n.º 13
0
    def hit(self):
        if self.health > 0:
            self.health -= Main.Skeleton.damage
        else:
            Main.Skeleton.attack = False
            death_txt = pygame.font.SysFont('Sans', 100)
            text = death_txt.render('YOU DIED!', 1, (255, 0, 0))
            Main.win.blit(text, (768, 144))
            # deathSound.play()
            pygame.display.update()
            i = 0
            while i < 300:
                pygame.time.delay(10)
                i += 1
                for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                        i = 301
                        pygame.quit()
            Main.Chosen.health = 100
            Menu.game_intro()

        if Main.Skeleton.left:
            self.x -= 50

        elif Main.Skeleton.right:
            self.x += 50

        if not self.isJump:
            self.isJump = True
            self.walkCount += 1
        '''else:
Ejemplo n.º 14
0
 def military_building_menu(self, menu, player_b):
     """prints the menu for a military building. DO NOT USE DIRECTLY. use get_building_menu to create"""
     building_menu = {}
     for u in self.get_buildable_units(menu.author, player_b):
         f = menu.build_f(self.prep_units,
                          (menu.author, menu.channel, player_b, u))
         building_menu[u.emoji] = Menu.Menupoint(
             u.name + "\tcost: " + get_resource_str(u.price),
             menu.get_recall_wrapper(f, self.get_building_menu(player_b)))
     building_menu["🏃"] = Menu.Menupoint(
         "prepped",
         menu.build_f(self.print_building_prepared,
                      (menu.channel, player_b)))
     building_menu["👍"] = Menu.Menupoint(
         "start training",
         menu.get_recall_wrapper(
             menu.build_f(self.start_building_prepped,
                          (menu.author, menu.channel, player_b)),
             self.get_building_menu(player_b)))
     building_menu["👷"] = Menu.Menupoint(
         "currently building",
         menu.build_f(self.print_building_threads,
                      (menu.channel, player_b)))
     if player_b.build_prep:
         building_menu["🛑"] = Menu.Menupoint(
             "clear prepped solders",
             menu.get_recall_wrapper(lambda: player_b.clear_build_prep(),
                                     self.get_building_menu(player_b),
                                     async=False))
     building_menu["⬅"] = Menu.Menupoint("return",
                                         self.military_menu,
                                         submenu=True)
     menu.header = get_resource_str(self.get_player(menu.author).resources,
                                    detail=True)
     menu.change_menu(building_menu)
Ejemplo n.º 15
0
 def military_menu(self, menu):
     military_menu = {}
     player = self.get_player(menu.author)
     for player_b in player.buildings:
         if issubclass(player_b.__class__, Building.Military):
             f = self.get_building_menu(player_b)
             military_menu[player_b.emoji] = Menu.Menupoint(player_b.name,
                                                            f,
                                                            submenu=True)
     # military_menu["🎖"] = Menu.Menupoint("units", menu.build_f(self.print_units, (menu.author, menu.channel)))
     military_menu["🎖"] = Menu.Menupoint("units",
                                         self.rally_troops_menu,
                                         submenu=True)
     if player.rallied_units:
         military_menu["➡"] = Menu.Menupoint(
             "start attack",
             menu.get_recall_wrapper(
                 menu.build_f(self.attack, (menu.author, menu.channel)),
                 self.military_menu))
     if player.attack_threads or player.return_threads:
         military_menu["🔜"] = Menu.Menupoint(
             "current attacks",
             menu.build_f(self.print_attacks, (menu.author, menu.channel)))
     military_menu["⬅"] = Menu.Menupoint("return",
                                         self.main_menu,
                                         submenu=True)
     menu.header = get_resource_str(self.get_player(menu.author).resources,
                                    detail=True)
     menu.change_menu(military_menu)
Ejemplo n.º 16
0
 def drawFogOfWarOnMiniMap(self,mainScreen,index):
     rows, cols = len(self.fogOfWarBoard[index]), len(self.fogOfWarBoard[index][0])
     fogBlack = (1,1,1,220)
     for row in xrange(rows):
         for col in xrange(cols):
             if self.fogOfWarBoard[index][row][col] == 0:
                 Menu.drawMiniMapCell(mainScreen,row,col,fogBlack)
Ejemplo n.º 17
0
 def rally_troops_menu(self, menu):
     m = {}
     player = self.get_player(menu.author)
     for u, amount in player.units.items():
         m[u.emoji] = Menu.Menupoint(
             u.name + "(%i)\t amount: %i" % (u.level, amount),
             menu.get_recall_wrapper(
                 menu.build_f(self.rally_troops,
                              (menu.author, menu.channel, u)),
                 self.rally_troops_menu))
     if self.get_player(menu.author).rallied_units:
         m["➡"] = Menu.Menupoint(
             "start attack",
             menu.get_recall_wrapper(
                 menu.build_f(self.attack, (menu.author, menu.channel)),
                 self.rally_troops_menu))
         m["🛑"] = Menu.Menupoint(
             "clear rallied solders",
             menu.get_recall_wrapper(
                 menu.build_f(self.clear_rallied,
                              (menu.author, menu.channel)),
                 self.rally_troops_menu))
     m["⬅"] = Menu.Menupoint("return", self.military_menu, submenu=True)
     units_list = "\n".join([
         "{:<10}({:<4}):  lvl {:<10}x{:<2}".format(u.name, u.emoji, u.level,
                                                   amount)
         for u, amount in player.rallied_units.items()
     ])
     menu.header = "What Units to You want to rally for an attack?\n==========\nRallied Troops:\n %s" % units_list
     menu.change_menu(m)
Ejemplo n.º 18
0
    def event(self, event):
        if event.type == PG.MOUSEBUTTONDOWN:
            if Menu.Menu.check_mouse(Menu.Menu(), 340, 40, 20, 20):

                if (G.Globals.FX_VOL - 1) >= 0:
                    G.Globals.FX_VOL -= 1
            elif Menu.Menu.check_mouse(Menu.Menu(), 430, 40, 20, 20):

                if (G.Globals.FX_VOL + 1) <= 10:
                    G.Globals.FX_VOL += 1
            elif Menu.Menu.check_mouse(Menu.Menu(), 340, 100, 20, 20):

                if (G.Globals.MUSIC_VOL - 1) >= 0:
                    G.Globals.MUSIC_VOL -= 1
            elif Menu.Menu.check_mouse(Menu.Menu(), 430, 100, 20, 20):

                if (G.Globals.MUSIC_VOL + 1) <= 10:
                    G.Globals.MUSIC_VOL += 1
            elif Menu.Menu.check_mouse(Menu.Menu(),
                                       G.Globals.WIDTH - (self.save_x + 20),
                                       G.Globals.HEIGHT,
                                       self.save_surf.get_width(),
                                       self.save_surf.get_height()):
                G.set_vol()
                G.Globals.STATE = Options.Options()
Ejemplo n.º 19
0
class Ballder:

    num_of_levels = 14

    def __init__(self):

        self.levels = [None] * Ballder.num_of_levels
        self.win = False
        self.menu = Menu(Ballder.num_of_levels)
        self.completed_levels = [False] * Ballder.num_of_levels

    def launch_level(self):
        self.lvl = self.menu.get_level()
        print("returned level:", self.lvl)
        self.level = Level(self.lvl, (self.lvl + 1) // 2, (self.lvl % 2 == 0))
        return self.level.run_game()

    def main_loop(self):
        is_complete = self.launch_level()
        self.menu.update_lvl(self.lvl, is_complete)
        self.completed_levels[self.lvl - 1] = is_complete
        self.check_for_win()

    def check_for_win(self):
        self.win = True
        for i in self.completed_levels:
            if i == False:
                self.win = False
                break

        if self.win:
            print("You beat the game!")
            self.menu.display_win_screen()
def prob_methylation_menu_opt1_func():
    f1 = AF.read_input_files() + str(
        input(
            "Enter the name of the file matches each patient to its repective cancer subtype: "
        ))
    if os.path.exists(f1):
        f2 = AF.read_input_files() + str(
            input(
                "Enter the name of the file that cointains the genes names to reduct: "
            ))
        if os.path.exists(f2):
            AF.waiting_message()
            try:
                prob_bval_met(f1, f2)
                return AF.back_or_quit()
            except:
                print(
                    '\nWrong file or structure file. Please, read the help menu and try again.'
                )
                return M.MainMenu()
        else:
            TRF.wrong_filename()
            return M.met_associated_prob_menu()
    else:
        TRF.wrong_filename()
        return M.met_associated_prob_menu()
Ejemplo n.º 21
0
def cancellaLibro(database):
    print("Seleziona dal elenco il libro da eliminare: ")
    rows = database.select_libri_categorie(None)
    # tabulete crea una tabella per migliorare la visulizzazione dei nostri dati
    print(
        tabulate(rows,
                 headers=[
                     "ID", "autore", "titolo", "Numero copie",
                     "Anno produzione", "Categoria"
                 ],
                 tablefmt="github"))
    id = input()
    # controllo che il numero inserito sia un intero altrimenti genero un errore
    try:

        id = int(id)
    except ValueError:
        print("Errore inserirsci un id corretto! ")
        Menu.scelta4(database)
    try:
        database.delete_libri(id)
    except:
        print(
            "Impossibile eliminare la categoria perchè è già stata utilizzata in un altra tabella "
        )
        Menu.scelta2(database)
    database.conn_db.commit()
    M.menu(database)
Ejemplo n.º 22
0
 def __init__(self):
     self.pauseMenu = Menu()
     self.statsMenu = Menu()
     self.weaponMenu = Menu()
     self.armorMenu = Menu()
     self.promptMenu = Menu()
     self.rmin = 400
     self.rmax = 800
     self.bgtimer = random.randint(self.rmin, self.rmax)
     self.dirtimer = random.randint(self.rmin, self.rmax)
     self.max_chans = 100
     pygame.mixer.set_num_channels(self.max_chans)
     self.smanager = SoundManager(self.max_chans)
     amb = pygame.mixer.Sound('ambient2.ogg')
     self.ambch = pygame.mixer.Channel(self.smanager.get())
     br = pygame.mixer.Sound('charbreath.ogg')
     wk = pygame.mixer.Sound('charwalk.ogg')
     rn = pygame.mixer.Sound('charrun.ogg')
     gr = pygame.mixer.Sound('chargrunt.ogg')
     hw = pygame.mixer.Sound('hitwall2.ogg')
     hb = pygame.mixer.Sound('heartbeat.ogg')
     hbf = pygame.mixer.Sound('heartbeat_fast.ogg')
     
     pygame.mixer.Sound('armor_aquire.ogg')
     bgfx = [pygame.mixer.Sound('roar_distant.ogg'),\
             pygame.mixer.Sound('ambient3.ogg'),\
             pygame.mixer.Sound('bug_alien.ogg')]
     self.bgsound = RadarSound(bgfx, self.smanager.get())
     self.screen = pygame.display.get_surface()
     self.srect = self.screen.get_rect()
     self.bg = pygame.Surface((self.srect.width, self.srect.height))
     self.bg.fill((0, 75, 75))
     self.bgrect = self.bg.get_rect()
     self.fog = pygame.Surface((self.srect.width, self.srect.height))
     self.fog.fill((128, 128, 128))
     self.fogrect = self.fog.get_rect()
     self.fog.set_alpha(245)
     self.char = Char(self.smanager.get(), [wk, rn], self.smanager.get(), [br, gr, hw],\
              self.smanager.get(), [hb, hbf])
     self.weaponChannel = self.smanager.get()
     self.armorChannel = self.smanager.get()
     self.char.getWeapon(Katana(self.char, self.weaponChannel))
     self.char.getWeapon(Pistol(self.char, self.weaponChannel))
     self.char.equipWeapon(0)
     self.char.getArmor(lightArmor(self.armorChannel))
     self.char.equipArmor(0)
     self.chars = pygame.sprite.RenderUpdates(self.char)
     self.enemies = pygame.sprite.RenderUpdates()
     self.lmarks = pygame.sprite.RenderUpdates()
     self.dirfx = pygame.sprite.RenderUpdates()
     self.dirfxs = pygame.sprite.RenderUpdates()
     self.spawner = Spawner(self.char, self.smanager, self.enemies, self.lmarks,\
                            self.dirfx, self.dirfxs, self.weaponChannel, self.armorChannel)
     self.menuInit()
     self.ambch.set_volume(.5)
     self.ambch.play(amb, -1)
     self.clock = pygame.time.Clock()
     self.bgdis()
     pygame.display.flip
Ejemplo n.º 23
0
def main():
    pg.mixer.music.load('sons/moon-light.mp3')
    pg.mixer.music.play(0)
    screen = v.tela
    d.decompress('imagens/menu')
    logo = pg.transform.scale(pg.image.load('imagens/logo.png'),
                              (v.largura, v.altura))
    cps = pg.transform.scale(pg.image.load('imagens/cps.png'),
                             (v.largura, v.altura))
    kafka = pg.transform.scale(pg.image.load('imagens/kafka.png'),
                               (v.largura, v.altura))
    background = pg.transform.scale(pg.image.load('imagens/menu.jpg'),
                                    (v.largura, v.altura))
    screen.blit(cps, (0, 0))
    pg.display.update()
    sleep(2)
    screen.blit(kafka, (0, 0))
    pg.display.update()
    sleep(2)
    screen.blit(logo, (0, 0))
    pg.display.update()
    sleep(2)
    screen.blit(background, (0, 0))
    myfont = pg.font.SysFont("monospace", 15)
    label = myfont.render("Select the language / Selecione o idioma", 1,
                          (255, 255, 0))
    screen.blit(label, (500, 275))
    escolha = 0
    while escolha == 0:
        eua = pg.transform.scale(pg.image.load('imagens/eua.png'), (50, 40))
        screen.blit(eua, (600, 300))
        br = pg.transform.scale(pg.image.load('imagens/bandeira_nacional.png'),
                                (50, 40))
        screen.blit(br, (700, 300))
        recteua = eua.get_rect(topleft=(600, 300))
        rectbr = br.get_rect(topleft=(700, 300))
        for evento in pg.event.get():
            pos = pg.mouse.get_pos()
            if evento.type == QUIT:
                os.remove('imagens/menu.jpg')
                os.remove('imagens/sala.jpg')
                os.remove('imagens/menu.jpg')
                pg.quit()
            elif evento.type == KEYDOWN:
                if evento.key == K_ESCAPE:
                    os.remove('imagens/menu.jpg')
                    os.remove('imagens/sala.jpg')
                    os.remove('imagens/menu.jpg')
                    pg.quit()
            elif evento.type == pg.MOUSEBUTTONDOWN:
                if pg.mouse.get_pressed()[0] and recteua.collidepoint(pos):
                    escolha = 1
                elif pg.mouse.get_pressed()[0] and rectbr.collidepoint(pos):
                    escolha = 2
        pg.display.update()
    if escolha == 1:
        return Menu.main("en")
    if escolha == 2:
        return Menu.main("br")
Ejemplo n.º 24
0
def interact(game):
    if Game.getState(game) == 'menu':
        Menu.interact(game)
    elif Game.getState(game) == 'game':
        Game.interact(game)
    elif Game.getState(game) == 'quitGame':
        Game.quitGame(game)
    return
Ejemplo n.º 25
0
 def setUp(self):
     self.menu = Menu.Menu("Deck")
     self.menu.addOption("A", "Test option A")
     self.menu.addOption("B", "Test option B")
     self.menu.addOption("C", "Test option C")
     self.menu.addOption("D", "Test option D")
     self.menu.addOption("E", "Test option E")
     self.menu1 = Menu.Menu("")
Ejemplo n.º 26
0
Archivo: main.py Proyecto: Neopibox/MDD
def init():
        #interaction clavier
        tty.setcbreak(sys.stdin.fileno())
        
        #cacher le curseur
        os.system('setterm -cursor off')        
        Menu.setCurrentWindow(menu, "mainMenu")
        Menu.show(menu)
Ejemplo n.º 27
0
 def event(self, event):
     if event.type == PG.KEYDOWN and event.key == PG.K_ESCAPE:
         G.Globals.STATE = Menu.Menu()
     if event.type == PG.MOUSEBUTTONDOWN:
         pos = PM.get_pos()
         if pos[0] >= 0 and pos[0] <= self.back_x:
             if pos[1] >= 0 and pos[1] <= self.back_y:
                 G.Globals.STATE = Menu.Menu()
Ejemplo n.º 28
0
def main():
    choices_main_menu = {
        "1": (load_game, "cartes", "Nouvelle Partie"),
        "2": (load_game, "sauvegardes", "Charger une Partie"),
        "Q": (exit, None, "quitter")
    }
    main_menu = Menu(choices_main_menu, "Menu principal")
    main_menu.run()
Ejemplo n.º 29
0
 def checkLose(self):
     # out of bounds?
     if self.snake.head.x < 0 or self.snake.head.x > self.width or self.snake.head.y < 0 or self.snake.head.y > self.height:
         Menu.lose(self.screen, self.score)
     # self collision?
     else:
         for i  in range(1, len(self.snake.body) - 1) :
             if self.snake.head.x == self.snake.body[i].x and self.snake.head.y == self.snake.body[i].y:
                 Menu.lose(self.screen, self.score)
Ejemplo n.º 30
0
    def _build_help(self, logged_in):
        '''build and return the help menu'''
        self.help_menu = Menu.Menu(_('_Help'))
        self.about_item = Menu.Item(_('_About'), Menu.Item.TYPE_STOCK,
                                    stock.ABOUT)

        self.help_menu.append(self.about_item)

        return self.help_menu
Ejemplo n.º 31
0
def show_menu_movie():
    """show menu to select a movie"""

    menu = Menu()
    menu.add(MenuItem("Play a random movie", play_random))
    menu.add(MenuItem("Play a hi rated movie", play_rated))
    menu.add(MenuItem("Play an unrated movie", play_unrated))
    while True:
        menu.show()
Ejemplo n.º 32
0
def main():
		
		os.environ["SDL_VIDEO_CENTERED"] = "1"
		pygame.init()
		tela = pygame.display.set_mode((1024, 600))
		musicaInicio = pygame.mixer.music.load("img/loop.ogg")
		pygame.mixer.music.play(-1)
		menu = Menu(tela)
		menu.inicioMenu()
Ejemplo n.º 33
0
def pushButton():
    while True:
        m = str(msvcrt.getch(), 'utf -8')
        if m == "\r":
            os.system("cls")
            Menu.menuMain()
            break
        else:
            caratula()
Ejemplo n.º 34
0
def help():
    while True:
        m = str(msvcrt.getch(), 'utf -8')
        if m == "\r":
            os.system("cls")
            Menu.menuAFD()
            break
        else:
            helpCaratula()
Ejemplo n.º 35
0
def main():
    pygame.init()
    main_surface = pygame.display.set_mode((1200, 900))
    pygame.display.set_caption("SyntaXError")

    while True:
        # game_intro(main_surface)                                      # begint de intro
        Menu.menu(main_surface)
        pygame.display.flip()
Ejemplo n.º 36
0
def effettuaPrestito(database):
    print("Quale utente deve effettuare il prestito:\n")
    rows = database.select_utenti(None)
    # tabulete crea una tabella per migliorare la visulizzazione dei nostri dati
    print(
        tabulate(
            rows,
            headers=["ID", "Nome", "Cognome", "Data registrazione", "stato"],
            tablefmt="github"))
    idUtente = input()
    print("Quale libro deve essere preso in prestito: \n")
    rows = database.select_libri_categorie(None)
    print(
        tabulate(rows,
                 headers=[
                     "ID", "autore", "titolo", "Numero copie",
                     "Anno produzione", "Categoria"
                 ],
                 tablefmt="github"))
    idLibro = input()
    try:
        idLibro = int(idLibro)
        idUtente = int(idUtente)
    except ValueError:
        print("Errore inserirsci un id corretto! \n")
        Menu.scelta3(database)
    UtenteIsbloccato(database, idUtente)
    rows = database.select_libri_categorie(idLibro)
    numeroCopie = 0
    for row in rows:
        numeroCopie = row['numerocopie']
    rows = database.select_utenti(idUtente)
    stato = None
    NumPrenotazioniAttive = None
    for row in rows:
        stato = row['stato']
    rows = database.select_NumPrestiti(idUtente)
    for row in rows:
        NumPrenotazioniAttive = row[0]
    if numeroCopie > 0 and stato == DB.UTENTE_STATO_ATTIVO and NumPrenotazioniAttive < 5:
        database.update_libri_numlibri(idLibro, numeroCopie - 1)
        database.insert_prestiti(__calcola_data_scadenza_prestito(), idUtente,
                                 idLibro)
        #Mantiene in memoria i dati nel database
        database.conn_db.commit()
    if numeroCopie <= 0:
        print("Non sono più disponibili copie per questo libro\n")
    if stato == DB.UTENTE_STATO_BLOCCATO:
        print(
            "Non è stato possibile effettuare il prestito perchè l'utente è stato bloccato\n"
        )
    if NumPrenotazioniAttive == 5:
        print(
            "è stato superato il numero massimo di libri presi in presitito\n")

    M.menu(database)
Ejemplo n.º 37
0
def jogar():
    numero = random.randrange(1, 101)
    tentativas = 3
    rodada = 1
    pontos = 1000

    print("********************************")
    print("Bem vindo ao Jogo de Advinhação!")
    print("********************************")
    print("**Escolha o nivel de dificuldade**")
    print("(1) Facil (2) Médio (3) Dificíl")
    nivel = int(input("Qual o nivel desejado:"))

    while nivel > 3 or nivel < 1:
        print("Nivel invalido")
        nivel = int(input("Qual o nivel desejado:"))

    if (nivel == 1):
        tentativas = 20
    elif (nivel == 2):
        tentativas = 10
    else:
        tentativas = 5

    for rodada in range(tentativas + 1):
        print(f"Tentativa {rodada} de {tentativas}")
        chute = int(input("Digite um numero entre 1 e 100: "))

        if (chute < 1 or chute > 100):
            print("Numero invalido! Digite um numero entre 1 e 100")
            continue

        certo = numero == chute
        maior = numero < chute
        menor = numero > chute

        if (certo):
            print("Voce acertou!")
            break
        else:
            if (maior):
                print("Um pouco menos")
            if (menor):
                print("Um pouco mais")

        pontos = pontos - abs((chute - numero))
        if pontos < 0:
            print("Voce perdeu todos seus pontos")
            break

    print(f"O numero sorteado foi: {numero}")
    print(f"Seu total de pontos: {pontos}")

    print("Fim de jogo!")

    Menu.menu()
Ejemplo n.º 38
0
def SignIn():
    name = input('请输入你的用户名:')
    if name == 'qsj':
        if input('请输入管理员密码:') == '123321':
            Mn.admin_menu()

    elif name not in users:
        print('用户名不存在!')
    else:
        getPassword(name)
Ejemplo n.º 39
0
Archivo: main.py Proyecto: Neopibox/MDD
def interact(): 
        global direction, refresh, game, menu
       
        refresh = False
        #gestion des evenements clavier
        if isData():                                    #si une touche est appuyee
                refresh = True                
                key = sys.stdin.read(1)
                if Menu.gameWindow(menu):               # si on est sur le fenetre de jeu alors ...
                        Game.interact(game, settings, key)

                        if key == "p":
                                Menu.setCurrentWindow(menu, "pause")       # faire apparaitre le menu Pause
                else: 
                        if key == "z": 
                                Menu.changeSelectedButton(menu, "buttonUp")

                        elif key == "s":
                                Menu.changeSelectedButton(menu, "buttonDown")
                        
                        elif key == "d":
                                # Execute les commandes présentent dans la liste de commande à executer du bouton selectionne
                                buttonCmdList = Menu.getButtonList(menu, Menu.getIndexOfSelectedButton(menu, Menu.getButtonList(menu), Menu.getButtonSelected(menu,"name")),"cmd")
                                
                                for cmd in buttonCmdList:
                                        exec cmd
        
                if key == "\x1b": 
                        quit()                          # \x1b = touche echap / appel de la fonction qui permet de quitter le jeu
        
        while isData():
                sys.stdin.read(5)
Ejemplo n.º 40
0
def main():
    # pygame initialization
    pygame.init()
    pygame.mixer.music.load('sounds/menu.mp3')
    pygame.mixer.music.play(-1)

    pygame.display.set_caption('PyFighters')
    pygame.mouse.set_visible(1)
    clock = pygame.time.Clock()
    
    
    
    
    # code for our menu 
    ourMenu = ("Play Online",
               "How to play",
               "Statistics",
               "Exit")
    myMenu = Menu(ourMenu)
    myMenu.drawMenu()
    pygame.display.flip()
    # main loop for event handling and drawing
    while 1:
        clock.tick(60)

    # Handle Input Events
        for event in pygame.event.get():
            myMenu.handleEvent(event)
            # quit the game if escape is pressed
            if event.type == QUIT:
                sys.exit(0)
            elif event.type == Menu.MENUCLICKEDEVENT:    
                if event.text == "Play Online":
                    time.sleep(1)
                    character = CharSelect.charselect()
                    print "Just Waiting..."
                    InitScript.main(socketInit(), character)
                elif event.text == "How to play":
                    Settings.settings()
                elif event.text == "Local Play":
                    Script.main()
                elif event.text == "Exit":
                    sys.exit(0)
            elif event.type == KEYDOWN and event.key == K_ESCAPE:
                myMenu.activate()
                sys.exit(0)

                
        if myMenu.isActive():
            myMenu.drawMenu()
               
        
        pygame.display.flip()
Ejemplo n.º 41
0
def interact(game):
    if Game.getState(game) == 'menu':
        Menu.interact(game)
    elif Game.getState(game) == 'game':
        Game.interact(game)
    elif Game.getState(game) == 'editor':
        editor.start()
        Game.setState('menu', game)
        Game.setLevel(Level.create(1, 'levels.txt'), game)
    elif Game.getState(game) == 'quitGame':
        Game.quitGame(game)
    return
Ejemplo n.º 42
0
Archivo: main.py Proyecto: Neopibox/MDD
def changeKey(keyName):        
        while not isData():     # Tant qu'il n'y a pas d'autres touche de rentrée
                Menu.setButtonSelected(menu, "state", True)
                Menu.showButtons(menu)
                
        Menu.setButtonSelected(menu, "state", False)
        read = sys.stdin.read(1)  
        canChange = True
        for key in settings:
                if read == settings[key] or read == 'p':
                        canChange = False
        if canChange:
                Settings.setKey(settings,keyName,read)
                Menu.setButtonName(menu, read)
        Menu.showButtons(menu)
Ejemplo n.º 43
0
Archivo: menus.py Proyecto: Peaker/pyun
 def common_net_options(menu_is_enabled, leave_menu):
     return [
         Menu.Splitter(),
         Menu.EventOption(enabled_func = Menu.always,
                          action = game.save_net_config,
                          text = Menu.text('Save network options'),
                          keys = [],
                          description = 'Save options to net_config.py'),
         Menu.Splitter(),
         Menu.EventOption(enabled_func = menu_is_enabled,
                          action = leave_menu,
                          text = Menu.text('Leave Menu'),
                          keys = [config.CANCEL_KEY, config.MENU_KEY],
                          steal_key = True),
     ]
Ejemplo n.º 44
0
def show_data():
    # show all data in our diary
    Menu.clear()
    print('Date\t\tTemp\tPreasure\tHumidity\tWind Speed\tWind Direction\tPrecipitation')
    count = 0
    for i in W_diary.weather:
        print(i.isoformat() + '\t' + str(W_diary.weather[i][0]) +
              '\t' + str(W_diary.weather[i][1]) + '\t\t' +
              str(W_diary.weather[i][2]) + '\t\t' +
              str(W_diary.weather[i][3]) + '\t\t' +
              str(W_diary.weather[i][4]) +
              '\t\t' + str(W_diary.weather[i][5]))
        count += 1
    if not count:
        print('Diary is empty')
    input('Press Enter to continue...')
Ejemplo n.º 45
0
    def addMenu(self):
        self.Menu = Menu()
        self.Menu.setStatics()

        ##################### Bind the Menu Statics ##########################
        self.Bind(wx.EVT_MENU, self.onCredits, self.Menu.creditsMenu)
        self.Bind(wx.EVT_MENU, self.onHelp, self.Menu.helpMenu)
        self.Bind(wx.EVT_MENU, self.onExit, self.Menu.quitMenu)
        self.Bind(wx.EVT_MENU, self.alignNorth, self.Menu.alignItem.MenuItems[1])
        self.Bind(wx.EVT_MENU, self.alignSouth, self.Menu.alignItem.MenuItems[2])
        self.Bind(wx.EVT_MENU, self.alignEast, self.Menu.alignItem.MenuItems[3])
        self.Bind(wx.EVT_MENU, self.alignWest, self.Menu.alignItem.MenuItems[4])
        self.Bind(wx.EVT_MENU, self.alignNorthEast, self.Menu.alignItem.MenuItems[5])
        self.Bind(wx.EVT_MENU, self.alignNorthWest, self.Menu.alignItem.MenuItems[6])
        self.Bind(wx.EVT_MENU, self.alignSouthEast, self.Menu.alignItem.MenuItems[7])
        self.Bind(wx.EVT_MENU, self.alignSouthWest, self.Menu.alignItem.MenuItems[8])
        self.Bind(wx.EVT_MENU, self.alignNeutral, self.Menu.alignItem.MenuItems[0])
        self.Bind(wx.EVT_MENU, self.setZoom, self.Menu.zoomMenu)
        self.Bind(wx.EVT_MENU, self.initRefresh, self.Menu.refreshMenu)
        self.Bind(wx.EVT_MENU, self.initPause, self.Menu.pauseMenu)
        self.Bind(wx.EVT_MENU, self.initFS, self.Menu.fsMenu)
        self.Bind(wx.EVT_MENU, self.pictionaryHK, self.Menu.hkItem.MenuItems[0])
        self.Bind(wx.EVT_MENU, self.deathmatchHK, self.Menu.hkItem.MenuItems[1])
        self.Bind(wx.EVT_MENU, self.shamanHK, self.Menu.hkItem.MenuItems[2])
        self.Bind(wx.EVT_MENU, self.transformapHK, self.Menu.hkItem.MenuItems[3])
        self.Bind(wx.EVT_MENU, self.tribeHouseHK, self.Menu.hkItem.MenuItems[4])
        self.Bind(wx.EVT_MENU, self.eventHK, self.Menu.hkItem.MenuItems[5])
        self.Bind(wx.EVT_MENU, self.disableHK, self.Menu.hkItem.MenuItems[6])
        self.Bind(wx.EVT_MENU, self.initScrn, self.Menu.scrnMenu)
        self.Bind(wx.EVT_MENU, self.onSettings, self.Menu.settingMenu)

        for x in range(13):
            self.Bind(wx.EVT_MENU, self.saveXML, self.Menu.saveItem.MenuItems[x])

        self.SetMenuBar(self.Menu.MenuBar)
Ejemplo n.º 46
0
Archivo: menus.py Proyecto: Peaker/pyun
 def netconfig_bool_option(pretty_name, net_config_name,
                           description):
     return Menu.BooleanOption(enabled_func = Menu.always,
                               option_name = Menu.text(pretty_name),
                               accessor = game._net_config_accessor(net_config_name),
                               keys = [],
                               description = description,
                               **net_config_kw)
Ejemplo n.º 47
0
def checkMenuClick(data):
    mouseStatus = pygame.mouse.get_pressed()
    if Menu.checkRegion(data) == 4 and mouseStatus[0] == 1:
        print 'menu clicked'
        if data.mode == 'run':
            data.mode = 'pause'
        elif data.mode == 'pause':
            data.mode = 'run'
Ejemplo n.º 48
0
 def action(self):
     ecranOption = Menu.menuOption("images/menu/menu_option/background_menu_option.jpg", self.player)
     ecranOption.addButton(BoutonSound("images/menu/menu_option/on.png", 530, 255, self.player, True))
     ecranOption.addButton(BoutonMusic("images/menu/menu_option/on.png", 530, 325, self.player))
     ecranOption.addButton(BoutonReinitialiser("images/menu/menu_option/reset_profile.png",344 , 388, self.player))
     ecranOption.addButton(BoutonShop("images/menu/menu_option/shop.png",414 , 455, self.player))
     ecranOption.addButton(BoutonMenuPrincipal("images/menu/menu_option/back.png",460 , 543, self.player))
     ecranOption.afficher()
Ejemplo n.º 49
0
 def action(self):
     menuShop = Menu.menuShop("images/menu/menu_shop/background_menu_shop.jpg", self.player)
     menuShop.addButton(Article.Article("images/menu/menu_shop/item1_gold_skin", 70, 160, self.player, 0, 10000, True))
     menuShop.addButton(Article.Article("images/menu/menu_shop/item2_basic_weapon_lvl2", 70, 300, self.player, 1, 1000))
     menuShop.addButton(Article.Article("images/menu/menu_shop/item3_xtreme_weapon_lvl1", 70, 440, self.player, 2, 2000))
     menuShop.addButton(Article.Article("images/menu/menu_shop/item4_xtreme_weapon_lvl2", 70, 580, self.player, 3, 5000))
     menuShop.addButton(Article.Article("images/menu/menu_shop/item5_booster", 70, 720, self.player, 4, 500))
     menuShop.addButton(Article.Article("images/menu/menu_shop/item6_spoiler", 70, 860, self.player, 5, 750))
     menuShop.addButton(Article.ArticleMissile("images/menu/menu_shop/item7_missile", 70, 1000, self.player, 6, self.player.prixMissile))
     menuShop.afficher()
Ejemplo n.º 50
0
def main():
        pygame.init()
        global ventana
        Global.level=0
        pygame.mixer.music.load("sonidos/Malmen Facing TheSky.ogg")
        pygame.mixer.music.play()
        pygame.mixer.music.set_volume(0.3)


        pygame.display.set_caption("The Murderer Plant")
        fondoini=pygame.image.load("imag/tapa.jpg")
        fondo=pygame.image.load("imag/fondo1.jpg")
        
        Tapa=Menu()
       
        Raton=Puntero()
        while True:
                pygame.mouse.set_visible(False)
                while Global.level==0:
                        ventana.blit(fondoini,(0,0))
                        Tapa.dibujar(ventana)
                        posX,posY=pygame.mouse.get_pos()
                        Raton.dibujar(ventana,posX,posY)
                        for evento in pygame.event.get():
                                if evento.type == QUIT:
                                        pygame.quit()
                                        sys.exit()
                        #SI CHOCA CON BOTON JUGAR:
                        if Raton.rectimagpuntero.colliderect(Tapa.rectjugar):
                                if pygame.mouse.get_pressed()==(1,0,0):
                                        Global.level=1
                        if Raton.rectimagpuntero.colliderect(Tapa.recttutorial):
                                if pygame.mouse.get_pressed()==(1,0,0):
                                        Tapa.ElTutorial(ventana,Raton)
                        #SI CHOCA CON BOTON SALIR:
                        if Raton.rectimagpuntero.colliderect(360,480,85,30):
                                if pygame.mouse.get_pressed()==(1,0,0):
                                        pygame.quit()
                                        sys.exit()
                        pygame.display.update()
                if Global.level==1:
                        intro()
                        level1(Raton)
Ejemplo n.º 51
0
def checkMiniMapScroll(data):
    mouseStatus = pygame.mouse.get_pressed()
    mouseRegion = Menu.checkRegion(data)
    if mouseRegion == 1:
        mMapx, mMapy = Menu.getMiniMapOrigin()
        if mouseStatus[0] == 1:
            DestX, DestY = data.mouseX - 20, data.mouseY-20
            data.ViewBox.x = DestX - mMapx
            data.ViewBox.y = DestY - mMapy
            if data.ViewBox.x < 0:
                data.ViewBox.x = 0
            if data.ViewBox.x > 128-40:
                data.ViewBox.x = 128-40
            if data.ViewBox.y < 0:
                data.ViewBox.y = 0
            if data.ViewBox.y > 128-40:
                data.ViewBox.y = 128-40
            data.map.x =  -(data.ViewBox.x)*24
            data.map.y = -(data.ViewBox.y)*24
Ejemplo n.º 52
0
def init():
    # on initialise la fenetre curses
    curses.initscr()
    win = curses.newwin(30, 80, 0, 0)
    curses.noecho()
    curses.curs_set(0)
    win.nodelay(1)

    logging.basicConfig(filename='snake.log', level=logging.INFO)
    # creation du niveau
    level = Level.create(1, 'levels.txt')
    # creation du snake
    snake = Snake.create(35, 15, 1, 2)

    # creation du food
    food = None

    # creation du menu
    menu = Menu.create(
        'Change name',
        'Change difficulty',
        'Select level',
        'Show HighScores',
        'Play',
        'Quit game'
    )

    # definition de l'etat du programme
    state = 'menu'

    # definition du nom du joueur
    name = 'player1'

    # definition de la difficulte
    difficulty = 2

    score = -1

    HighScoreTable = HighScores.get()
    # creation de la variable de type game
    game = Game.create(
        menu,
        level,
        snake,
        food,
        win,
        state,
        name,
        difficulty,
        score,
        HighScoreTable
        )

    return game
Ejemplo n.º 53
0
def show_data_by_month():
    # show weather during chosen month
    Menu.clear()
    year = Input.get_year()
    month = Input.get_month()  # reading month number
    count = 0
    print('Date\t\tTemp\tPreasure\tHumidity\tWind Speed\tWind Direction\tPrecipitation')
    for i in W_diary.weather:                       # show all data about thise month that exsist in diary
        if (i.year == year) & (i.month == month):
            print(i.isoformat() + '\t' +
                  str(W_diary.weather[i][0]) + '\t' +
                  str(W_diary.weather[i][1]) + '\t\t' +
                  str(W_diary.weather[i][2]) + '\t\t' +
                  str(W_diary.weather[i][3]) + '\t\t' +
                  str(W_diary.weather[i][4]) + '\t\t' +
                  str(W_diary.weather[i][5]))
            count += 1
    if not count:
        print('Diary is empty')
    input('Press Enter to continue...')
Ejemplo n.º 54
0
def set_credits_menu():
    width = 1024
    height = 768
    pygame.display.init
    menu_screen = pygame.display.set_mode((width,height))
    # Background
    background = pygame.image.load(os.path.join('', 'images', 'creditos_menu_bg.jpg'))
    background = background.convert()

    # Cursor
    pygame.mouse.set_visible(False)
    cursor = Cursor(16,16,'images/cursor.png')

    #Options in menu
    back = Option(700,645,279,92,'images/voltar.png','images/voltar_big.png',main_menu, 1.182648402,0.05)

    # Menu
    menu = Menu()
    menu.append(back)
    
    menu.main_loop(cursor,menu_screen,background)
Ejemplo n.º 55
0
def redrawAll(data):

    data.map.resetMap()
    #ProtossBuildings.ProtossBuilding.drawAllBuildings()
    Building.building.drawAllBuildings()
    Unit.Unit.drawAllUnits()
    data.map.draw(data.screen)
    data.map.drawFogOfWar(data.screen,data.currentPlayer.index)
    if isinstance(data.selected,Unit.Unit):
        if data.buildMode == False and data.placeMode == False:
            if data.selected.canMove:
                if data.buttonStatus[0] == 1:
                    data.selected.drawMoves((0,200,0,100))

            if data.selected.canAttack:
                if data.buttonStatus[1] == 1:
                    data.selected.drawAttack((200,0,0,100))
    #drawGrid(data)
    drawMenu(data)
    Menu.drawMenu(data.screen, data.selected, data)
    Menu.drawAllBuildingsOnMiniMap(data.screen,data)
    Menu.drawAllUnitsOnMiniMap(data.screen,data)
    data.map.drawFogOfWarOnMiniMap(data.screen,data.currentPlayer.index)
    data.ViewBox.draw()
    drawSelected(data)

    if data.mode == 'pause':
        data.screen.blit(data.pauseMenu,(180,150))
    elif data.mode == 'help':
        data.screen.blit(load.load_image('Other/Help.png'),(0,0))
    pygame.display.flip()
Ejemplo n.º 56
0
def main_menu():

    pygame.display.init
    menu_screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))
    
    # Background
    background = pygame.image.load(os.path.join('', 'images', 'menu_bg.jpg'))
    background = background.convert()
    
    # Cursor
    pygame.mouse.set_visible(False)
    cursor = Cursor(16,16,'images/cursor.png')
    
    #Options in menu
    new_game = Option(300,250,161,63,'images/jogar.png','images/jogar_big.png',stage_select,1.248,0.05,True)
    creditos = Option(290,350,256,87,'images/creditos.png','images/creditos_big.png',set_credits_menu,1.85,0.05,True)

    # Menu
    main_menu = Menu()
    main_menu.append(new_game)
    main_menu.append(creditos)
    
    main_menu.main_loop(cursor,menu_screen,background)
Ejemplo n.º 57
0
    def pauseGame(self):
        '''Pauses the game by removing any taskmgr'''
        self.wp.setCursorHidden(False)
        base.win.requestProperties(self.wp)

        mat = Mat4(camera.getMat())
        mat.invertInPlace()
        base.mouseInterfaceNode.setMat(mat)
        base.enableMouse()

        self.menu = Menu(self.escMenu, self.wp, self.collisions)
        taskMgr.remove('update')
        taskMgr.remove('timerTask')
        self.menu.loadPauseMenu()
Ejemplo n.º 58
0
def checkPauseButtons(data):
    mouseStatus = pygame.mouse.get_pressed()
    region = Menu.checkPauseRegion(data)
    if mouseStatus[0] == 1:
        if region == 0:
            data.mode = 'help'
        elif  region == 1:
            # return to menu
            data.mode = 'start'
            data.frameCount = 0
        elif region == 2:
            data.mode = 'quit'
        elif region == 3:
            data.mode = 'run'