コード例 #1
0
ファイル: hud.py プロジェクト: r452031538/csci321
def drawstats():
    global statsbox
    if not state.you:
        return
    w = F(80)
    if statsbox is None or statsbox.get_size() != (w, w):
        statsbox = pygame.Surface((w, w)).convert_alpha()
    statsbox.fill((0, 0, 0, 30))
    img = image.get(state.you.imgname, s=F(60))
    statsbox.blit(img, img.get_rect(center=statsbox.get_rect().center))
    pygame.draw.rect(statsbox, (255, 255, 255, 40), (0, 0, w, w), F(3))
    window.screen.blit(statsbox, statsbox.get_rect(left=F(10), top=F(10)))
    shipname, special = shipdata[state.you.__class__.__name__]
    text = "\n".join([
        "Current ship: %s" % shipname,
        "Hold space: teleport",
        "Tap space: %s" % special if special is not None else "",
        "Backspace: emergency teleport",
    ])
    ptext.draw(text,
               topleft=F(10, 104),
               fontsize=F(16),
               shadow=(1, 1),
               lineheight=1.1,
               alpha=0.5,
               fontname="Exo")
    x0, y0, w, h, dx, thick = F(104, 10, 16, 20, 20, 2)
    for j in range(state.you.maxhp):
        pygame.draw.rect(window.screen, (0, 100, 0), (x0 + j * dx, y0, w, h),
                         (0 if j < state.you.hp else thick))
コード例 #2
0
ファイル: hud.py プロジェクト: mrjocantaro/pyjam
def drawstats():
	global statsbox
	if not state.you:
		return
	w = F(80)
	if statsbox is None or statsbox.get_size() != (w, w):
		statsbox = pygame.Surface((w, w)).convert_alpha()
	statsbox.fill((0, 0, 0, 30))
	img = image.get(state.you.imgname, s = F(60))
	statsbox.blit(img, img.get_rect(center = statsbox.get_rect().center))
	pygame.draw.rect(statsbox, (255, 255, 255, 40), (0, 0, w, w), F(3))
	window.screen.blit(statsbox, statsbox.get_rect(left = F(10), top = F(10)))
	shipname, special = shipdata[state.you.__class__.__name__]
	text = "\n".join([
		"Current ship: %s" % shipname,
		"Hold space: teleport",
		"Tap space: %s" % special if special is not None else "",
		"Backspace: emergency teleport",
	])
	ptext.draw(text, topleft = F(10, 104), fontsize = F(16), shadow = (1, 1),
		lineheight = 1.1, alpha = 0.5, fontname = "Exo")
	x0, y0, w, h, dx, thick = F(104, 10, 16, 20, 20, 2)
	for j in range(state.you.maxhp):
		pygame.draw.rect(window.screen, (0, 100, 0),
			(x0 + j * dx, y0, w, h), (0 if j < state.you.hp else thick))
コード例 #3
0
def draw():
	if not currentline:
		return
	if currentline[0] == "E" or currentline[0] == "C":
		return
	fontname, fontsize, color = style[currentline[0]]
	ptext.draw(currentline[2:], fontsize = F(fontsize), width = F(640), owidth = 0, shadow = (1, 1),
		left = F(180), bottom = window.sy - F(10), fontname = fontname, color = color)
	img = image.get("avatar-" + currentline[0] + ".bmp", s = F(150))
	window.screen.blit(img, img.get_rect(center = F(90, 390)))