def drawMenu(cls): """ Draws the menu screen and buttons to pygame's current display surface. **Preconditions**: None. **Postconditions**: Pygame's display surface will have the menu drawn onto it **Returns**: None. """ surface = pygame.display.get_surface() surfaceSize = surface.get_size() surfaceCenter = (surfaceSize[0] / 2, surfaceSize[1] / 2) titleCenter = (surfaceCenter[0], surfaceCenter[1] - 100) # fill screen with black surface.fill((0, 0, 0)) buttonSize = (400, 50) buttonPosition = lambda i: (surfaceCenter[0] - buttonSize[ 0] / 2, surfaceCenter[1] - buttonSize[1] / 2 + 65 * i) titleFont = pygame.font.SysFont("lucidaconsole", 40) Graphics.drawTextCenter(titleCenter, "Flat Earth Space Program", titleFont, (255, 255, 255)) Graphics.drawButton(surface, buttonPosition(0), buttonSize, cls._menuButtonColor, "Start Demo", 25, cls._demoCallback) Graphics.drawButton(surface, buttonPosition(1), buttonSize, cls._menuButtonColor, "Exit to Desktop", 25, cls._quitCallback)
def drawSplashScreen(cls): """ Draws the title screen to pygame's current display surface. **Preconditions**: None. **Postconditions**: Title screen drawn to pygame display surface. **Returns**: None. """ surface = pygame.display.get_surface() surfaceSize = surface.get_size() surfaceCenter = (surfaceSize[0] / 2, surfaceSize[1] / 2) titleCenter = (surfaceCenter[0], surfaceCenter[1] - 20) subtitleCenter = (surfaceCenter[0], surfaceCenter[1] + 20) # fill surface with black surface.fill((0, 0, 0)) # draw a button Graphics.drawButton(surface, (0, 0), surfaceSize, ((0, 0, 0, 0), (0, 0, 0, 0)), 0, 0, cls._splashCallback) # In the future, may want to draw an image onto the surface # as a background # for now, just draw text titleFont = pygame.font.SysFont("lucidaconsole", 40) subtitleFont = pygame.font.SysFont("lucidaconsole", 20) Graphics.drawTextCenter(titleCenter, "Flat Earth Space Program", titleFont, (255, 255, 255)) Graphics.drawTextCenter(subtitleCenter, "Click Anywhere to Continue", subtitleFont, (255, 255, 255))