changeset 33:4ea8bb26bc11

Split the one screen map layer into 7 distinct layers Added the F1-5 key toggles Added F-key section to docs
author Josef "Jeff" Sipek <jeffpc@optonline.net>
date Wed, 17 Aug 2005 00:35:34 -0500
parents edf40115de4e
children 755ff797483f
files atc_colors.py atc_single.py docs/SinglePlayer.txt
diffstat 3 files changed, 64 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/atc_colors.py	Tue Aug 16 23:35:32 2005 -0500
+++ b/atc_colors.py	Wed Aug 17 00:35:34 2005 -0500
@@ -31,6 +31,8 @@
 snow	= 227, 227, 227
 white	= 255, 255, 255
 
+transparent = 0, 0, 0, 0
+
 planeinfo_ok		= green1
 planeinfo_crashed	= brown
 planeinfo_emergency	= red
--- a/atc_single.py	Tue Aug 16 23:35:32 2005 -0500
+++ b/atc_single.py	Wed Aug 17 00:35:34 2005 -0500
@@ -36,10 +36,29 @@
 	# background music
 	#atc_utils.playmusic("some.mp3");
 
-	# Set background
-	screen_map = pygame.Surface(screen.get_size()).convert()
-	screen_map.fill(atc_colors.black)
+	displays	= {
+		"map": 1,
+		"weather": 0,
+		"navaids": 0,
+		"menus": 0,
+		"planes": 1}
 	
+	# set up the display layers as much as possible
+	screen_void	= pygame.Surface(screen.get_size()).convert_alpha()
+	screen_map	= pygame.Surface(screen.get_size()).convert_alpha()
+	screen_weather	= pygame.Surface(screen.get_size()).convert_alpha()
+	screen_navaids	= pygame.Surface(screen.get_size()).convert_alpha()
+	screen_menus	= pygame.Surface(screen.get_size()).convert_alpha()
+	screen_planes	= pygame.Surface(screen.get_size()).convert_alpha()
+	screen_cmd	= pygame.Surface(screen.get_size()).convert_alpha()
+	
+	screen_void.fill(   atc_colors.black)
+	screen_map.fill(    atc_colors.transparent)
+	screen_weather.fill(atc_colors.transparent)
+	screen_navaids.fill(atc_colors.transparent)
+	screen_menus.fill(  atc_colors.transparent)
+	screen_cmd.fill(    atc_colors.transparent)
+
 	(back_image, back_rect) = atc_utils.load_png(MAPS[0]["image"])
 	screen_map.blit(back_image, (0, 0))
 
@@ -159,6 +178,17 @@
 				if event.key == pygame.K_TAB:
 					pass	# fixme, tab complete call signs/flight numbers, commands, etc.
 				
+				if event.key == pygame.K_F1:
+					displays["map"] = 1 - displays["map"]
+				if event.key == pygame.K_F2:
+					displays["weather"] = 1 - displays["weather"]
+				if event.key == pygame.K_F3:
+					displays["navaids"] = 1 - displays["navaids"]
+				if event.key == pygame.K_F4:
+					displays["menus"] = 1 - displays["menus"]
+				if event.key == pygame.K_F5:
+					displays["planes"] = 1 - displays["planes"]
+				
 				if (event.key == pygame.K_KP_ENTER) or (event.key == pygame.K_RETURN):
 					if (cmd == "QUIT"):
 						mess.pickup_kill = 1
@@ -185,19 +215,32 @@
 						
 						cmd = ""
 		
-		screen.blit(screen_map, (0, 0))
-		
+		screen_planes.fill(atc_colors.transparent)
 		for plane in planes:
-			plane.display(screen)
+			plane.display(screen_planes)
 			plane.update()
 			if (plane.status == atc_plane.plane_CRASHED):
-				mess.write(screen,plane.callsign + ": PLANE CRASHED")
+				mess.write(screen_planes,plane.callsign + ": PLANE CRASHED")
 				plane.status = atc_plane.plane_DEAD
 		
+		screen_cmd.fill(atc_colors.transparent)
 		if (cmd):
 			font = pygame.font.Font(None, 18)
 			text = font.render(cmd, 1, atc_colors.white)
-			screen.blit(text, (25, 735))
+			screen_cmd.blit(text, (25, 735))
+		
+		screen.blit(screen_void, (0, 0))
+		if (displays["map"]):
+			screen.blit(screen_map, (0, 0))
+		if (displays["weather"]):
+			screen.blit(screen_weather, (0, 0))
+		if (displays["navaids"]):
+			screen.blit(screen_navaids, (0, 0))
+		if (displays["menus"]):
+			screen.blit(screen_menus, (0, 0))
+		if (displays["planes"]):
+			screen.blit(screen_planes, (0, 0))
+		screen.blit(screen_cmd, (0, 0))
 		
 		pygame.display.flip()
 
--- a/docs/SinglePlayer.txt	Tue Aug 16 23:35:32 2005 -0500
+++ b/docs/SinglePlayer.txt	Wed Aug 17 00:35:34 2005 -0500
@@ -45,3 +45,14 @@
 
 NOTE: It is imperative that you include exactly one space between the "DELTA" and "79", ":" and "HEAD"/"ALT", and "HEAD"/"ALT" and "2500"/"220".
 
+
+Special Keys:
+=============
+
+There are few special keys that change what's displayed:
+
+F1  - toggles map layer display
+F2  - toggles weather layer display (not implemented)
+F3  - toggles navaid layer display (not implemented)
+F4  - toggles menus layer display (not implemented)
+F5  - toggles airplane layer display