예제 #1
0
    def create(self):
        self.ctx = pygame.display.get_surface()

        self.background = sprite.Sprite(resManager.getImg("bg-default"),
                                        [0, 0])

        self.title = text.Text("Select a map",
                               resManager.loadSystemFont(None, 40), [0, 50])
        self.title.center()
        self.instructions = text.Text(
            "ARROWS to select, ENTER to choose, F5 to refresh files, ESC to return",
            resManager.loadSystemFont(None, 20), [0, 400])
        self.instructions.center()

        self.container = container.Container()
        self.listbox = self.container.add(
            "listbox1",
            listbox.ListBox([110, 90],
                            500,
                            maxVisibleItems=10,
                            bgColor=(150, 150, 150)))
        self.refresh()

        self.quit = False

        pygame.key.set_repeat(300, 100)
예제 #2
0
 def __init__(self, root):
     self.root = root
     self.coin = Sprite(resManager.getImg("hud-coin"), [10, 10],
                        colorKey=(255, 255, 255))
     self.scoreText = Text("SCORE: 0", resManager.loadSystemFont(None, 20),
                           [30, 10])
     self.heart = Sprite(resManager.getImg("hud-heart"), [10, 30],
                         colorKey=(255, 255, 255))
     self.lifeText = Text("x 0", resManager.loadSystemFont(None, 20),
                          [30, 30])
예제 #3
0
    def create(self):
        self.ctx = pygame.display.get_surface()

        self.background = sprite.Sprite(resManager.getImg("bg-default"),
                                        [0, 0])

        self.title = text.Text("Main menu",
                               resManager.loadSystemFont(None, 40), [0, 50])
        self.title.center()

        self.container = container.Container()
        self.listbox = self.container.add(
            "listbox1",
            listbox.ListBox([110, 90],
                            500,
                            maxVisibleItems=10,
                            bgColor=(43, 238, 217)))
        self.listbox.addItem("l",
                             "Load map",
                             bgColor=(145, 200, 145),
                             focusColor=(200, 255, 200))
        self.listbox.addItem("s",
                             "",
                             bgColor=(200, 200, 200),
                             focusColor=(255, 255, 255))
        self.listbox.addItem("e",
                             "Exit game",
                             bgColor=(200, 145, 145),
                             focusColor=(255, 200, 200))
        self.refresh()

        pygame.key.set_repeat(300, 100)
예제 #4
0
 def create(self):
     self.ctx = pygame.display.get_surface()
     self.ctx.blit(resManager.getImg("bg-dark"), (0, 0))
     
     bigFont = resManager.loadSystemFont(None, 150)
     smallFont = resManager.loadSystemFont(None, 30)
     self.texts = [
         Text("YOU", bigFont, [90, 0], (255, 255, 255)),
         Text("DIED", bigFont, [380, 0], (255, 0, 0)),
         Text("Press ENTER to continue...", smallFont, [0, 0], (255, 255, 255)),
     ]
     for text in self.texts[:2]:
         text.center(False, True)
         text.draw(self.ctx)
     
     self.texts[2].center(True, True, 0, 80)
     self.texts[2].draw(self.ctx)
         
     pygame.display.update()
     self.restart = False
예제 #5
0
 def __init__(self, pos, width, maxVisibleItems=6, elementHeight=30, fontHeight=20, bgColor=(255, 255, 255)):
     super().__init__((pos), (width, maxVisibleItems * elementHeight))
     self.maxVisibleItems = maxVisibleItems
     self.elementHeight = elementHeight
     self.fontHeight = fontHeight
     self.bgColor = bgColor
     
     self.font = resManager.loadSystemFont(None, fontHeight)
     self.marginLeft = 20
     self.marginTop = self.elementHeight - self.fontHeight
     
     self.selected = None
     self.offset = 0
     self.items = []
     self.signals = []
예제 #6
0
    def create(self):
        self.ctx = pygame.display.get_surface()
        self.ctx.fill((255, 50, 50))

        font = resManager.loadSystemFont(None, 30)
        self.texts = [
            Text("Ooops! Something gone wrong (but don't worry!)", font,
                 [0, 150]),
            Text("The error says: {}".format(resManager.getVar("ERROR_INFO")),
                 font, [0, 190]),
            Text("Press any key to return", font, [0, 230])
        ]
        for text in self.texts:
            text.center()
            text.draw(self.ctx)

        pygame.display.update()
        self.restart = False