From 8c06d8656e15bcb0023d4a63ad0255ad7f9e52aa Mon Sep 17 00:00:00 2001 From: Miguel Angel Astor Romero Date: Tue, 8 Jan 2013 08:30:30 -0430 Subject: [PATCH] Added get_screen_center function to the BaseState class. --- state.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/state.py b/state.py index 5c6ca7c..645b781 100644 --- a/state.py +++ b/state.py @@ -1,5 +1,6 @@ # Miguel Angel Astor Romero. Created on 7-1-2013. # ################################################### +import pygame # Valid game states. 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): """ Empty. Should render this state on the canvas. """ pass + + def get_screen_center(self): + return (pygame.display.Info().current_w / 2, + pygame.display.Info().current_h / 2)