本文整理汇总了Python中threades.resize_pos函数的典型用法代码示例。如果您正苦于以下问题:Python resize_pos函数的具体用法?Python resize_pos怎么用?Python resize_pos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resize_pos函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: graphics
def graphics(self):
logo = pygame.image.load(os.path.join("data", "logo.png")).convert()
self.ff_logo = pygame.transform.scale(logo, threades.resize_pos((1111, 250)))
threades.screen.fill((0, 0, 0))
threades.screen.blit(self.ff_logo, threades.resize_pos((40, 50)))
# Font type
myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))
# creating new label showing loading of level
labelStyleCopy = gui.defaultLabelStyle.copy()
labelStyleCopy["border-width"] = 1
labelStyleCopy["wordwrap"] = True
labelStyleCopy["autosize"] = False
labelStyleCopy["font"] = myfont
labelStyleCopy["font-color"] = (0, 200, 0)
text1 = "Loading...."
# creating the label
label = gui.Label(
position=threades.resize_pos((500, 600)),
size=threades.resize_pos((250, 50)),
parent=desktop_level,
style=labelStyleCopy,
text=text1,
)
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:27,代码来源:level_change.py
示例2: pause_screen
def pause_screen(pause_flag = True):
"""
Pauses the screen until user takes any action
"""
start = starting_intro()
#Initialises and creates the starting screen
start.main_menu(pause_flag,threades.game_save_flag)
logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
#The loop which pauses main screen
while start.run:
pygame.display.set_caption('FoodForce2')
threades.screen.fill((0,0,0))
threades.screen.blit(ff_logo,threades.resize_pos((40,50)))
for e in gui.setEvents(pygame.event.get()):
if e.type == pygame.QUIT:
safe_exit()
if e.type == QUIT:
safe_exit()
desktop2.update()
desktop2.draw()
pygame.display.update()
threades.total_update_flag = True
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:28,代码来源:Foodforce2.py
示例3: graphics
def graphics(self):
logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
self.ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
threades.screen.fill((0,0,0))
threades.screen.blit(self.ff_logo,threades.resize_pos((40,50)))
# Font type
myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))
#creating new label showing loading of level
labelStyleCopy = gui.defaultLabelStyle.copy()
labelStyleCopy['border-width'] = 1
labelStyleCopy['wordwrap'] = True
labelStyleCopy['autosize'] = False
labelStyleCopy['font'] = myfont
labelStyleCopy['font-color'] = (0,200,0)
if self.level_no==-1:
text1='Loading New Level...'
else:
text1='Loading Level No:'+str(self.level_no)
#creating the label
label = gui.Label(position = threades.resize_pos((500,600)), size = threades.resize_pos((250,50)), parent = desktop_level,style=labelStyleCopy,text=text1)
#self.run=True
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:27,代码来源:level_change.py
示例4: pause_screen
def pause_screen(pause_flag = True):
start = starting_intro()
start.main_menu(pause_flag)
logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
while start.run:
pygame.display.set_caption('FoodForce2')
threades.screen.fill((0,0,0))
threades.screen.blit(ff_logo,threades.resize_pos((40,50)))
for e in gui.setEvents(pygame.event.get()):
if e.type == pygame.QUIT:
safe_exit()
if e.type == QUIT:
safe_exit()
if e.type==mesh.CONNECT :
game_sharing.sharing_handler(e.type,None,'')
#sharing_thread = threading.Thread(target = game_sharing.sharing_handler, args=[e.type,None,'']).start()
elif e.type==mesh.PARTICIPANT_ADD or e.type==mesh.PARTICIPANT_REMOVE :
game_sharing.sharing_handler(e.type,e.handle,'')
#sharing_thread = threading.Thread(target = game_sharing.sharing_handler, args=[e.type,e.handle,'']).start()
elif e.type==mesh.MESSAGE_MULTI or e.type==mesh.MESSAGE_UNI :
game_sharing.sharing_handler(e.type,e.handle,e.content)
#sharing_thread = threading.Thread(target = game_sharing.sharing_handler, args=[e.type,e.handle,e.content]).start()
desktop2.update()
desktop2.draw()
pygame.display.update()
threades.total_update_flag = True
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:32,代码来源:Foodforce2.py
示例5: __init__
def __init__(self):
''' Draws the Facilities panel
'''
self.update_flag = True
myfont1 = pygame.font.Font("font.ttf", threades.resize_pt(20)) # For model.resources name and their value
self.name_labels = []
self.labelstyle1 = gui.defaultLabelStyle.copy()
self.labelstyle1['border-width'] = 0
self.labelstyle1['wordwrap'] = False
self.labelstyle1['autosize'] = False
self.labelstyle1['font'] = myfont1
self.labelstyle1['font-color'] = self.font_color
#self.labelstyle1['bg-color'] = self.font_bg_color
self.list_titles = model.text_file.facilities_list
self.list_names = [model.text_file.num_text[0]+': ']
self.list_values1 = (model.House.get_number(),model.School.get_number(),model.Hospital.get_number(),model.Workshop.get_number(),model.Farm.get_number(),model.Fountain.get_number())
self.list_values2 = (model.House.get_level(),model.School.get_level(),model.Hospital.get_level(),model.Workshop.get_level(),model.Farm.get_level(),model.Fountain.get_level())
self.value_labels = []
for i in range(6):
label = gui.Label(position = threades.resize_pos((950,50+55*i)),size = threades.resize_pos((300,30)), parent = threades.desktop, text = self.list_titles[i], style = self.labelstyle1)
self.name_labels.append(label)
label = gui.Label(position = threades.resize_pos((950,75+55*i)),size = threades.resize_pos((300,30)), parent = threades.desktop, text = self.list_names[0]+str(int(self.list_values1[i]))+model.text_file.level_text[0]+':'+str(int(self.list_values2[i])), style = self.labelstyle1)
self.name_labels.append(label)
label.surf.set_alpha(200)
self.value_labels.append(label)
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:26,代码来源:display_panel.py
示例6: pause_screen
def pause_screen(pause_flag = True):
start = starting_intro()
start.main_menu(pause_flag,threades.game_save_flag)
logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
ff_logo = pygame.transform.scale(logo,threades.resize_pos((1128,171)))
threades.audio.play_music(False,'soundtrack')
while start.run:
pygame.display.set_caption('FoodForce2')
threades.screen.fill((0,0,0))
threades.screen.blit(ff_logo,threades.resize_pos((40,90)))
for e in gui.setEvents(pygame.event.get()):
if e.type == pygame.QUIT:
safe_exit()
if e.type == QUIT:
safe_exit()
#print 'in pause screen'
desktop2.update()
desktop2.draw()
pygame.display.update()
threades.audio.play_music(True,'soundtrack')
threades.total_update_flag = True
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:26,代码来源:Foodforce2.py
示例7: chatWindow
def chatWindow(self, windowtext=None):
""" Opens a new chat window
"""
global desktopChat
global move_to_next_chatwin_flag
move_to_next_chatwin_flag = False # so that the next window waits for the user to press enter
# Disable other gui
gui_buttons.gui_obj.disable_buttons()
# Stopping the updation thread
threades.pause_update_thread()
# Custom Window Style
win_style = gui.defaultWindowStyle.copy()
win_style["bg-color"] = (0, 0, 0)
# Calculating position and size of window from the size of the desktop
position_win = threades.resize_pos((150.0, 50.0))
size_win = threades.resize_pos((900, 800))
# print 'size win is',size_win,'\n'
# Creating window
self.chatWin = gui.Window(
position=position_win,
size=size_win,
parent=desktopChat,
text="",
style=win_style,
closeable=False,
shadeable=False,
moveable=False,
)
self.chatWin.surf.fill((0, 0, 0, 140))
self.chatWinFlag = True
# NOTE: This part will be used once we know how to blit buttons on the chat window
# self.button_skip = gui.Button(position = threades.resize_pos((500.0,10.0),(900.0,800.0),self.size_win), size = threades.resize_pos((80.0,30.0),(900.0,800.0),self.size_win), parent = self.chatWin, text = "Skip",style = self.button_style)
# self.button_next = gui.Button(position = threades.resize_pos((200.0,10.0),(900.0,800.0),self.size_win), size = threades.resize_pos((80.0,30.0),(900.0,800.0),self.size_win), parent = self.chatWin, text = "Next >",style = self.button_style)
# self.button_skip.onClick=self.closeChatWindow
# self.button_skip.onMouseOver=self.closeChatWindow
# print self.button_skip.enabled
# creating label for writing the text
self.label = gui.Label(
position=threades.resize_pos((100.0, 760.0), (900.0, 800.0), self.chatWin.size),
size=threades.resize_pos((700.0, 30.0), (900.0, 800.0), self.chatWin.size),
parent=self.chatWin,
text=model.text_file.proceed_text[0],
style=self.labelStyleCopy,
)
开发者ID:sweetbuttsex,项目名称:foodforce,代码行数:52,代码来源:chat.py
示例8: update
def update(self):
for i in range(len(model.facilities_list)):
if not (self.list_num_fac[i] == model.facilities_list[i].get_original_number()):
self.update_flag = True
if self.update_flag or threades.map_update_flag or threades.total_update_flag:
threades.screen.blit(self.map,threades.resize_pos((930,390)))
posn = threades.resize_pos((930+int(3200/33.3),390+int(2600/28.57)))
threades.screen.blit(load_images.Map_images[6],posn)
for i in range(len(model.facilities_list)):
for j in range(model.facilities_list[i].get_original_number()):
posn = threades.resize_pos((930+int(load_images.facilities_posn_list[i][j][0]/33.3),390+int(load_images.facilities_posn_list[i][j][1]/28.57)))
threades.screen.blit(load_images.Map_images[i],posn)
self.update_flag = False
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:16,代码来源:display_panel.py
示例9: tradingWindow
def tradingWindow(self,handle,buddyName = 'Friend',resource = 'Water', quantity = '0' ,price = '10',trade = 'sell'):
'''Opens the trading window at the reciever end for trading
'''
#self.font_color = (255,214,150) # Brown
self.replyhandle = handle
self.replymessage = ['TradeReply',resource,quantity,price,trade]
color_blue = (0,0,250)
myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))
# Custom Window Style
win_style = gui.defaultWindowStyle.copy()
win_style['font'] = myfont
win_style['bg-color'] = (0,0,0)
win_style['font-color'] = color_blue
# Calculating position and size of window from the size of the desktop
position_win =threades.resize_pos((725.0,42.0))
size_win =threades.resize_pos((470.0,180.0))
# Creating custom label style for the text to be displayed as a message
labelStyleCopy = gui.defaultLabelStyle.copy()
labelStyleCopy['wordwrap'] = True
labelStyleCopy['autosize'] = False
labelStyleCopy['font'] = myfont
labelStyleCopy['font-color'] = color_blue
#labelStyleCopy['font-color'] = font_color
self.win = gui.Window(position = position_win, size = size_win, parent = threades.desktop, text = "Trade " ,style = win_style,shadeable = False, moveable = False)
# Creating label
label_text = '\n'+buddyName + ' wants to ' + trade + ' ' + quantity + ' units of '+ resource + '\n at $ '+ price
message_label = gui.Label(position = threades.resize_pos((5,5),(470.0,180.0),self.win.size),size = threades.resize_pos((460,120),(470.0,180.0),self.win.size), parent = self.win, text = label_text, style = labelStyleCopy)
# Creating button style
myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(16))
button_style = gui.defaultButtonStyle.copy()
button_style['font'] = myfont2
self.button_accept = gui.Button(position = threades.resize_pos((100.0,130.0),(470.0,180.0),size_win), size = threades.resize_pos((100.0,40.0),(470.0,180.0),size_win), parent = self.win, text = " Accept ",style = button_style)
self.button_reject = gui.Button(position = threades.resize_pos((300.0,130.0),(470.0,180.0),size_win), size = threades.resize_pos((100.0,40.0),(470.0,180.0),size_win), parent = self.win, text = " Reject ",style = button_style)
self.button_accept.onClick = self.checkTrade
self.button_reject.onClick = self.closeWin
sleep(6)
if self.win:
self.win.close()
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:46,代码来源:game_sharing.py
示例10: message_window
def message_window():
''' Thread to display the messages'''
font_color = (255,214,150)
myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))
# Custom gui.Window Style
win_style = gui.defaultWindowStyle.copy()
win_style['font'] = myfont
win_style['bg-color'] = (0,0,0)
# Calculating position and size of window from the size of the threades.desktop
position_win =threades.resize_pos((745.0,42.0))
size_win =threades.resize_pos((450.0,150.0))
# Creating custom label style for the text to be displayed as a threades.message
labelStyleCopy = gui.defaultLabelStyle.copy()
labelStyleCopy['wordwrap'] = True
labelStyleCopy['autosize'] = False
labelStyleCopy['font'] = myfont
#labelStyleCopy['font-color'] = font_color
while True:
(text,color) = threades.message.pop_message()
if text:
# Creating window
win_style['font-color'] = color
labelStyleCopy['font-color'] = color
win = gui.Window(position = position_win, size = size_win, parent = threades.desktop, text = "Message " ,style = win_style ,closeable = False ,shadeable = False,moveable = False)
pygame.draw.rect(win.surf,color,threades.resize_rect((3,3,444,144)),1)
#win.surf.set_alpha(160)
# Creating label
message_label = gui.Label(position = threades.resize_pos((5,50),(450.0,150.0),win.size),size = threades.resize_pos((440,140),(450.0,150.0),win.size), parent = win, text = text, style = labelStyleCopy)
sleep(6)
win.close()
if threades.GAME_EXIT_FLAG:
return
sleep(1)
if threades.GAME_EXIT_FLAG:
return
sleep(1)
if threades.GAME_EXIT_FLAG:
return
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:45,代码来源:Foodforce2.py
示例11: update
def update(self):
for i in range(len(model.facilities_list)):
if not (self.list_num_fac[i] == model.facilities_list[i].get_original_number()):
self.update_flag = True
if self.update_flag or threades.map_update_flag or threades.total_update_flag:
threades.screen.blit(self.map,threades.resize_pos((930,390)))
posn = threades.resize_pos((930+int(3200/23.22),390+int(2600/24.80)))
threades.screen.blit(load_images.Map_images[6],posn)
for i in range(len(model.facilities_list)):
for j in range(model.facilities_list[i].get_original_number()):
posn = threades.resize_pos((930+int(model.facilities_list_sprites[model.facilities_list[i].get_name()][j].position[0]/23.22),390+int(model.facilities_list_sprites[model.facilities_list[i].get_name()][j].position[1]/24.80)))
threades.screen.blit(load_images.Map_images[i],posn)
rect_draw = threades.transform_obj.village_boundary_covered()
rect_final = threades.resize_rect((930+rect_draw[0]/23.22, 390 + rect_draw[1]/24.80, (rect_draw[2]-rect_draw[0])/23.22, (rect_draw[3]-rect_draw[1])/24.80))
pygame.draw.rect(threades.screen, (47, 47, 255, 180), rect_final, 2)
self.update_flag = False
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:18,代码来源:display_panel.py
示例12: __init__
def __init__(self):
pygame.sprite.Sprite.__init__(self)
mask= pygame.surface.Surface(threades.resize_pos((930,600)),SRCALPHA)
mask.fill((0,0,0,0))
self.clock = pygame.time.Clock()
self.time = 0
#mask.set_alpha(0)
self.alpha = 0
self.image = mask
self.rect = self.image.get_rect()
self.rect.move(threades.resize_pos((0,0)))
self.counter = 0
self.prev_disp = (0,0)
self.move_dir = [(-20,-20),(-20,-10),(-20,0),(-20,10),(-20,20),(-10,-20),(-10,-20),(-10,0),(-10,10),(-10,20),(0,-20),(0,-10),(0,0),(0,10),(0,20),(10,-20),(10,-20),(10,0),(10,10),(10,20),(20,-20),(20,-10),(20,0),(20,10),(20,20)]
# To close all open windows
if gui_buttons.gui_obj.get_child_win_flag():
gui_buttons.gui_obj.close_child_win()
gui_buttons.gui_obj.close_win()
elif gui_buttons.gui_obj.get_win_flag():
gui_buttons.gui_obj.close_win()
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:21,代码来源:natural_calamities.py
示例13: update_value
def update_value(self):
''' Updates the model.resources panel
'''
self.money_flag = False
for i in range(11):
if not (self.value_labels[i].text == str(int(model.resources[i].get_vquantity()))):
self.update_flag = True
if self.update_flag or threades.panel_update_flag or threades.total_update_flag:
pygame.draw.line(threades.screen,self.color_grey,threades.resize_pos((400,645)),threades.resize_pos((400,855)),1)
pygame.draw.line(threades.screen,self.color_grey,threades.resize_pos((650,645)),threades.resize_pos((650,855)),1)
for i in range(11):
if not (self.value_labels[i].text == str(int(model.resources[i].get_vquantity()))):
self.value_labels[i].text = str(int(model.resources[i].get_vquantity()))
if not (self.money_label.text == model.text_file.money_text[0] +' -: '+str(int(model.money.get_money()))+' '):
self.money_flag = True
self.money_label.text = model.text_file.money_text[0] +' -: '+str(int(model.money.get_money()))+' '
#print 'no of days is',model.game_controller.get_days()
if self.time_flag==True:
#self.time_label.text=''
#NOTE: Here, I am not adding as if years is not 0 , then only it will be blitted becoz if do like that the things will keep on changing, not a nice view
self.time_label.text= model.text_file.time_text[0]+' -: '+model.text_file.time_text[2]+': '+str(model.game_controller.get_years())+' '+model.text_file.time_text[3]+': '+str(model.game_controller.get_months()) +' '+model.text_file.time_text[4]+': '+str(model.game_controller.get_days())
self.time_flag=True
#to update the money flag
#print 'global_time is',model.game_controller.get_global_time(),'while the time_help_value is',self.time_help_value
if (model.game_controller.get_global_time()>((model.game_controller.conversion_factor)+self.time_help_value)):
self.time_flag=True
self.time_help_value=model.game_controller.get_global_time()
self.update_flag = False
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:39,代码来源:display_panel.py
示例14: __init__
def __init__(self):
''' Constructor
'''
global background_image
self.chatWinFlag = False
#Initialises the chat window
self.position = threades.resize_pos((15,10))
self.initial_position = threades.resize_pos((15,10))
self.final_position = threades.resize_pos((15,750))
self.update_win_pos=pygame.Rect(threades.resize_pos((150.0,50.0)),threades.resize_pos((900,800)))
self.imageBox = pygame.image.load(os.path.join('storyboards','storyboard1','images','chat images', 'imageBox.png')).convert_alpha()
self.chatBox = pygame.image.load(os.path.join('storyboards','storyboard1','images','chat images', 'chatBox.png')).convert_alpha()
#list for storing the images loaded in the chatbox
self.characterImage={}
if model.storyboard_file == 'storyboard1/storyboard.pkl':
self.characterImage['KAMAT']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'kamat.png')).convert_alpha()
self.characterImage['SON']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'son.png')).convert_alpha()
self.characterImage['AJMAL']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'ajmal.png')).convert_alpha()
self.characterImage['PANCH']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'panch.png')).convert_alpha()
self.characterImage['PRIEST']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'priest.png')).convert_alpha()
self.characterImage['SUKHDEV']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'sukhdev.png')).convert_alpha()
self.characterImage['FARMER']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'villager.png')).convert_alpha()
else:
self.characterImage['TONY PERALTA']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'tony.png')).convert_alpha()
self.characterImage['STEVENSON GORBACHEV']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'stevenson.png')).convert_alpha()
self.characterImage['GILBERT FERNANDEZ']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'gilbert.png')).convert_alpha()
self.characterImage['JOHN TREMBLAY']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'john.png')).convert_alpha()
self.characterImage['RAGNAR STEFANSSON']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'ragnar.png')).convert_alpha()
# changes made while adding skip buttons etc
self.size_win =threades.resize_pos((900.0,800.0))
self.myfont = pygame.font.Font("font.ttf", threades.resize_pt(16))
self.button_style=gui.defaultButtonStyle.copy()
self.button_style['font']=self.myfont
#crating label textsurface
#myfont = pygame.font.Font("font.ttf",10)
#textColor = (0,0,0)
#self.label_text=' ENTER : To show whole chat at once ESC : To skip chat '
#self.label_textsurface=gui.renderText(self.label_text,myfont,True,textColor,(700,20),False,True)
#self.label_tempSurface = pygame.transform.scale(self.chatBox,(800,30))
#creating a label for the chat window
self.label_text=' ENTER : To show whole chat ESC : To skip chat '
self.myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(20))
self.labelStyleCopy = gui.defaultLabelStyle.copy()
self.labelStyleCopy['border-width'] = 1
self.labelStyleCopy['wordwrap'] = True
self.labelStyleCopy['autosize'] = False
self.labelStyleCopy['font'] = self.myfont2
self.labelStyleCopy['font-color'] = (255,214,150)
self.labelStyleCopy['border-color'] = (255,214,150)
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:55,代码来源:chat.py
示例15: new_level_stats
def new_level_stats(self,data_file,graphics_file,level_no=-1):
#global total_update_flag
global animation_obj
threades.pause_update_thread()
self.graphics()
self.level_no=level_no
self.data_file=data_file
self.graphics_file=graphics_file
self.run=True
level_updater=threading.Thread(target=self.level_reinit,args=[]).start()
pygame.display.set_caption('FoodForce2')
threades.screen.fill((0,0,0))
threades.screen.blit(self.ff_logo,threades.resize_pos((40,50)))
desktop_level.update()
desktop_level.draw()
pygame.display.update()
while 1 :
for e in gui.setEvents(pygame.event.get()):
if e.type == pygame.QUIT:
print 'in pygame.quit'
safe_exit()
if e.type == QUIT:
print 'in quit'
safe_exit()
#if level_updater.is_alive()==False:
# self.run=False GREAT THIS IS APPLICABLE ONLY WITH PYTHON 2.6, SO HAVE TO SEARCH SOME OTHER MEANS
if self.run==False:
break
#print 'now reached here\n'
self.ff_logo = 0
threades.initialize_facilities(True)
threades.set_build_facility_placement_flag()
threades.facility_placement_data_obj.clear_placement_data()
#threades.current_level = proceduralFlow.storyboard_level
threades.total_update_flag = True
threades.resume_update_thread()
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:45,代码来源:level_change.py
示例16: main_menu
def main_menu(self,pause_flag = True):
''' Display the starting menu
'''
logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
self.ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
threades.screen.fill((0,0,0))
threades.screen.blit(self.ff_logo,threades.resize_pos((40,50)))
# Font type
myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))
# Creating new button style
buttonsurf = pygame.image.load(os.path.join('art','button_green.png')).convert_alpha()
self.button_style = gui.createButtonStyle(myfont,(0,0,0), buttonsurf,4,1,4,4,1,4,4,1,4,4,1,4)
self.pause_flag = pause_flag
if self.pause_flag:
self.start_button = gui.Button(position = threades.resize_pos((500,500)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Start New Game",style = self.button_style)
self.start_button.onClick = self.startup_text
else:
self.resume_button = gui.Button(position = threades.resize_pos((500,500)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Resume Game",style = self.button_style)
self.resume_button.onClick = self.resume
#self.resume_button = gui.Button(position = threades.resize_pos((500,550)), size = threades.resize_pos((200,30)), parent = threades.desktop, text = "Resume Game",style = self.button_style)
self.controls_button = gui.Button(position = threades.resize_pos((500,600)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Controls",style = self.button_style)
self.exit_button = gui.Button(position = threades.resize_pos((500,650)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Exit",style = self.button_style)
self.instructions_button = gui.Button(position = threades.resize_pos((500,550)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Guide",style = self.button_style)
self.about_us_button = gui.Button(position = threades.resize_pos((1000,20)), size = threades.resize_pos((150,30)), parent = desktop2, text = "About Us",style = self.button_style)
#self.resume_button.onClick = self.resume
self.controls_button.onClick = self.controls
self.exit_button.onClick = safe_exit
self.instructions_button.onClick = self.instructionsWindow
self.about_us_button.onClick = self.aboutUsWindow
self.run = True
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:39,代码来源:Foodforce2.py
示例17: __init__
def __init__(self):
''' Constructor
'''
global background_image
self.chatWinFlag = False
self.position = threades.resize_pos((15,10))
self.initial_position = threades.resize_pos((15,10))
self.final_position = threades.resize_pos((15,750))
self.update_win_pos=pygame.Rect(threades.resize_pos((150.0,50.0)),threades.resize_pos((900,800)))
self.imageBox = pygame.image.load(os.path.join('art', 'imageBox.png')).convert_alpha()
self.chatBox = pygame.image.load(os.path.join('art', 'chatBox.png')).convert_alpha()
self.characterImage={}
self.characterImage['KAMAT']=pygame.image.load(os.path.join('art', 'kamat.png')).convert_alpha()
self.characterImage['SON']=pygame.image.load(os.path.join('art', 'son.png')).convert_alpha()
self.characterImage['AJMAL']=pygame.image.load(os.path.join('art', 'ajmal.png')).convert_alpha()
self.characterImage['SUKHDEV']=pygame.image.load(os.path.join('art', 'sukhdev.png')).convert_alpha()
self.characterImage['FARMER']=pygame.image.load(os.path.join('art', 'villager.png')).convert_alpha()
# changes made while adding skip buttons etc
self.size_win =threades.resize_pos((900.0,800.0))
self.myfont = pygame.font.Font("font.ttf", threades.resize_pt(16))
self.button_style=gui.defaultButtonStyle.copy()
self.button_style['font']=self.myfont
#crating label textsurface
#myfont = pygame.font.Font("font.ttf",10)
#textColor = (0,0,0)
#self.label_text=' ENTER : To show whole chat at once ESC : To skip chat '
#self.label_textsurface=gui.renderText(self.label_text,myfont,True,textColor,(700,20),False,True)
#self.label_tempSurface = pygame.transform.scale(self.chatBox,(800,30))
self.label_text=' ENTER : To show whole chat ESC : To skip chat '
self.myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(20))
self.labelStyleCopy = gui.defaultLabelStyle.copy()
self.labelStyleCopy['border-width'] = 1
self.labelStyleCopy['wordwrap'] = True
self.labelStyleCopy['autosize'] = False
self.labelStyleCopy['font'] = self.myfont2
self.labelStyleCopy['font-color'] = (255,214,150)
self.labelStyleCopy['border-color'] = (255,214,150)
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:40,代码来源:chat.py
示例18: __init__
def __init__(self):
''' Draws the model.resources panel on the surface
'''
self.update_flag = True
self.money_flag = True
self.time_flag = False
self.time_help_value=0
myfont1 = pygame.font.Font("font.ttf", threades.resize_pt(30)) # For main heading
myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(20)) # For model.resources name and their value
myfont3 = pygame.font.Font("font.ttf", threades.resize_pt(16))
myfont4 = pygame.font.Font("font.ttf", threades.resize_pt(18)) # For the display of model.money
# Creating a custom label style
self.labelstyle1 = gui.defaultLabelStyle.copy()
self.labelstyle1['border-width'] = 1
self.labelstyle1['wordwrap'] = True
self.labelstyle1['autosize'] = False
self.labelstyle1['font'] = myfont1
self.labelstyle1['font-color'] = self.font_color
self.labelstyle1['border-color'] = self.color_grey
# Drawing main Resources rectangle
label = gui.Label(position = threades.resize_pos((400,600)),size = threades.resize_pos((500,45)), parent = threades.desktop, text = " Resources", style = self.labelstyle1)
# Creating second label style
self.labelstyle2 = gui.defaultLabelStyle.copy()
self.labelstyle2['border-width'] = 0
self.labelstyle2['wordwrap'] = True
self.labelstyle2['autosize'] = False
self.labelstyle2['font'] = myfont2
self.labelstyle2['font-color'] = self.font_color
self.labelstyle3 = gui.defaultLabelStyle.copy()
self.labelstyle3['border-width'] = 0
self.labelstyle3['wordwrap'] = False
self.labelstyle3['autosize'] = True
self.labelstyle3['font'] = myfont3
self.labelstyle3['font-color'] = self.font_color
self.labelstyle4 = gui.defaultLabelStyle.copy()
self.labelstyle4['border-width'] = 0
self.labelstyle4['wordwrap'] = False
self.labelstyle4['autosize'] = True
self.labelstyle4['font'] = myfont4
self.labelstyle4['font-color'] = (160,160,160)
self.money_label = gui.Label(position = threades.resize_pos((850,10)), parent = threades.desktop, text = 'Money -: '+str(int(model.money.get_money()))+' ', style = self.labelstyle4)
self.time_label= gui.Label(position = threades.resize_pos((300,10)), parent = threades.desktop, text = 'Time Elapsed -: '+'Level Just Started'' ', style = self.labelstyle4)
self.value_labels = []
# Drawing general model.resources list
list_gen_res = (' Water',' Bricks',' Tools',' Medicines',' Books')
for i in range(5):
label = gui.Label(position = threades.resize_pos((400,645+35*i)),size = threades.resize_pos((200,35)), parent = threades.desktop, text = list_gen_res[i], style = self.labelstyle2)
label = gui.Label(position = threades.resize_pos((605,649+35*i)), parent = threades.desktop, text = str(int(model.resources[i].get_vquantity())), style = self.labelstyle3)
self.value_labels.append(label)
# Drawing food model.resources list
list_food_res = (' Rice',' Fruit & Vegetables',' Beans',' Sugar',' Salt',' Oil')
for i in range(6):
label = gui.Label(position = threades.resize_pos((650,645+35*i)),size = threades.resize_pos((200,35)), parent = threades.desktop, text = list_food_res[i], style = self.labelstyle2)
label = gui.Label(position = threades.resize_pos((855,649+35*i)), parent = threades.desktop, text = str(int(model.resources[i+5].get_vquantity())), style = self.labelstyle3)
self.value_labels.append(label)
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:63,代码来源:display_panel.py
示例19: showFailureWindow
def showFailureWindow(self,text):
self.brown_color = (255,214,150)
self.green_color = (0,250,0)
self.black_color = (0,0,0)
myfont1 = pygame.font.Font("font.ttf", threades.resize_pt(40))
# Custom gui.Window Style
win_style = gui.defaultWindowStyle.copy()
win_style['font'] = myfont1
win_style['font-color'] = self.brown_color
win_style['bg-color'] = (0,0,0)
win_style['border-color'] = self.brown_color
win_style['border-width'] = 2
st_desktop = gui.Desktop()
clock = pygame.time.Clock()
clock.tick()
# Calculating position and size of window from the size of the threades.desktop
position_win =threades.resize_pos((150.0,100.0))
size_win =threades.resize_pos((900.0,500.0))
# Creating window
self.win = gui.Window(position = position_win, size = size_win, parent = st_desktop, text = " FoodForce2" , style = win_style, shadeable = False, closeable = False,moveable = False)
#self.win.onClose = lambda button: self.main_menu(self.pause_flag)
#self.win.surf.set_alpha(140) This seems to be redundant as translucency doesnt seems to work properly
myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(20))
labelStyleCopy = gui.defaultLabelStyle.copy()
labelStyleCopy['border-width'] = 0
labelStyleCopy['wordwrap'] = True
labelStyleCopy['autosize'] = False
labelStyleCopy['font'] = myfont2
labelStyleCopy['font-color'] = self.brown_color
labelStyleCopy['border-color'] = self.black_color
self.storyboardwin_run = True
#logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
#ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
#self.instructions_counter = 0
label = gui.Label(position = threades.resize_pos((100.0,100.0),(900.0,500.0),self.win.size),size = threades.resize_pos((700.0,340.0),(900.0,500.0),self.win.size), parent = self.win, text = text, style = labelStyleCopy)
gl_time = 0
st_desktop.update()
st_desktop.draw()
pygame.display.update()
while self.storyboardwin_run:
pygame.display.set_caption('FoodForce2')
for e in gui.setEvents(pygame.event.get()):
if e.type == KEYDOWN:
if e.key == 27: # For escape key
self.storyboardwin_run = False
gl_time += clock.tick()
if gl_time >= 17000:
self.storyboardwin_run = False
event = game_events.Event(type = game_events.ACTIONCOMPLETEEVENT, facility_name = '', res_name = '' , res_quantity = 0)
game_events.EventQueue.add(event)
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:67,代码来源:proceduralFlow.py
|
请发表评论