예제 #1
0
    def draw(self, screen, game_self):

        #draw the window of title and menu
        title_window = window.Window(Rect(20, 20, 180, 50))
        title_window.draw(screen)

        menu_window = window.Window(Rect(320, 20, 300, 120))
        menu_window.draw(screen)

        #draw the cursor on the menu item
        if self.menu == self.GO:
            pygame.draw.rect(screen, COLOR_GLAY, Rect(324, 35, 292, 30), 0)
        elif self.menu == self.CONTINUE:
            pygame.draw.rect(screen, COLOR_GLAY, Rect(324, 65, 292, 30), 0)
        elif self.menu == self.BACK:
            pygame.draw.rect(screen, COLOR_GLAY, Rect(324, 95, 292, 30), 0)

        #draw the font
        WINDOW_START_WIDTH = 300
        MENU_CENTER = SCREEN_RECTANGLE.width + WINDOW_START_WIDTH

        screen.blit(self.tower_font, (40, 35))

        #find movable character in the dungeon
        if self.find_alive_character == False:

            self.find_alive_character = True

            for chara in game_self.dungeon_characters:
                if chara.status[4] != 1 and chara.status[
                        5] != 1 and chara.status[6] != 1 and chara.status[
                            7] != 1 and chara.status[8] != 1:
                    self.dungeon_alive_characters.append(chara)

        if len(game_self.party.member) == 0:
            screen.blit(self.no_go_font,
                        ((MENU_CENTER - self.go_font.get_width()) / 2, 40))
        else:
            screen.blit(self.go_font,
                        ((MENU_CENTER - self.go_font.get_width()) / 2, 40))

        if len(game_self.tower.dungeon_alive_characters) == 0:
            screen.blit(
                self.no_continue_font,
                ((MENU_CENTER - self.continue_font.get_width()) / 2, 70))
        else:
            screen.blit(
                self.continue_font,
                ((MENU_CENTER - self.continue_font.get_width()) / 2, 70))

        screen.blit(self.back_font,
                    ((MENU_CENTER - self.back_font.get_width()) / 2, 100))

        if self.character_continue != None:
            self.character_continue.draw(
                screen, game_self.tower.dungeon_alive_characters)
예제 #2
0
파일: client.py 프로젝트: sahwar/pyndow
    def __init__(self, wid):
        self.win = window.Window(wid)

        self.workspace = None
        self.mapped = False
        self.initial_map = False
        self.__unmap_ignore = 0

        self.strut = self.strut_partial = None

        state.conn.core.ChangeWindowAttributes(
            self.win.id, xcb.xproto.CW.EventMask, [
                xcb.xproto.EventMask.StructureNotify
                | xcb.xproto.EventMask.PropertyChange
            ])

        events.register_callback(xcb.xproto.ConfigureRequestEvent,
                                 self.cb_ConfigureRequestEvent, self.win.id)
        events.register_callback(xcb.xproto.MapRequestEvent,
                                 self.cb_MapRequestEvent, self.win.id)
        events.register_callback(xcb.xproto.DestroyNotifyEvent,
                                 self.cb_DestroyNotifyEvent, self.win.id)
        events.register_callback(xcb.xproto.UnmapNotifyEvent,
                                 self.cb_UnmapNotifyEvent, self.win.id)
        events.register_callback(xcb.xproto.PropertyNotifyEvent,
                                 self.cb_PropertyNotifyEvent, self.win.id)
        events.register_callback(xcb.xproto.ClientMessageEvent,
                                 self.cb_ClientMessageEvent, self.win.id)

        self.win.configure(border_width=0)
예제 #3
0
파일: main.py 프로젝트: yux1991/PyRHEED
 def __init__(self):
     config = configparser.ConfigParser()
     config.read('./configuration.ini')  #Read the configuration file
     app = QtWidgets.QApplication(sys.argv)
     icon = QtGui.QIcon('./icons/icon.png')
     app.setWindowIcon(icon)
     self.window = window.Window(
         config
     )  #Initialze the main window using the default values in the configuration
     self.window.showMaximized()
     #self.window.setFixedSize(1600,1000)
     self.window.show()
     #Connect the signals emitted by the window object
     self.window.DEFAULT_PROPERTIES_REQUESTED.connect(self.run_preference)
     self.window.RECIPROCAL_SPACE_MAPPING_REQUESTED.connect(
         self.run_reciprocal_space_mapping)
     self.window.BROADENING_REQUESTED.connect(self.run_broadening)
     self.window.GMM_REQUESTED.connect(self.run_gmm)
     self.window.MANUAL_FIT_REQUESTED.connect(self.run_manual_fit)
     self.window.GENERATE_REPORT_REQUESTED.connect(self.run_generate_report)
     self.window.STATISTICAL_FACTOR_REQUESTED.connect(
         self.run_statistical_factor)
     self.window.DIFFRACTION_PATTERN_REQUESTED.connect(
         self.run_simulate_RHEED)
     self.window.KIKUCHI_PATTERN_REQUESTED.connect(self.run_kikuchi)
     self.window.THREE_DIMENSIONAL_GRAPH_REQUESTED.connect(
         self.run_3D_graph)
     self.window.SCENARIO_REQUESTED.connect(self.run_scenario)
     self.preference = preference.Window()
     self.preference.DEFAULT_SETTINGS_CHANGED.connect(self.window.refresh)
     sys.exit(app.exec_())
예제 #4
0
파일: main.py 프로젝트: GabMus/Bottles
    def do_activate(self):

        self.win = wn.Window()

        self.wine = w.Wine(self.win)
        self.wine.check_work_dir()

        self.win.set_default_size(550, 600)
        self.win.set_resizable(False)
        self.win.connect("delete-event", Gtk.main_quit)

        parser = argparse.ArgumentParser(
            description=cn.App.application_description)
        parser.add_argument('--about',
                            action='store_true',
                            help='About ' + cn.App.application_name)
        args = parser.parse_args()
        if args.about == True:
            self.show_about(self.win)
        else:
            self.win.show_all()
            self.win.hbar.back.hide()
            self.win.hbar.save.hide()
            self.win.hbar.trash.hide()
            self.win.hbar.properties.hide()

        Gtk.main()
def main():
    """main function"""
    log.printMSG("[MAINTHREAD][INFO] creating window")
    import Inventory.inventory
    import window

    # window = window.Window(width=800, height=600, caption='mcp#ython 2', resizable=True)
    try:
        # Try and create a window with multisampling (antialiasing)
        config = Config(
            sample_buffers=1,
            samples=4,
            depth_size=16,
            double_buffer=True,
        )
        window = window.Window(
            resizable=True,
            config=config,
            width=1200,
            height=620,
            caption="mcpython " + str(G.VERSION_NAME),
        )
    except pyglet.window.NoSuchConfigException:
        # Fall back to no multisampling for old hardware
        window = pyglet.window.Window(resizable=True,
                                      width=1200,
                                      height=620,
                                      caption="mcpython 2")
    # Hide the mouse cursor and prevent the mouse from leaving the window.
    log.printMSG("[MAINTHREAD][INFO] setting up OpenGL")
    window.set_exclusive_mouse(True)
    glfunctions.setup()
    log.printMSG("[MAINTHREAD][INFO] nothing to do here, starting pyglet")
    pyglet.app.run()
예제 #6
0
파일: main.py 프로젝트: MalteKiefer/invoicy
    def do_activate(self):
        self.win = wn.Window()
        self.win.set_size_request(400, 400)
        self.win.connect("delete-event", Gtk.main_quit)
        self.win.show_all()

        Gtk.main()
예제 #7
0
    def __init__(self, rectangle, floor, game_self):

        window.Window.__init__(self, rectangle)
        self.is_visible = False

        self.top = rectangle.top
        self.left = rectangle.left
        self.right = rectangle.right
        self.centerx = rectangle.centerx

        self.menu_font = pygame.font.Font("ipag.ttf", 20)

        self.encount_font = self.menu_font.render(u"何者かが現れた!", True,
                                                  COLOR_WHITE)

        self.select_font = self.menu_font.render(u"何をしますか?", True, COLOR_WHITE)

        self.info_font = self.menu_font.render(u"情報を貰う", True, COLOR_WHITE)
        self.item_font = self.menu_font.render(u"アイテムを貰う", True, COLOR_WHITE)
        self.buy_font = self.menu_font.render(u"アイテムを買う", True, COLOR_WHITE)
        self.heal_font = self.menu_font.render(u"回復してもらう", True, COLOR_WHITE)
        #if alignment is neutral or evil only
        self.battle_font = self.menu_font.render(u"襲う", True, COLOR_WHITE)
        self.end_font = self.menu_font.render(u"立ち去る", True, COLOR_WHITE)

        self.trade_font = self.menu_font.render(u"交渉値", True, COLOR_WHITE)
        #calculate merchant level
        self.left_font = self.menu_font.render(u"残り:", True, COLOR_WHITE)

        self.not_enough_point_font = self.menu_font.render(
            u"交渉値が足りません!", True, COLOR_WHITE)

        self.merchant_point = 0

        self.menu = self.INFO

        self.state = self.INIT

        self.first = 0
        self.encount_window = window.Window(Rect(210, 120, 190, 60))

        self.use_points = 0

        self.message_window = None

        self.party_alignment = random.randint(-6, 6)

        self.alignment_difference = int(
            math.fabs(self.party_alignment - game_self.party.alignment))

        self.relation = self.NEUTRAL

        if self.alignment_difference <= 2:
            self.relation = self.GOOD
        elif self.alignment_difference <= 4:
            self.relation = self.NEUTRAL
        elif self.alignment_difference <= 5:
            self.relation = self.EVIL
        else:
            self.relation = self.WORST
예제 #8
0
    def __init__(self, window_config, ball_config, pad_config,
                 bricks_config_list):
        """Конструктор Контроллера.
		Принимает объекты, которыми будет управлять контроллер: окно, мяч, ракетку, список кирпичей.
		Устанавливает начальное состояние игры:
		количество попыток игрока, нулевое начальное значение счета (разрушенных кирпичей).
		Сохраняет ссылки на контролируемые объекты."""
        self.HP = 3  # Три попытки
        self.score = 0  # Начальный нулевой счёт
        self.window = window.Window(
            window_config[0],
            window_config[1],
            window_config[2],
        )
        self.ball = ball.Ball(self.window, ball_config[0], ball_config[1],
                              ball_config[2], ball_config[5])
        self.ball.set_speed(ball_config[3], ball_config[4])
        self.pad = pad.Pad(self.window, pad_config[0], pad_config[1],
                           pad_config[2])
        self.brick_list = [
            brick.Brick(self.window, brick_config[0], brick_config[1],
                        brick_config[2], brick_config[3], brick_config[4])
            for brick_config in bricks_config_list
        ]
        self.max_score = len(
            self.brick_list)  # Счёт, при котором игрок победит
        # Привязка нажатия и отпускания клавиш к функции управления скоростью ракетки:
        self.window.canvas.bind("<KeyPress>", self.pad_speed_control)
        self.window.canvas.bind("<KeyRelease>", self.pad_speed_control)
예제 #9
0
def run_game():
    """
	Glowna funkcja gry
	"""
    size = int(input("Podaj ilosc pol w zakresie 3 - 10: "))
    while (size < 3 or size > 10):
        size = int(input("Podaj ilosc pol w zakresie 3 - 10: "))
    winCombo = int(
        input(
            "Podaj ilosc znakow w rzedzie wygrywajacych w zakresie od 3 do ilosci pol: "
        ))
    while (winCombo < 3 or winCombo > size):
        winCombo = int(
            input(
                "Podaj ilosc znakow w rzedzie wygrywajacych w zakresie od 3 do ilosci pol: "
            ))
    pg.init()  #inicjalizacja fukcji biblioteki PyGame
    wd = window.Window(size, winCombo)  #inicjalizacja okna gry
    wd.winArr()  #stworzenie wygrywajacych ukladow
    wd.draw_area()  #rysowanie planszy
    gm = game.Game(wd, winCombo)  #inicjalizacja mechaniki gry
    while True:
        events.check_events(wd, gm, size)  #sprawdzanie wydarzen
        wd.update_area(gm)  #odswiezanie planszy
        pg.display.update()  #wyswietlanie aktualnego stanu
예제 #10
0
파일: main.py 프로젝트: rushyam/DigiCon-1
def run():
    app = window.QtGui.QApplication(sys.argv)
    sshFile = './stylesheet/darkOrange.stylesheet'
    with open(sshFile, 'r') as fh:
        app.setStyleSheet(fh.read())
    app.setStyleSheet(window.qdarkstyle.load_stylesheet_pyqt())
    _GUI = window.Window()
    sys.exit(app.exec_())
예제 #11
0
def main():
    voiceAssistant = assistant.Assistant()
    if platform.system() != "Linux":
        voiceAssistant.say("Error. It is only for Linux")
        sys.exit()
    master = Tk()
    window.Window(master, voiceAssistant)
    master.mainloop()
예제 #12
0
 def do_activate(self):
     win = wn.Window()
     win.set_size_request(640, 480)
     win.set_resizable(True)
     win.set_position(Gtk.WindowPosition.CENTER)
     win.connect("delete-event", Gtk.main_quit)
     win.show_all()
     Gtk.main()
예제 #13
0
    def __init_windows(self):
        hh, ww, cc = config.set_size(self.stdscr)

        win = threadwin.Threadwin(hh, cc - ww, 0, ww)
        data = [
            menu.Music_menu(win=win,
                            data=playlist.Playlist(name=pl, db=self.db),
                            form=config.SONG_DISP,
                            palette=self.palette[0],
                            ui=self) for pl in self.db.list_pl()
        ]

        leftwin = menu.Menu(0, 0, ww, hh, data=data, palette=self.palette[1])

        botwin = window.Window(0, hh, cc, song_info_bar_height)
        textwin = window.Window(0, hh + song_info_bar_height, cc,
                                command_bar_height)
        return leftwin, botwin, textwin
예제 #14
0
def main():
    """Wykonuje główną pętlę gry."""

    pygame.init()
    pygame.display.set_caption("TIC-TAC-TOE Game!")
    game_window = window.Window()
    game_window.first_player()
    game_window.draw_board()
    game_window.run()
예제 #15
0
    def __init__(self):
        self.window = window.Window(parent=self)
        self.lecture = lecture.Lecture()
        self.player = player.Player()
        self.songs = []
        self.filepath = ""

        self.window.set_content(self.lecture)
        self.lecture.set_player(self.player)
        self.window.show()
예제 #16
0
    def do_activate(self):
        self.win = window.Window()
        self.win.set_default_size(700, 400)
        self.win.connect("delete-event", Gtk.main_quit)
        self.win.show_all()
        self.win.stack.updates.noti_grid.hide()
        self.win.stack.updates.notifications_title.hide()
        self.win.stack.updates.notifications_label.hide()

        Gtk.main()
예제 #17
0
    def do_activate(self):
        self.win = wn.Window()
        self.win.set_default_size(530, 600)
        self.win.props.width_request = 680
        self.win.props.resizable = False
        self.win.connect("delete-event", Gtk.main_quit)
        
        self.win.show_all()

        Gtk.main()
예제 #18
0
 def getWindows(clzName='.*', title='.*'):
     wList = []
     ret = []
     win32gui.EnumWindows(lambda hWnd, param: param.append(hWnd), wList)
     for whand in wList:
         wind = window.Window(whand)
         if re.fullmatch(clzName, wind.clz) and re.fullmatch(
                 title, wind.title):
             ret.append(whand)
     return ret
예제 #19
0
    def __init__(self, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)

        self.imagewindow = window.Window(self, -1)

        clearplugin = plugins.ClearPlugin(self.imagewindow)
        self.imagewindow.addPlugin(clearplugin)

        self.numarrayplugin = plugins.NumpyPlugin(self.imagewindow)
        self.imagewindow.addPlugin(self.numarrayplugin)

        self.crosshairsplugin = plugins.CrosshairsPlugin(self.imagewindow,
                                                 self.numarrayplugin)
        self.imagewindow.addPlugin(self.crosshairsplugin)

        self.magnifierplugin = plugins.MagnifierPlugin(self.imagewindow,
                                                        self.numarrayplugin)
        self.imagewindow.addPlugin(self.magnifierplugin)

        self.tooltipplugin = plugins.ToolTipPlugin(self.imagewindow)
        self.imagewindow.addPlugin(self.tooltipplugin)

        self.targetsplugin = plugins.TargetsPlugin(self.imagewindow,
                                                    self.numarrayplugin,
                                                    wx.RED)
        self.imagewindow.addPlugin(self.targetsplugin)

        self.tools = Tools(self, -1)

        self.sizer = wx.GridBagSizer(0, 0)
        self.sizer.Add(self.tools, (0, 0), (1, 1), wx.EXPAND)
        self.sizer.Add(self.imagewindow, (1, 0), (1, 1),
                        wx.EXPAND|wx.FIXED_MINSIZE)

        self.sizer.AddGrowableCol(0)
        self.sizer.AddGrowableRow(1)

        self.SetSizer(self.sizer)
        self.SetAutoLayout(True)

        self.tools.infobitmap.Bind(wx.EVT_LEFT_UP, self.onInfoBitmap)
        self.tools.displaybitmap.Bind(wx.EVT_LEFT_UP, self.onDisplayBitmap)
        self.tools.valuescalebitmap.Bind(wx.EVT_LEFT_UP,
                                          self.onValueScaleBitmap)

        self.tools.Bind(events.EVT_DISPLAY_CROSSHAIRS, self.onDisplayCrosshairs)
        self.tools.Bind(events.EVT_DISPLAY_MAGNIFIER, self.onDisplayMagnifier)
        self.tools.Bind(events.EVT_SCALE_SIZE, self.onScaleSize)
        self.tools.Bind(events.EVT_FIT_TO_PAGE, self.onFitToPage)
        self.tools.Bind(events.EVT_SCALE_VALUES, self.onScaleValues)

        self.imagewindow.Bind(wx.EVT_MOTION, self.onMotion)

        self.onDisplayCrosshairs()
        self.onDisplayMagnifier()
예제 #20
0
def main():
    """ Run the main program """
    parser = argparse.ArgumentParser(
        description='Run a Trans America simulation.')
    parser.add_argument(
        '--geometry',
        dest='geometry',
        metavar='WxH',
        default='1600x900',
        help='Specify width and height to display (i.e. 1024x768)')
    parser.add_argument(
        'players',
        action='store',
        nargs='*',
        metavar='player',
        help='Specify the name of one or more AI to run as a player',
        default='simple')
    parser.add_argument('--view',
                        action='store_true',
                        dest='view',
                        default=False,
                        help='If specified, you can watch the game play out.')
    parser.add_argument(
        '--scaled',
        action='store_true',
        dest='scaled',
        default=False,
        help='If specified, scale the map to be human comfortable.')
    parser.add_argument(
        '--wait',
        action='store_true',
        dest='wait',
        default=False,
        help='Wait for the user to press the "w" key for each turn to proceed.'
    )
    parser.add_argument(
        '--tournament',
        dest='tournament',
        metavar='rounds',
        type=int,
        help='Play a tournament of the given number of rounds.')

    args = parser.parse_args()

    board = Board()

    win = None
    if args.view:
        width, height = lookup_geometry(args)
        win = window.Window(width, height, args.scaled)

    if args.tournament:
        run_tournament(args, board, win)
    else:
        run_one(args, board, win)
예제 #21
0
def main():
    if globals.DEBUG > 0:
        g_code_generator.generate_debug_patterns()
    else:
        root = Tk()
        w = window.Window(root)
        #size of the window
        root.geometry("1200x1000")
        root.title("converter")
        #root.configure(background='#CCCCFF')
        root.mainloop()
예제 #22
0
    def do_activate(self):
        '''Here we are creating a new instante of the Windows, setting its 
        size and connecting the delete-event signal to correctly handle 
        the application exit.'''
        self.win = wn.Window()
        self.win.set_default_size(600, 600)
        self.win.connect("delete-event", Gtk.main_quit)

        self.win.show_all()

        Gtk.main()
예제 #23
0
 def _parse(self, response):
     windows = []
     for w in response.windows:
         tabs = []
         for t in w.tabs:
             sessions = []
             for s in t.sessions:
                 sessions.append(session.Session(s.uniqueIdentifier))
             tabs.append(tab.Tab(t.tab_id, sessions))
         windows.append(window.Window(w.window_id, tabs))
     self.windows = windows
예제 #24
0
    def show_window_info(whand):
        if isinstance(whand, int):
            w = window.Window(whand)

        print("handle(dec): " + str(whand))
        print("handle(hex): " + str(hex(whand)))
        print("title: " + w.title)
        print("class: " + w.clz)
        print("start: " + str(w.startPoint))
        print("width: " + str(w.width))
        print("height: " + str(w.height))
예제 #25
0
def runTests():
    "just create a window with some colored panels"
    test = window.Window()
    test.p1 = window.Window.ControlPanel(test, bg="green")
    test.p1.pack(fill=window.BOTH, expand=True)
    buttonNames = ("Close", "Open", "Whatever")
    test.p2 = window.Window.ButtonPanel(test, buttonNames, bg="blue")
    test.p2.buttons[0].config(command=test.destroy)
    test.p2.pack(side=window.BOTTOM, fill=window.X, expand=True)
    window.Label(test, text="this is a label").pack()
    window.Entry(test).pack()
    test.mainloop()
예제 #26
0
    def do_activate(self):
        self.win = wn.Window()
        self.win.set_default_size(1400, 800) 
        self.win.connect("delete-event", Gtk.main_quit)

        parser = argparse.ArgumentParser(description = cn.App.application_description)
        parser.add_argument('--about', action='store_true', help='About '+cn.App.application_name)
        args = parser.parse_args()
        if args.about == True:
            self.show_about(self.win)
        else:
            self.win.show_all()

        Gtk.main()
예제 #27
0
    def draw(self, screen, game_self):
        if self.is_visible == False: return

        if self.state == self.INIT:
            if self.first == 0:
                encount_se = pygame.mixer.Sound("SE/thunder.wav")
                encount_se.play()
                pygame.mixer.music.stop()
                self.first = 1
                self.merchant_point = dungeon.calculate_merchant_level(
                    game_self)

            self.encount_window.draw(screen)
            screen.blit(self.encount_font, (230, 140))

        elif self.state == self.COMMAND:

            window.Window.draw(self, screen)

            pygame.draw.rect(
                screen, COLOR_GLAY,
                Rect(self.left + 4, self.top + 45 + 30 * self.menu,
                     (self.right - self.left) - 8, 30), 0)

            if self.menu != self.END:
                points_font = self.menu_font.render(str(self.use_points), True,
                                                    COLOR_WHITE)
                screen.blit(points_font,
                            (self.right - 60, self.top + 50 + self.menu * 30))

            screen.blit(self.select_font, (self.left + 20, self.top + 20))
            screen.blit(self.info_font, (self.left + 20, self.top + 50))
            screen.blit(self.item_font, (self.left + 20, self.top + 80))
            screen.blit(self.buy_font, (self.left + 20, self.top + 110))
            screen.blit(self.heal_font, (self.left + 20, self.top + 140))
            screen.blit(self.battle_font, (self.left + 20, self.top + 170))
            screen.blit(self.end_font, (self.left + 20, self.top + 200))

            self.points_window = window.Window(Rect(310, 320, 200, 60))
            self.points_window.draw(screen)

            screen.blit(self.left_font, (330, 340))
            total_points = self.menu_font.render(str(self.merchant_point),
                                                 True, COLOR_WHITE)
            screen.blit(total_points, (350 + self.left_font.get_width(), 340))

            if self.message_window != None:
                self.message_window.draw(screen, game_self)

        pass
예제 #28
0
    def draw(self, screen, game_self):

        #draw window for title and menu
        title_window = window.Window(Rect(20, 20, 135, 50))
        title_window.draw(screen)

        screen.blit(self.temple_font, (35, 35))

        menu_window = window.Window(Rect(320, 20, 300, 120))
        menu_window.draw(screen)

        #set cursor on menu items
        if self.menu == self.CURE:
            #draws rectangle on the menu item size of rectangle has width of window rectangle - edge_length*2
            #the height depends on the size of font
            pygame.draw.rect(screen, COLOR_GLAY, Rect(324, 35, 292, 30), 0)
        elif self.menu == self.DONATE:
            pygame.draw.rect(screen, COLOR_GLAY, Rect(324, 65, 292, 30), 0)
        elif self.menu == self.BACK:
            pygame.draw.rect(screen, COLOR_GLAY, Rect(324, 95, 292, 30), 0)

        #draw image font on the screen
        WINDOW_START_WIDTH = 300
        MENU_CENTER = SCREEN_RECTANGLE.width + WINDOW_START_WIDTH

        screen.blit(self.cure_font,
                    ((MENU_CENTER - self.cure_font.get_width()) / 2, 40))
        screen.blit(self.donate_font,
                    ((MENU_CENTER - self.donate_font.get_width()) / 2, 70))
        screen.blit(self.back_font,
                    ((MENU_CENTER - self.back_font.get_width()) / 2, 100))

        #draw extra window
        if self.donate_money != None:
            self.donate_money.draw(screen, game_self.party.member)
        if self.temple_cure_window != None:
            self.temple_cure_window.draw(screen, game_self)
예제 #29
0
 def test_default(self):
     win = window.Window((10, 10), image=pygame.Surface((100, 100)))
     win.set_default_alpha(150)
     self.assertEqual(win.real_image, win.image)
     self.assertEqual(win.real_image, win._draw_image)
     self.assertEqual(win.rect.size, (10, 10))
     self.assertTrue(isinstance(win._state, window.PassiveWindowState))
     self.assertEqual(win._hint_message, None)
     self.assertEqual(win._default_alpha, 150)
     self.assertEqual(win.image.get_alpha(), 150)
     self.assertFalse(win._bordered)
     self.assertFalse(win._constant_bordered)
     self.assertFalse(win._never_bordered)
     self.assertEqual(win._borders_size, configs.BORDERS_SIZE)
     self.assertEqual(win._borders_color, configs.BORDERS_COLOR)
예제 #30
0
def setup(title,
          skyColor=(0.5, 0.69, 1.0, 1),
          fog=True,
          fogStart=10.0,
          fogEnd=30.0,
          ticks=60,
          screen_w=800,
          screen_h=600,
          screen_resizable=True,
          mouse_cap=True):
    """
    Basic configurations and window creation
    """
    window.TICKS_PER_SEC = ticks
    win = window.Window(width=screen_w,
                        height=screen_h,
                        caption=title,
                        resizable=screen_resizable)
    win.set_exclusive_mouse(mouse_cap)
    # Set the color of "clear", i.e. the sky, in rgba.
    glClearColor(*skyColor)
    # Enable culling (not rendering) of back-facing facets -- facets that aren't
    # visible to you.
    # glEnable(GL_CULL_FACE)
    # Set the texture minification/magnification function to GL_NEAREST (nearest
    # in Manhattan distance) to the specified texture coordinates. GL_NEAREST
    # "is generally faster than GL_LINEAR, but it can produce textured images
    # with sharper edges because the transition between texture elements is not
    # as smooth."
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    if fog:
        # Enable fog. Fog "blends a fog color with each rasterized pixel fragment's
        # post-texturing color."
        glEnable(GL_FOG)
        # Set the fog color.
        glFogfv(GL_FOG_COLOR, (GLfloat * 4)(*skyColor))
        # Say we have no preference between rendering speed and quality.
        glHint(GL_FOG_HINT, GL_DONT_CARE)
        # Specify the equation used to compute the blending factor.
        glFogi(GL_FOG_MODE, GL_LINEAR)
        # How close and far away fog starts and ends. The closer the start and end,
        # the denser the fog in the fog range.
        glFogf(GL_FOG_START, fogStart)
        glFogf(GL_FOG_END, fogEnd)
    return win