Beispiel #1
0
def display_input_box(message, surface, size=0):
	if size == 0:
		Textbox = textbox.Textbox('pictures/textbox.png', 190, 25, 250, 550, surface)
	elif size == 1:
		Textbox = textbox.Textbox('pictures/textbox1.png', 190, 25, 250, 550, surface)
	else:
		Textbox = textbox.Textbox('pictures/textbox2.png', 190, 25, 250, 550, surface)
	font = pygame.font.SysFont('monospace', 15)
	Textbox.draw(surface)

	if len(message) != 0:
		surface.blit(font.render(message, 1, (0, 0, 0)), (255, 555))

	loop(30)	#fps
Beispiel #2
0
def display_message(messages, surface):
	Msgbox = textbox.Textbox('pictures/msgbox.png', 500, 300, 150, 350, surface)

	font = pygame.font.SysFont('monospace', 15)
	Msgbox.draw(surface)

	line = 400
	max_char = 65

	for msg in messages:
		if len(msg) > max_char:
			while len(msg) >= max_char:
				n = 1
				while n < max_char:
					if msg[n] == ' ':
						last_space = n
					n += 1

				surface.blit(font.render(msg[:last_space], 1, (0, 0, 0)), (200, line))
				line += 20
				msg = msg[last_space + 1:]

		
		surface.blit(font.render(msg, 1, (0, 0, 0)), (200, line))
		line += 20

	loop(30)
Beispiel #3
0
	def __init__(self, image, width, heigth, x, y, cursor, surface):
		pygame.sprite.Sprite.__init__(self)

		self.image = pygame.image.load(image)

		self.cursor = cursor

		self.rect = self.image.get_rect()
		self.rect.x = x
		self.rect.y = y

		self.cursor_speed = 85

		self.description_box = textbox.Textbox('pictures/item_description_box.png',
								520, 25, self.rect.left, self.rect.top - 40, surface)