projects
/
experiments
/
pygame.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e1e3f35
)
Add support for saving the raw output to a file
master
author
Antonio Ospite <ospite@studenti.unina.it>
Tue, 19 Mar 2013 10:34:10 +0000
(11:34 +0100)
committer
Antonio Ospite <ospite@studenti.unina.it>
Tue, 19 Mar 2013 10:34:10 +0000
(11:34 +0100)
pygame-vertical-scrolling-map.py
patch
|
blob
|
history
diff --git
a/pygame-vertical-scrolling-map.py
b/pygame-vertical-scrolling-map.py
index
75227e1
..
90e1af0
100755
(executable)
--- a/
pygame-vertical-scrolling-map.py
+++ b/
pygame-vertical-scrolling-map.py
@@
-21,6
+21,8
@@
# https://www.cs.ucsb.edu/~pconrad/cs5nm/topics/pygame/drawing/
import pygame
# https://www.cs.ucsb.edu/~pconrad/cs5nm/topics/pygame/drawing/
import pygame
+import sys
+import os
IMAGE_PATH = 'road.png'
SCREEN_WIDTH = 800
IMAGE_PATH = 'road.png'
SCREEN_WIDTH = 800
@@
-99,6
+101,14
@@
def main():
except:
joystick = None
except:
joystick = None
+ if len(sys.argv) > 1:
+ if sys.argv[1] == '-':
+ outputfile = sys.stdout.fileno()
+ else:
+ outputfile = os.open(sys.argv[1], os.O_WRONLY)
+ else:
+ outputfile = None
+
clock = pygame.time.Clock()
fps = 30
clock = pygame.time.Clock()
fps = 30
@@
-129,6
+139,10
@@
def main():
screen.blit(background.convert(), (0, 0))
scrolling_map.draw(screen)
screen.blit(background.convert(), (0, 0))
scrolling_map.draw(screen)
+ if outputfile:
+ buf = pygame.image.tostring(pygame.display.get_surface(), "RGB", False)
+ os.write(outputfile, buf)
+
pygame.display.update()
pygame.quit()
pygame.display.update()
pygame.quit()