Compare commits

...

2 Commits

Author SHA1 Message Date
f93dfb1fb2 Add an empty game. 2024-04-07 21:11:48 +05:00
00f930e151 Make it possible to render an empty level. 2024-04-07 21:11:31 +05:00
2 changed files with 8 additions and 2 deletions

3
games/empty/__init__.py Normal file
View File

@ -0,0 +1,3 @@
def init(modules, aoEngineEvents):
EngineEvent = modules['engineevents'].EngineEvent
aoEngineEvents.append(EngineEvent('level', lambda _: []))

View File

@ -9,7 +9,7 @@ import pygame.freetype
from gyro import GyroVector, Poincare2Klein from gyro import GyroVector, Poincare2Klein
from constants import I, WHITE, BLACK, IROT, ROT, OFFSET from constants import I, WHITE, BLACK, IROT, ROT, OFFSET
from draw import draw from draw import draw, DrawnSegment
from alert import Alert from alert import Alert
from engineevents import EngineEvent, EngineEventProcessingError from engineevents import EngineEvent, EngineEventProcessingError
from defaultcontrols import defaultcontrols from defaultcontrols import defaultcontrols
@ -140,7 +140,10 @@ def mainLoop():
aoEngineEvents = fvControl_ao() aoEngineEvents = fvControl_ao()
processevents() processevents()
display.fill(WHITE) display.fill(WHITE)
drawn = draw(level,gPlayer,pi/4,320,iDistScale) if len(level) != 0:
drawn = draw(level,gPlayer,pi/4,320,iDistScale)
else:
drawn = [DrawnSegment(0, BLACK)] * 320
pygame.draw.rect(display,sky, (0,0,1280,360)) pygame.draw.rect(display,sky, (0,0,1280,360))
pygame.draw.rect(display,ground, (0,360,1280,360)) pygame.draw.rect(display,ground, (0,360,1280,360))
n = 0 n = 0