forked from TUDelft-CNS-ATM/bluesky
-
Notifications
You must be signed in to change notification settings - Fork 8
/
BlueSky_pygame.py
36 lines (28 loc) · 926 Bytes
/
BlueSky_pygame.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
""" Pygame BlueSky start script """
from __future__ import print_function
import pygame as pg
import bluesky as bs
from bluesky.ui.pygame import splash
def main():
""" Start the mainloop (and possible other threads) """
splash.show()
bs.init(pygame=True)
bs.sim.operate()
bs.scr.init()
# Main loop for BlueSky
while not bs.sim.mode == bs.sim.end:
bs.sim.update() # Update sim
bs.scr.update() # GUI update
# Restart traffic simulation:
if bs.sim.mode == bs.sim.init:
bs.sim.reset()
bs.scr.objdel() # Delete user defined objects
bs.sim.stop()
pg.quit()
print('BlueSky normal end.')
if __name__ == '__main__':
print(" ***** BlueSky Open ATM simulator *****")
print("Distributed under GNU General Public License v3")
# Run mainloop if BlueSky_pygame is called directly
main()