diff options
author | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-08-24 22:24:32 (GMT) |
---|---|---|
committer | Manuel Kaufmann <humitos@gmail.com> | 2012-08-25 15:33:22 (GMT) |
commit | 6fe4d2c4217fd547b9729e5461cb7fe831bf8ad1 (patch) | |
tree | a52fa1f1485b1f37035824cd8325e243ebd8dc89 | |
parent | b5296d47ca1d1d7d75a55472bd7053504c1e5311 (diff) |
Use profile colors for the ball
I modified some variable names before pushing the patch sent by Agustin.
Signed-off-by: Agustin Zubiaga <aguz@sugarlabs.org>
-rwxr-xr-x | game.py | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -4,7 +4,19 @@ import pygame import random from gi.repository import Gtk -BALL_COLOR = 255, 255, 255 +from sugar3.graphics.style import Color +from sugar3 import profile + +def get_profile_colors(): + profile_color = profile.get_color() + fill = Color(profile_color.get_fill_color()).get_rgba() + stroke = Color(profile_color.get_stroke_color()).get_rgba() + + fill = [i * 255 for i in fill] + stroke = [i * 255 for i in stroke] + return fill, stroke + +BALL_COLOR_FILL, BALL_COLOR_STROKE = get_profile_colors() GROUND_COLOR = 0, 0, 0 BACKGROUND_COLOR = 180, 180, 180 BALL_SIZE = 20 @@ -55,7 +67,10 @@ class Ball(object): self._y += vy def draw(self, surface): - pygame.draw.circle(surface, BALL_COLOR, (self._x, self._y), BALL_SIZE) + pygame.draw.circle(surface, BALL_COLOR_STROKE, (self._x, self._y), + BALL_SIZE) + pygame.draw.circle(surface, BALL_COLOR_FILL, (self._x, self._y), + BALL_SIZE - 3) class Level(object): @@ -105,7 +120,8 @@ class Level(object): pygame.draw.rect(surface, GROUND_COLOR, rect) # draw hole: - pygame.draw.circle(surface, BALL_COLOR, self._ball_end, BALL_SIZE, 2) + pygame.draw.circle(surface, BALL_COLOR_FILL, + self._ball_end, BALL_SIZE, 2) class TiltGame(object): |