forked from TUDelft-CNS-ATM/bluesky
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlueSky_pygame.py
More file actions
41 lines (33 loc) · 1.17 KB
/
BlueSky_pygame.py
File metadata and controls
41 lines (33 loc) · 1.17 KB
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
37
38
39
40
41
import pygame as pg
from bluesky import sim, scr, stack
from bluesky.ui.pygame import Keyboard, splash
from bluesky.tools import plugin
if __name__ == "__main__":
print(" ***** BlueSky Open ATM simulator *****")
print("Distributed under GNU General Public License v3")
def MainLoop():
# =============================================================================
# Start the mainloop (and possible other threads)
# =============================================================================
splash.show()
plugin.init()
stack.init()
sim.start()
scr.init()
# Main loop for tmx object
while not sim.mode == sim.end:
sim.update() # Update sim
scr.update() # GUI update
# Restart traffic simulation:
if sim.mode == sim.init:
sim.reset()
scr.objdel() # Delete user defined objects
# After the simulation is done, close the gui
sim.stop()
pg.quit()
print('BlueSky normal end.')
return
#==============================================================================
# Run mainloop if BlueSky_pygame is called directly
if __name__ == '__main__':
MainLoop()