def __init__(self, start_position, width, height, frame_parent): #images UIFrame.__init__(self, start_position, width, height, frame_parent) self.is_active = False self.player_data_frame = PlayerDataFrame(euclid.Vector2(170, 150), 300, 100, self) self.all_elements = [self.player_data_frame]
def __init__(self, start_position, width, height, parent_frame=None): #images UIFrame.__init__(self, start_position, width, height, parent_frame) #elements self.create_button = TextButton(Vector2(0, height - 23), width, 25, list(globals.button_img_list), "Create Game", self, self.create_pressed, text_pos=(29, 6)) self.game_name_label = Label(Vector2(5, 0), "Room Name") self.game_name_text_field = TextField( Vector2(25, 15), width - 25, 15, "", list(globals.text_field_img_list), 10, self) self.cycle_button = CycleButton( Vector2(5, self.game_name_text_field.start_position.y + 30.0), width - 10, 15, globals.map_names, self) self.all_elements = [ self.create_button, self.game_name_label, self.cycle_button, self.game_name_text_field ]
def __init__(self, start_position, width, height, frame_parent): UIFrame.__init__(self, start_position, width, height, frame_parent) self.rect.center = self.frame_parent.rect.center self.close_button = Button(euclid.Vector2(width - 35, 5), 30, 30, list(globals.close_button_img_list), self, self.frame_parent.close_pause_menu) self.quit_game_button = TextButton(euclid.Vector2(5, 100), 145, 25, list(globals.button_img_list), "Quit Game", self, self.main_frame_parent().quit_game, text_pos=(25, 6)) self.quit_to_lobby_button = TextButton( euclid.Vector2(5, 130), 160, 25, list(globals.button_img_list), "Quit to Lobby", self, self.main_frame_parent().quit_to_lobby, text_pos=(25, 6)) self.all_elements = [ self.close_button, self.quit_game_button, self.quit_to_lobby_button ]
def __init__(self, start_position, width, height, frame_parent): #images UIFrame.__init__(self, start_position, width, height, frame_parent) self.background = Background(start_position, self, width, height) self.main_frame = MainFrame(start_position, 800, 600, self) self.is_active = False self.all_elements = [self.background, self.main_frame]
def __init__(self, parent, start_position=Vector2(0.0, 0.0)): self.width = globals.screen.get_width() self.height = globals.screen.get_height() self.font = pygame.font.SysFont('arial', 12) UIFrame.__init__(self, start_position, self.width, self.height, parent) #WorldObject.__init__(self, start_position, self.screen_size_x, self.screen_size_y, velocity, image_list) #self.pause_menu = PauseMenu(font, self.screen_size_x, self.screen_size_y, screen) # # Make a chat box. # self.chat_box = ChatBox(player_heads_up_display=self) # Load sprite sheets. self.health = 0 self.max_health = 0 crosshair_sheet = SpriteSheet("resources/images/Crosshair Sheet.png") sprite_sheet = SpriteSheet("resources/images/Sprite Sheet1.png") # Load crosshair. self.crosshair = BlitData( crosshair_sheet.imageAt(pygame.Rect(176, 158, 46, 48))) # load health bar info self.hp_overlay = BlitData( sprite_sheet.imageAt(pygame.Rect(652, 373, 290, 90)), (0, 0)) self.hp_bar = BlitData( sprite_sheet.imageAt(pygame.Rect(722, 485, 213, 40)), (64, 22)) self.mana_bar = BlitData( sprite_sheet.imageAt(pygame.Rect(722, 529, 146, 20)), (68, 65), (0, 0, 159, 20)) # set colorkey so black pixels will be transparent # self.image.set_colorkey(BLACK) # set black to transparent # self.image.fill(BLACK) # ammo and weapon data self.ammo_string = "send me text" self.weapon_string = "send me text" self.ammo_string_surface = self.font.render(self.ammo_string, True, [255, 255, 255]) self.weapon_string_surface = self.font.render(self.weapon_string, True, [255, 255, 255]) self.ammo_blit = BlitData(self.ammo_string_surface, (globals.screen.get_width() / 1.16, globals.screen.get_height() / 1.11)) self.weapon_blit = BlitData(self.weapon_string_surface, (globals.screen.get_width() / 1.16, globals.screen.get_height() / 1.066)) # order this list in which one you want blit first. top picture = last in the list. #self.blit_list = [self.hp_overlay, self.hp_bar, self.ammo_blit, self.weapon_blit, self.crosshair] self.blit_list = [ self.hp_overlay, self.hp_bar, self.mana_bar, self.ammo_blit, self.weapon_blit, self.crosshair ]
def __init__(self, start_position, width, height, parent_frame=None): #images UIFrame.__init__(self, start_position, width, height, parent_frame) self.display_name_label = Label(euclid.Vector2(0, 0), "Displayed Name:", self) self.display_name_textfield = TextField(euclid.Vector2(width - 150, self.display_name_label.rect.top), 150, 15, user_name, list(globals.text_field_img_list), 10, self) self.save_button = TextButton(euclid.Vector2(width / 2 - 25, height - 20), 50, 20, list(globals.ready_button_img_list), "Save", self, self.save_pressed) self.all_elements = [self.display_name_label, self.display_name_textfield, self.save_button]
def __init__(self, start_position, width, height, frame_parent): #images UIFrame.__init__(self, start_position, width, height, frame_parent) #room frame and nav buttons self.room_frame = PageButton(Vector2(170, 150), 600, 300, self) #create game and search game self.make_game_frame = MakeGameSurface(Vector2(0, 150), self.room_frame.rect.left - 10, self.room_frame.get_height(), self) self.all_elements = [self.room_frame, self.make_game_frame]
def __init__(self, start_position, width, height, parent_frame): UIFrame.__init__(self, start_position, width, height, parent_frame) self.parent_frame = parent_frame #butons_frame self.buttons_frame = ButtonsFrame(Vector2(0, 60), width, height - 60, self, parent_frame) self.player_list_frame = PlayerListFrame(Vector2(0, 50), 250, height - 100, self) self.all_elements = [self.buttons_frame, self.player_list_frame]
def __init__(self, start_position, width, height, parent_frame): UIFrame.__init__(self, start_position, width, height, parent_frame) self.list_padding = 30 self.parent_frame = parent_frame self.height = height self.width = width self.background_surface = pygame.image.load( 'resources/images/game_lobby_background_blue.png') self.all_elements = [] self.update_player_list_thread = None self.__update_player_list()
def __init__(self, start_position, width, height, parent_frame): UIFrame.__init__(self, start_position, width, height, parent_frame) self.buttons_per_page = height / BUTTON_HEIGHT self.current_page = 0 self.start_position = start_position self.back_button = Button(Vector2(0, 0), 50, height, list(globals.forward_button_img_list), self, self.back_pressed) self.forward_button = Button(Vector2(width - 50, 0), 50, height, list(globals.back_button_img_list), self, self.forward_pressed) self.game_button_list = [] #begin polling for rooms self.update_game_list_thread = RepeatTask(5, self.update_game_list) self.update_game_list_thread.start()
def __init__(self, start_position, width, height, parent_frame=None): #images UIFrame.__init__(self, start_position, width, height, parent_frame) #elements self.create_button = TextButton(Vector2(0, height - 23), width, 25, list(globals.button_img_list), "Create Game", self, self.create_pressed, text_pos=(29, 6)) self.game_name_label = Label(Vector2(5, 0), "Room Name") self.game_name_text_field = TextField(Vector2(25, 15), width - 25, 15, "", list(globals.text_field_img_list), 10, self) self.cycle_button = CycleButton(Vector2(5, self.game_name_text_field.start_position.y + 30.0), width - 10, 15, globals.map_names, self) self.all_elements = [self.create_button, self.game_name_label, self.cycle_button, self.game_name_text_field]
def __init__(self, start_position, width, height, frame_parent): UIFrame.__init__(self, start_position, width, height, frame_parent) self.rect.center = self.frame_parent.rect.center self.close_button = Button(euclid.Vector2(width - 35, 5), 30, 30, list(globals.close_button_img_list), self, self.frame_parent.close_pause_menu) self.quit_game_button = TextButton(euclid.Vector2(5, 100), 145, 25, list(globals.button_img_list), "Quit Game", self, self.main_frame_parent().quit_game, text_pos=(25, 6)) self.quit_to_lobby_button = TextButton(euclid.Vector2(5, 130), 160, 25, list(globals.button_img_list), "Quit to Lobby", self, self.main_frame_parent().quit_to_lobby, text_pos=(25, 6)) self.all_elements = [self.close_button, self.quit_game_button, self.quit_to_lobby_button]
def __init__(self, parent, start_position=Vector2(0.0, 0.0)): self.width = globals.screen.get_width() self.height = globals.screen.get_height() self.font = pygame.font.SysFont('arial', 12) UIFrame.__init__(self, start_position, self.width, self.height, parent) #WorldObject.__init__(self, start_position, self.screen_size_x, self.screen_size_y, velocity, image_list) #self.pause_menu = PauseMenu(font, self.screen_size_x, self.screen_size_y, screen) # # Make a chat box. # self.chat_box = ChatBox(player_heads_up_display=self) # Load sprite sheets. self.health = 0 self.max_health = 0 crosshair_sheet = SpriteSheet("resources/images/Crosshair Sheet.png") sprite_sheet = SpriteSheet("resources/images/Sprite Sheet1.png") # Load crosshair. self.crosshair = BlitData(crosshair_sheet.imageAt(pygame.Rect(176, 158, 46, 48))) # load health bar info self.hp_overlay = BlitData(sprite_sheet.imageAt(pygame.Rect(652, 373, 290, 90)), (0, 0)) self.hp_bar = BlitData(sprite_sheet.imageAt(pygame.Rect(722, 485, 213, 40)), (64, 22)) self.mana_bar = BlitData(sprite_sheet.imageAt(pygame.Rect(722, 529, 146, 20)), (68, 65), (0, 0, 159, 20)) # set colorkey so black pixels will be transparent # self.image.set_colorkey(BLACK) # set black to transparent # self.image.fill(BLACK) # ammo and weapon data self.ammo_string = "send me text" self.weapon_string = "send me text" self.ammo_string_surface = self.font.render(self.ammo_string, True, [255, 255, 255]) self.weapon_string_surface = self.font.render(self.weapon_string, True, [255, 255, 255]) self.ammo_blit = BlitData(self.ammo_string_surface, (globals.screen.get_width() / 1.16, globals.screen.get_height() / 1.11)) self.weapon_blit = BlitData(self.weapon_string_surface, (globals.screen.get_width() / 1.16, globals.screen.get_height() / 1.066)) # order this list in which one you want blit first. top picture = last in the list. #self.blit_list = [self.hp_overlay, self.hp_bar, self.ammo_blit, self.weapon_blit, self.crosshair] self.blit_list = [self.hp_overlay, self.hp_bar, self.mana_bar, self.ammo_blit, self.weapon_blit, self.crosshair]
def __init__(self, start_position, width, height, parent_frame, game_lobby): UIFrame.__init__(self, start_position, width, height, parent_frame) #buttons self.ready_button = TextButton( Vector2(0, 0), 157, 38, list(globals.ready_button_img_list), "", self, function=PlayerNetworking().set_player_ready_status) self.start_game_button = TextButton(Vector2(160, 0), 145, 23, list(globals.button_img_list), "Start Game", self, game_lobby.start_game_pressed, text_pos=(25, 6)) self.all_elements = [self.ready_button, self.start_game_button]