diff options
-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): |