root/src/staticWindows.py @ 109

Revision 109, 8.0 KB (checked in by jelinson, 2 years ago)

typo and debugging

Line 
1'''
2Created on Feb 23, 2012
3
4@author: TechTrek
5'''
6import pygame, os, math
7
8
9from globals import *
10from ui import *
11from window import *
12from windowEntry import *
13from image import *
14from text import *
15from rectangle import *
16from building import *
17from fileio import *
18from game import *
19from state import *
20
21# Windows Dictionary... whatever, it works
22windowsDict = {}
23
24# create necessary windows
25backGround1 = Window('background1',0,0)
26backGroundEntry = WindowEntry(Response('windows',[],False,False))
27openingArt = pygame.image.load(resourceDir + os.sep + 'images' + os.sep + 'sequences' + os.sep + 'Intro-01.jpg')
28backGroundEntry.addImage(Image((0,0),1080,792,openingArt))
29backGround1.addEntry(backGroundEntry)
30windowsDict['background1'] = backGround1
31
32backGround2 = Window('background2',0,0)
33backGroundEntry = WindowEntry(Response('windows',[],False,False))
34openingArt = pygame.image.load(pngDir +"background.png")
35backGroundEntry.addImage(Image((0,0),1080,792,openingArt))
36backGround2.addEntry(backGroundEntry)
37windowsDict['background2'] = backGround2
38
39
40buttons = Window('buttons',20,720)
41buttons.setDefaultResponse(Response('windows',[],False,True))
42
43# Build button
44buildIcon = WindowEntry(Response('windows',['buildMenu1'],False,False))
45buildArt = pygame.image.load(os.path.abspath(pngDir + "build.png"))
46buildIcon.addImage(Image((5,5),IMG_SM,IMG_SM,buildArt,))
47buildIcon.addRectangle(Rectangle((0,0),BUTTON_W,BUTTON_H,BLUE))
48buildIcon.addText(Text((65,17),"BUILD",BUTTON_TEXT,WHITE))
49buttons.addEntry(buildIcon)
50
51# Research button
52researchIcon = WindowEntry(Response('windows',['researchMenu'],False,False))
53buildArt = pygame.image.load(os.path.abspath(resourceDir + os.sep + "menu_icons" + os.sep  + "png" + os.sep +"research.png"))
54researchIcon.addImage(Image((5+BUTTON_SHIFT,5),IMG_SM,IMG_SM,buildArt))
55researchIcon.addRectangle(Rectangle((BUTTON_SHIFT,0),BUTTON_W,BUTTON_H,BLUE))
56researchIcon.addText(Text((45+BUTTON_SHIFT,17),"RESEARCH",BUTTON_TEXT,WHITE))
57buttons.addEntry(researchIcon)
58
59# End Turn button
60endTurnButton = WindowEntry(Response('endTurn',[],False,False))
61endTurnButton.addRectangle(Rectangle((BUTTON_SHIFT*2,0),BUTTON_W,BUTTON_H,BLUE))
62endTurnButton.addText(Text((32+BUTTON_SHIFT*2,17),"END TURN",BUTTON_TEXT,WHITE))
63buttons.addEntry(endTurnButton)
64
65windowsDict['buttons'] = buttons
66
67
68# More buttons
69mainButtons = Window('mainButtons',20,20)
70mainButtons.setDefaultResponse(Response('windows',[],False,True))
71
72mainMenuButton = WindowEntry(Response('mainMenu',[],False,False))
73mainMenuButton.addRectangle(Rectangle((0,0),BUTTON_W,BUTTON_H,BLUE))
74mainMenuButton.addText(Text((32,17),"MAIN MENU",BUTTON_TEXT,WHITE))
75mainButtons.addEntry(mainMenuButton)
76
77undoTurnButton = WindowEntry(Response('windows',['undoAlert'],False,False))
78undoTurnButton.addRectangle(Rectangle((BUTTON_SHIFT,0),BUTTON_W,BUTTON_H,BLUE))
79undoTurnButton.addText(Text((32+BUTTON_SHIFT,17),"UNDO TURN",BUTTON_TEXT,WHITE))
80mainButtons.addEntry(undoTurnButton)
81
82windowsDict['mainButtons'] = mainButtons
83
84undoAlert = Alert('You are about to undo your turn. Are you sure you want to do this?', True, 'undo')
85undoAlertWindow = undoAlert.displayAlert()
86
87windowsDict['undoAlert'] = undoAlertWindow
88
89
90# Research Menu
91researchMenu = Window('researchMenu',20,20)
92researchMenu.setDefaultResponse(Response('windows',[],True,True))
93researchIcon = WindowEntry(Response('windows',[],False,False))
94researchArt = pygame.image.load(os.path.abspath(pngDir + "research.png"))
95researchIcon.addImage(Image((120,10),40,40,researchArt))
96researchIcon.addImage(Image((345,10),40,40,researchArt,))
97researchIcon.addRectangle(Rectangle((0,0),MENU_W,MENU_H,BLUE))
98researchIcon.addText(Text((175,17),"RESEARCH",42,WHITE))
99researchMenu.addEntry(researchIcon)
100
101# Shifting each entry down 120
102# Each description is shifted down 30 from name
103
104researchIcon = WindowEntry(Response('windows',['researchDescription_power'],False,False))
105researchArt = pygame.image.load(os.path.abspath(pngDir + "power.png"))
106researchIcon.addImage(Image((390,110),ICON_SIZE,ICON_SIZE,researchArt))
107researchIcon.addRectangle(Rectangle((20,100),460,100,CYAN))
108researchIcon.addText(Text((25,110),"POWER",32,WHITE))
109researchIcon.addText(Text((25,140),"This is where the text would go.",24,WHITE))
110researchMenu.addEntry(researchIcon)
111
112researchIcon = WindowEntry(Response('windows',['researchDescription_transport'],False,False))
113researchArt = pygame.image.load(os.path.abspath(pngDir + "transport.png"))
114researchIcon.addImage(Image((390,230),ICON_SIZE,ICON_SIZE,researchArt))
115researchIcon.addRectangle(Rectangle((20,220),460,100,CYAN))
116researchIcon.addText(Text((25,230),"TRANSPORT",32,WHITE))
117researchIcon.addText(Text((25,260),"This is where the text would go.",24,WHITE))
118researchMenu.addEntry(researchIcon)
119
120researchIcon = WindowEntry(Response('windows',['researchDescription_material'],False,False))
121researchArt = pygame.image.load(os.path.abspath(pngDir + "material.png"))
122researchIcon.addImage(Image((390,350),ICON_SIZE,ICON_SIZE,researchArt))
123researchIcon.addRectangle(Rectangle((20,340),460,100,CYAN))
124researchIcon.addText(Text((25,350),"MATERIAL",32,WHITE))
125researchIcon.addText(Text((25,380),"This is where the text would go.",24,WHITE))
126researchMenu.addEntry(researchIcon)
127windowsDict['researchMenu'] = researchMenu
128
129
130# Main Menu
131
132mainMenu = Window('mainMenu',400,100)
133mainMenu.setDefaultResponse(Response('windows',[],False,False))
134mainIcon = WindowEntry(Response('windows',[],False,False))
135mainIcon.addRectangle(Rectangle((0,0),MAIN_MENU_W,MAIN_MENU_H,GRAY))
136mainIcon.addText(Text((45,15),"TECHTREK",72,FAKEBLACK))
137mainMenu.addEntry(mainIcon)
138
139# New Game, Resume, Load, Save, Quit
140# names = [('name', 'response')]
141names = [('New Game','windows'), ('Resume','resume'), ('Load','load'), ('Save','save'), ('Quit','quit')]
142for i in range(len(names)):
143    menuButton = WindowEntry(Response(names[i][1],['introScene_1'],True,False))
144    menuButton.addRectangle(Rectangle((50,70+MAIN_SHIFT*i),200,70,BLUE))
145    menuButton.addText(Text((100,85+MAIN_SHIFT*i),names[i][0],48,WHITE))
146    mainMenu.addEntry(menuButton)
147   
148
149# Build Intro Window
150buildMenu1 = Window('buildMenu1',20,20)
151buildMenu1.setDefaultResponse(Response('windows',[],True,True))
152buildArt = pygame.image.load(os.path.abspath(pngDir + "build.png"))
153buildIcon = WindowEntry(Response('windows',[],False,False))
154buildIcon.addImage(Image((120,10),40,40,buildArt))
155buildIcon.addImage(Image((345,10),40,40,buildArt))
156buildIcon.addRectangle(Rectangle((0,0),MENU_W,MENU_H,BLUE))
157buildIcon.addText(Text((210,17),"BUILD",42,WHITE))
158buildMenu1.addEntry(buildIcon)
159
160# Swifting each entry down 120
161# Each description is shifted down 30 from name
162
163buildIcon = WindowEntry(Response('windows',['buildMenu_power'],False,False))
164buildArt = pygame.image.load(os.path.abspath(pngDir + "power.png"))
165buildIcon.addImage(Image((390,110),ICON_SIZE,ICON_SIZE,buildArt))
166buildIcon.addRectangle(Rectangle((20,100),460,100,CYAN))
167buildIcon.addText(Text((25,110),"POWER",32,WHITE))
168buildIcon.addText(Text((25,140),"This is where the text would go.",24,WHITE))
169buildMenu1.addEntry(buildIcon)
170
171buildIcon = WindowEntry(Response('windows',['buildMenu_transport'],False,False))
172buildArt = pygame.image.load(os.path.abspath(pngDir + "transport.png"))
173buildIcon.addImage(Image((390,230),ICON_SIZE,ICON_SIZE,buildArt))
174buildIcon.addRectangle(Rectangle((20,220),460,100,CYAN))
175buildIcon.addText(Text((25,230),"TRANSPORT",32,WHITE))
176buildIcon.addText(Text((25,260),"This is where the text would go.",24,WHITE))
177buildMenu1.addEntry(buildIcon)
178
179buildIcon = WindowEntry(Response('windows',['buildMenu_material'],False,False))
180buildArt = pygame.image.load(os.path.abspath(pngDir + "material.png"))
181buildIcon.addImage(Image((390,350),ICON_SIZE,ICON_SIZE,buildArt))
182buildIcon.addRectangle(Rectangle((20,340),460,100,CYAN))
183buildIcon.addText(Text((25,350),"MATERIAL",32,WHITE))
184buildIcon.addText(Text((25,380),"This is where the text would go.",24,WHITE))
185buildMenu1.addEntry(buildIcon)
186windowsDict['buildMenu1'] =buildMenu1
187
Note: See TracBrowser for help on using the browser.