Пример #1
0
GRID_BG = OrderedUpdates()
################################################################################

### Constants ##################################################################
'''
@var DIST_APART: Vertical distance between menu entries, in pixels
@var MENU_TOP: y-coordinate of the top of the menu graphic
@var TITLE_TOP: y-coordinate of the top of the title graphic

Since we're centering everything, we really don't need to store the corner
'''
DIST_APART = 36
INSTRUCTION_DIST = 24
MENU_TOP = config.SCREEN_RECT.top + 144
TITLE_TOP = 32
TITLE = HudObject(config.load_image('gamelogo.png'), (0, 0))
################################################################################

### Preparation ################################################################
TITLE.image = pygame.transform.scale(
    TITLE.image, (TITLE.image.get_width() // 2, TITLE.image.get_height() // 2))
TITLE.rect.size = TITLE.image.get_size()
TITLE.center().image.set_colorkey(color.BLACK, config.BLIT_FLAGS)
################################################################################


class MainMenu(MenuState):
    def __init__(self, *args, **kwargs):
        super().__init__()
        ### Local Variables ####################################################
        text = config.load_text('menu', settings.get_language_code())
Пример #2
0
from pygame.sprite import Group

from core import color
from core import config

from core.config import screen, _limit_frame
from core.gamestate import GameState
from game.hudobject import HudObject
from game.mainmenu import MainMenu

### Groups #####################################################################
DIAMOND = Group()
################################################################################

### Constants ##################################################################
LOGO = config.load_image('logo.png')
BOOT = config.load_sound('boot.ogg')
################################################################################

### Preparation ################################################################

################################################################################


class SplashScreen(GameState):
    def __init__(self):
        self.alpha_percent = 0.0
        self.group_list = (DIAMOND, )
        self.logo = HudObject(LOGO, [0, 0])
        self.start_time = 5 * 60  #In frames
Пример #3
0
from pygame.sprite    import Group

from core import color
from core import config

from core.config    import screen, _limit_frame
from core.gamestate import GameState
from game.hudobject import HudObject
from game.mainmenu  import MainMenu

### Groups #####################################################################
DIAMOND = Group()
################################################################################

### Constants ##################################################################
LOGO = config.load_image('logo.png')
BOOT = config.load_sound('boot.ogg')
################################################################################

### Preparation ################################################################

################################################################################

class SplashScreen(GameState):
    def __init__(self):
        self.alpha_percent = 0.0
        self.group_list    = (DIAMOND,)
        self.logo          = HudObject(LOGO, [0, 0])
        self.start_time    = 5 * 60  #In frames
        
        BOOT.play()
Пример #4
0
GRID_BG = OrderedUpdates()
################################################################################

### Constants ##################################################################
'''
@var DIST_APART: Vertical distance between menu entries, in pixels
@var MENU_TOP: y-coordinate of the top of the menu graphic
@var TITLE_TOP: y-coordinate of the top of the title graphic

Since we're centering everything, we really don't need to store the corner
'''
DIST_APART = 36
INSTRUCTION_DIST = 24
MENU_TOP   = config.SCREEN_RECT.top + 144
TITLE_TOP  = 32
TITLE      = HudObject(config.load_image('gamelogo.png'), (0, 0))
################################################################################

### Preparation ################################################################
TITLE.image     = pygame.transform.scale(TITLE.image, (TITLE.image.get_width() // 2, TITLE.image.get_height() // 2))
TITLE.rect.size = TITLE.image.get_size()
TITLE.center().image.set_colorkey(color.BLACK, config.BLIT_FLAGS)
################################################################################

class MainMenu(MenuState):
    def __init__(self, *args, **kwargs):
        super().__init__()
        ### Local Variables ####################################################
        text      = config.load_text('menu', settings.get_language_code())
        to_game   = lambda a=-1: partial(self.change_state, InGameState, time=a)
        to_screen = lambda x   : partial(self.change_state, x, next=MainMenu)