コード例 #1
0
ファイル: ui.py プロジェクト: EricsonWillians/ArcRacer
 def __init__(self):
     self.panel = widgets.Panel(
         core.Grid((3, 9),
                   (options["RESOLUTION"][0], options["RESOLUTION"][1])),
         None, None, (0, 0))
     self.panel.set_color(core.BLACK)
     self.title = widgets.TextLabel(
         self.panel, (0, 0),
         core.Text("ArcRacer", TITLE_SIZE, MENU_COLOR, MENU_FONT, MENU_BOLD,
                   True))
     self.title.text.font.set_bold(True)
     self.title.set_alignment(widgets.TextLabel.ALIGN_CENTER)
     self.title.set_span((2, 1))
     self.buttons = [
         widgets.TextButton(
             self.panel, (1, 3),
             core.Text("Single Player", MENU_SIZE, MENU_COLOR, MENU_FONT,
                       MENU_BOLD)),
         widgets.TextButton(
             self.panel, (1, 4),
             core.Text("Multiplayer", MENU_SIZE, MENU_COLOR, MENU_FONT,
                       MENU_BOLD)),
         widgets.TextButton(
             self.panel, (1, 5),
             core.Text("Custom Game", MENU_SIZE, MENU_COLOR, MENU_FONT,
                       MENU_BOLD)),
         widgets.TextButton(
             self.panel, (1, 6),
             core.Text("Exit", MENU_SIZE, MENU_COLOR, MENU_FONT, MENU_BOLD))
     ]
     [b.set_color(core.BLACK) for b in self.buttons]
     [b.set_alignment(widgets.TextLabel.ALIGN_CENTER) for b in self.buttons]
     [b.set_border(core.WHITE, 16) for b in self.buttons]
コード例 #2
0
ファイル: ui.py プロジェクト: EricsonWillians/ArcRacer
 def __init__(self):
     self.panel = widgets.Panel(
         core.Grid((1, 1),
                   (options["RESOLUTION"][0], options["RESOLUTION"][1])),
         None, None, (0, 0))
     self.title = widgets.TextLabel(
         self.panel, (0, 0),
         core.Text("Paused", 64, core.WHITE, "arial", True, True))
コード例 #3
0
ファイル: ui.py プロジェクト: EricsonWillians/ArcRacer
 def __init__(self, gm):
     self.panel = widgets.Panel(
         core.Grid((6, 12),
                   (options["RESOLUTION"][0], options["RESOLUTION"][1])),
         None, None, (0, 0))
     self.panel.set_color(core.BLACK)
     self.title = widgets.TextLabel(
         self.panel, (0, 0),
         core.Text("Race Options", TITLE_SIZE, RACE_OPTIONS_MENU_COLOR,
                   RACE_OPTIONS_MENU_FONT, RACE_OPTIONS_MENU_BOLD,
                   MENU_ITALIC))
     self.title.text.font.set_bold(True)
     self.title.set_alignment(widgets.TextLabel.ALIGN_CENTER)
     self.title.set_span((5, 1))
     self.components = [
         widgets.TextButton(
             self.panel, (1, 3),
             core.Text("Start Race", RACE_OPTIONS_MENU_SIZE,
                       RACE_OPTIONS_MENU_COLOR, RACE_OPTIONS_MENU_FONT,
                       RACE_OPTIONS_MENU_BOLD, RACE_OPTIONS_MENU_ITALIC)),
         widgets.TextLabel(
             self.panel, (1, 4),
             core.Text("Players", RACE_OPTIONS_MENU_SIZE,
                       RACE_OPTIONS_MENU_COLOR, RACE_OPTIONS_MENU_FONT,
                       RACE_OPTIONS_MENU_BOLD, RACE_OPTIONS_MENU_ITALIC)),
         widgets.OptionChooser(self.panel, (3, 4),
                               [str(n) for n in range(0, 6)]),
         widgets.TextLabel(
             self.panel, (1, 5),
             core.Text("Humans", RACE_OPTIONS_MENU_SIZE,
                       RACE_OPTIONS_MENU_COLOR, RACE_OPTIONS_MENU_FONT,
                       RACE_OPTIONS_MENU_BOLD, RACE_OPTIONS_MENU_ITALIC)),
         widgets.OptionChooser(self.panel, (3, 5),
                               [str(n) for n in range(0, 3)]),
         widgets.TextLabel(
             self.panel, (1, 6),
             core.Text("Difficulty", RACE_OPTIONS_MENU_SIZE,
                       RACE_OPTIONS_MENU_COLOR, RACE_OPTIONS_MENU_FONT,
                       RACE_OPTIONS_MENU_BOLD, RACE_OPTIONS_MENU_ITALIC)),
         widgets.OptionChooser(
             self.panel, (3, 6),
             ["Easy", "Normal", "Hard", "Insane", "Arcturian"], 1),
         widgets.TextLabel(
             self.panel, (1, 7),
             core.Text("Laps", RACE_OPTIONS_MENU_SIZE,
                       RACE_OPTIONS_MENU_COLOR, RACE_OPTIONS_MENU_FONT,
                       RACE_OPTIONS_MENU_BOLD, RACE_OPTIONS_MENU_ITALIC)),
         widgets.OptionChooser(
             self.panel, (3, 7),
             ["5", "10", "15", "20", "25", "30", "35", "40", "45", "50"],
             2),
         widgets.TextLabel(
             self.panel, (1, 8),
             core.Text("Track", RACE_OPTIONS_MENU_SIZE,
                       RACE_OPTIONS_MENU_COLOR, RACE_OPTIONS_MENU_FONT,
                       RACE_OPTIONS_MENU_BOLD, RACE_OPTIONS_MENU_ITALIC)),
         widgets.OptionChooser(self.panel, (3, 8), gm.get_track_list()),
         widgets.TextButton(
             self.panel, (1, 9),
             core.Text("Return", RACE_OPTIONS_MENU_SIZE,
                       RACE_OPTIONS_MENU_COLOR, RACE_OPTIONS_MENU_FONT,
                       RACE_OPTIONS_MENU_BOLD, RACE_OPTIONS_MENU_ITALIC))
     ]
     [c.set_color(core.BLACK) for c in self.components]
     [
         c.set_alignment(widgets.TextLabel.ALIGN_CENTER)
         if not isinstance(c, widgets.OptionChooser) else
         c.label.set_alignment(widgets.TextLabel.ALIGN_CENTER)
         for c in self.components
     ]
     [
         c.set_span((1, 0)) if c != self.components[0]
         and c != self.components[len(self.components) - 1] else c.set_span(
             (3, 0)) for c in self.components
     ]
     [c.set_border(core.WHITE, 16) for c in self.components]
コード例 #4
0
ファイル: ui.py プロジェクト: EricsonWillians/ArcRacer
    def __init__(self, gm):
        self.panel = widgets.Panel(
            core.Grid((6, 16),
                      (options["RESOLUTION"][0], options["RESOLUTION"][1])),
            None, None, (0, 0))
        self.panel.set_color(core.BLACK)

        self.title = widgets.TextLabel(
            self.panel, (0, 1),
            core.Text("RESULTS", TITLE_SIZE, MENU_COLOR, MENU_FONT, MENU_BOLD,
                      True), widgets.TextLabel.ALIGN_CENTER)
        self.title.set_span((5, 0))
        self.components = [
            widgets.TextLabel(
                self.panel, (1, 4),
                core.Text("Player 1: ", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),
            widgets.TextLabel(
                self.panel, (2, 4),
                core.Text("", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),  # Player 1 Time (Index 1)
            widgets.TextLabel(
                self.panel, (3, 4),
                core.Text("", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),  # Player 1 Result (Index 2)
            widgets.TextLabel(
                self.panel, (1, 5),
                core.Text("Player 2: ", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),
            widgets.TextLabel(
                self.panel, (2, 5),
                core.Text("", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),  # Player 2 Time (Index 4)
            widgets.TextLabel(
                self.panel, (3, 4),
                core.Text("", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),  # Player 2 Result (Index 5)
            widgets.TextLabel(
                self.panel, (1, 6),
                core.Text("Player 3: ", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),
            widgets.TextLabel(
                self.panel, (2, 6),
                core.Text("", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),  # Player 3 Time (Index 7)
            widgets.TextLabel(
                self.panel, (3, 4),
                core.Text("", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),  # Player 3 Result (Index 8)
            widgets.TextLabel(
                self.panel, (1, 7),
                core.Text("Player 4: ", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),
            widgets.TextLabel(
                self.panel, (2, 7),
                core.Text("", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),  # Player 4 Time (Index 10)
            widgets.TextLabel(
                self.panel, (3, 4),
                core.Text("", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),  # Player 4 Result (Index 11)
            widgets.TextLabel(
                self.panel, (1, 8),
                core.Text("Player 5: ", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),
            widgets.TextLabel(
                self.panel, (2, 8),
                core.Text("", RESULTS_SIZE, MENU_COLOR, RESULTS_FONT,
                          MENU_BOLD, True)),  # Player 5 Time (Index 13)
            widgets.TextLabel(self.panel, (3, 4),
                              core.Text("", RESULTS_SIZE, MENU_COLOR,
                                        RESULTS_FONT, MENU_BOLD,
                                        True))  # Player 5 Result (Index 14)
        ]
        self.buttons = [
            widgets.TextButton(
                self.panel, (2, 12),
                core.Text("Restart", MENU_SIZE, MENU_COLOR, MENU_FONT,
                          MENU_BOLD)),
            widgets.TextButton(
                self.panel, (2, 13),
                core.Text("Quit", MENU_SIZE, MENU_COLOR, MENU_FONT, MENU_BOLD))
        ]
        [b.set_color(core.BLACK) for b in self.buttons]
        [b.set_alignment(widgets.TextLabel.ALIGN_CENTER) for b in self.buttons]
        [b.set_span((1, 0)) for b in self.buttons]
        [b.set_border(core.WHITE, 4) for b in self.buttons]
コード例 #5
0
ファイル: hud.py プロジェクト: EricsonWillians/ArcRacer
 def __init__(self, gm):
     self.gm = gm
     self.panel = widgets.Panel(
         core.Grid((HUD.WIDTH, HUD.HEIGHT),
                   (options["RESOLUTION"][0], options["RESOLUTION"][1])),
         None, None, (0, 0))
     self.player1_info_panel = widgets.Panel(
         core.Grid((3, HUD.PLAYER_INFO_PANEL_LABELS),
                   self.panel.grid.cell_size), self.panel, (1, 0), None)
     self.player1_info_panel_labels = [
         widgets.TextLabel(
             self.player1_info_panel, (0, 2),
             core.Text("Player 1", HUD.FONT_SIZE, HUD.COLOR, HUD.FONT,
                       HUD.BOLD, HUD.ITALIC)),
         widgets.TextLabel(
             self.player1_info_panel, (0, 4),
             core.Text("Lap:", HUD.FONT_SIZE, HUD.COLOR, HUD.FONT, HUD.BOLD,
                       HUD.ITALIC)),
         widgets.TextLabel(
             self.player1_info_panel, (2, 4),
             core.Text("", HUD.FONT_SIZE, HUD.COLOR, HUD.FONT, HUD.BOLD,
                       HUD.ITALIC)),
         widgets.TextLabel(
             self.player1_info_panel, (0, 6),
             core.Text("Time:", HUD.FONT_SIZE, HUD.COLOR, HUD.FONT,
                       HUD.BOLD, HUD.ITALIC)),
         widgets.TextLabel(
             self.player1_info_panel, (2, 6),
             core.Text("", int(HUD.FONT_SIZE / 2), HUD.COLOR, HUD.FONT,
                       HUD.BOLD, HUD.ITALIC))
     ]
     self.player2_info_panel = widgets.Panel(
         core.Grid((3, HUD.PLAYER_INFO_PANEL_LABELS),
                   self.panel.grid.cell_size), self.panel,
         (HUD.WIDTH - 3, 0), None)
     self.player2_info_panel_labels = [
         widgets.TextLabel(
             self.player2_info_panel, (0, 2),
             core.Text("Player 2", HUD.FONT_SIZE, HUD.COLOR, HUD.FONT,
                       HUD.BOLD, HUD.ITALIC)),
         widgets.TextLabel(
             self.player2_info_panel, (0, 4),
             core.Text("Lap:", HUD.FONT_SIZE, HUD.COLOR, HUD.FONT, HUD.BOLD,
                       HUD.ITALIC)),
         widgets.TextLabel(
             self.player2_info_panel, (2, 4),
             core.Text("", HUD.FONT_SIZE, HUD.COLOR, HUD.FONT, HUD.BOLD,
                       HUD.ITALIC)),
         widgets.TextLabel(
             self.player2_info_panel, (0, 6),
             core.Text("Time:", HUD.FONT_SIZE, HUD.COLOR, HUD.FONT,
                       HUD.BOLD, HUD.ITALIC)),
         widgets.TextLabel(
             self.player2_info_panel, (2, 6),
             core.Text("", int(HUD.FONT_SIZE / 2), HUD.COLOR, HUD.FONT,
                       HUD.BOLD, HUD.ITALIC))
     ]
     self.player1_info_panel_labels[0].set_span((1, 0))
     [
         label.set_color(core.TRANSPARENT)
         for label in self.player1_info_panel_labels
     ]
     self.player2_info_panel_labels[0].set_span((1, 0))
     [
         label.set_color(core.TRANSPARENT)
         for label in self.player2_info_panel_labels
     ]