Пример #1
0
def render_panel(panel, bar, root_width, root_height, x, y):
	bar_y = root_height - bar.height
	
	# Background layer
	tcod.console_set_default_background(panel, bar.bgcolor)
	tcod.console_rect(panel, bar.x, bar.y, bar.total_width, 1, False, tcod.BKGND_SET)

	# Foreground layer
	tcod.console_set_default_background(panel, bar.fgcolor)
	if bar.width > 0:
		tcod.console_rect(panel, bar.x, bar.y, bar.width, 1, False, tcod.BKGND_SET)

	# Text overlay
	tcod.console_set_default_foreground(panel, tcod.white)
	tcod.console_print_ex(
		panel,
		bar.x + bar.width / 2,
		bar.y,
		tcod.BKGND_NONE,
		tcod.CENTER,
		"%s: %d/%d" % (bar.name, bar.value, bar.maximum)
	)

	if parser.OPTIONS['game']['debug'] is True:
		barf.Barf('DBG', '%s rendered' % panel)
Пример #2
0
	def create_window(self):
		ltc.console_set_custom_font('fonts/' + self.user_settings['font'], ltc.FONT_TYPE_GREYSCALE | ltc.FONT_LAYOUT_TCOD)
		ltc.console_init_root(self.settings_screenSize[0], self.settings_screenSize[1], 'Robot Death Area', False)
		ltc.console_set_default_background(0,constants.colors['background'])
		ltc.sys_set_fps(self.settings_fpsLimit)
		# clears it so it will take the new default background color
		ltc.console_clear(0)

		self.creates_the_cons()
Пример #3
0
def render_chat(console,w,h):
	tcod.console_set_default_foreground(console, tcod.white)
	tcod.console_set_default_background(console, tcod.black)
	tcod.console_print_frame(console, 0, parser.OPTIONS['game']['tileheight'] - 7, w, 7, True, tcod.BKGND_SET)

	## print the game messages, one line at a time
	y = parser.OPTIONS['game']['tileheight'] - 6
	for (line, color) in game.game_msgs:
		tcod.console_set_default_foreground(console, color)
		tcod.console_print_ex(console, 1, y, tcod.BKGND_NONE, tcod.LEFT, line)
		y +=1

	tcod.console_blit(console, 0, 0, w, h, console, 0, 0)
Пример #4
0
def render_health_bars(panel, bars, dest):
	i = 0

	for bar in bars.values():
		if parser.OPTIONS['game']['debug'] is True:
			barf.Barf('DBG', 'Rendering %s' % panel)
		i += 1
		render_panel(panel, bar, bar.x, bar.y, 1, i)
		#tcod.console_blit(panel, bar.x, bar.y, bar.width, 3, dest, bar.x, bar.y)

	# Health frame
	tcod.console_set_default_background(panel, tcod.Color(20, 20, 45))
	tcod.console_print_frame(panel, 0, 0, 22, 5, False, tcod.BKGND_SET)
	tcod.console_blit(panel, 0, 0, 22, 5, dest, 0, 0)

	# Health frame
	tcod.console_print_frame(panel, 0, 0, 22, 5, False, tcod.BKGND_DEFAULT)
	tcod.console_blit(panel, 0, 0, 22, 5, dest, 0, 0)