add the wait command
This commit is contained in:
parent
1e7ca230d4
commit
ab057abddd
10
drawing.py
10
drawing.py
|
@ -113,7 +113,7 @@ class Window:
|
|||
x += sx
|
||||
SDL_RenderDrawPoint(self.r, x, y)
|
||||
|
||||
def wait(self):
|
||||
def wait(self, allow_any=False):
|
||||
"""Wait for the window to be closed."""
|
||||
|
||||
if self.quiet:
|
||||
|
@ -125,6 +125,14 @@ class Window:
|
|||
|
||||
if event.type == SDL_QUIT:
|
||||
break
|
||||
if event.type == SDL_KEYDOWN and allow_any:
|
||||
break
|
||||
|
||||
def pause(self):
|
||||
"""Display a pause message."""
|
||||
|
||||
# TODO: Display "paused"
|
||||
self.wait(allow_any=True)
|
||||
|
||||
def save(self, out):
|
||||
"""Save the output into a BMP file."""
|
||||
|
|
|
@ -121,8 +121,13 @@ class Context:
|
|||
raise Exception("Style statement not supported yet x_x")
|
||||
|
||||
elif n.type == N.WAIT:
|
||||
# TODO: Display "paused" and wait for a key press to continue"
|
||||
print("[interpreter] Delay ignored")
|
||||
print("---- pause")
|
||||
print(f"x={self.x} y={self.y} theta={self.angle}")
|
||||
print(f"A={self.vars['A']} B={self.vars['B']}")
|
||||
print(f"C={self.vars['C']} D={self.vars['D']}")
|
||||
print(f"E={self.vars['E']} F={self.vars['F']}")
|
||||
print(f"M={self.vars['M']}")
|
||||
self.w.pause()
|
||||
|
||||
# Flow control
|
||||
|
||||
|
|
Loading…
Reference in New Issue