Added get_screen_center function to the BaseState class.

This commit is contained in:
2013-01-08 08:30:30 -04:30
parent 95b553ab5c
commit 8c06d8656e

View File

@@ -1,5 +1,6 @@
# Miguel Angel Astor Romero. Created on 7-1-2013. # # Miguel Angel Astor Romero. Created on 7-1-2013. #
################################################### ###################################################
import pygame
# Valid game states. # Valid game states.
VALID_STATES = { 'INTRO':0, 'MENU':1, 'IN_GAME':2, 'SCORE':3, 'STAY':4, 'QUIT':89} VALID_STATES = { 'INTRO':0, 'MENU':1, 'IN_GAME':2, 'SCORE':3, 'STAY':4, 'QUIT':89}
@@ -17,3 +18,7 @@ class BaseState:
def render(self, canvas): def render(self, canvas):
""" Empty. Should render this state on the canvas. """ """ Empty. Should render this state on the canvas. """
pass pass
def get_screen_center(self):
return (pygame.display.Info().current_w / 2,
pygame.display.Info().current_h / 2)