File: gamepause.py

package info (click to toggle)
solarwolf 1.5%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,656 kB
  • sloc: python: 5,353; ansic: 159; makefile: 102; pascal: 50; sh: 27
file content (43 lines) | stat: -rw-r--r-- 1,185 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""in game help screens"""

import math
import pygame
from pygame.locals import *
import game
import gfx, snd, txt
import input
import gamehelp

fonts = []

def load_game_resources():
    fonts.append(txt.Font('sans', 16, italic=1))
    fonts.append(txt.Font('sans', 25, bold=1))




class GamePause(gamehelp.GameHelp):
    def __init__(self, prevhandler):
        x = game.arena.centerx - 60
        y = game.arena.centery - 20
        gamehelp.GameHelp.__init__(self, prevhandler, '', (x, y))


    def drawhelp(self, name, pos):
        title = 'Paused'
        text = 'Press Any Key To Continue'

        self.img = fonts[0].textbox((255, 240, 200), text, 200, (50, 100, 50), 50)
        r = self.img.get_rect()
        titleimg, titlepos = fonts[1].text((255, 240, 200), title, (r.width//2, 10))
        self.img.blit(titleimg, titlepos)
        r.topleft = pos
        r = r.clamp(game.arena)
        alphaimg = pygame.Surface(self.img.get_size())
        alphaimg.fill((50, 100, 50))
        alphaimg.set_alpha(192)
        gfx.surface.blit(alphaimg, r)
        self.img.set_colorkey((50, 100, 50))
        self.rect = gfx.surface.blit(self.img, r)
        gfx.dirty(self.rect)