Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 3 files changed
  • 0 comments
  • 1 contributor

Showing 3 changed files with 13 additions and 7 deletions. Show diff stats Hide diff stats

  1. +11 2 levelchoice.py
  2. +1 4 levelchooser.py
  3. +1 1  main.py
13 levelchoice.py
... ... @@ -1,3 +1,7 @@
  1 +import pygame
  2 +import shared
  3 +import objects
  4 +
1 5 class LevelChoice:
2 6 def select(self):
3 7 pass
@@ -9,6 +13,9 @@ class _LevelChoice:
9 13 def __init__(self, index, name):
10 14 self.index = index
11 15 self.name = name
  16 + self.font = pygame.font.Font(None, 64)
  17 + self.text = self.font.render(self.name, 1, (255, 255, 255))
  18 +
12 19
13 20 def destroy(self):
14 21 pass
@@ -17,7 +24,9 @@ def step(self, elapsed):
17 24 pass
18 25
19 26 def draw(self):
20   - pass
  27 + if pygame.font:
  28 + shared.canvas.blit(self.text, (30, 50*(1+self.index)))
  29 +
21 30
22 31 def select(self):
23   - pass
  32 + pass
5 levelchooser.py
... ... @@ -1,5 +1,5 @@
  1 +import pygame
1 2 import os
2   -
3 3 import shared
4 4 import objects
5 5 import userspace
@@ -14,9 +14,6 @@ def __init__(self):
14 14 "down" : "moveDown()",
15 15 "enter" : "selectLevel()"
16 16 }
17   -
18 17 levels = os.listdir("./levels/")
19 18 for i, name in enumerate(levels):
20 19 objects.create(_LevelChoice, i, name)
21   -
22   -
2  main.py
@@ -72,7 +72,7 @@ def init():
72 72
73 73 # start breakout level
74 74 from levelchooser import LevelChooser
75   - b = LevelChooser()
  75 + level = LevelChooser()
76 76
77 77 def handleEvents():
78 78 # pygame events

No commit comments for this range

Something went wrong with that request. Please try again.