all repos — Legends-RPG @ cfe27f199eb035566a7a0cb057b3d0c482ee51c8

A fantasy mini-RPG built with Python and Pygame.

data/states/main_menu.py (view raw)

 1__author__ = 'justinarmstrong'
 2
 3import pygame as pg
 4from .. import setup, tools
 5from .. import constants as c
 6
 7
 8class Menu(tools._State):
 9    def __init__(self):
10        tools._State.__init__(self)
11        self.next = c.TOWN
12        self.surface = setup.SCREEN
13        self.rect = self.surface.get_rect()
14        text = 'Main Menu placeholder'
15        self.font = pg.font.Font(setup.FONTS['Fixedsys500c'], 15)
16        self.rendered_text = self.font.render(text, 1, c.BLACK)
17        self.text_rect = self.rendered_text.get_rect()
18        self.text_rect.center = self.rect.center
19
20
21    def update(self, surface, keys, current_time):
22        self.current_time = current_time
23        surface.fill(c.WHITE)
24        surface.blit(self.rendered_text, self.text_rect)
25
26    def get_event(self, event):
27        if event.type == pg.KEYDOWN:
28            self.done = True