示例#1
0
# encoding * utf - 8 *
"""
Unit Test for Button Polling
PASS
input test 2: See if new method for polling works
"""
# Import
import pygame as pg
import shmup.inputhandler as inputhandler
from shmup.config import *
# Setup
pg.init()
inputhandler.setup(KEY_MAP)
screen = pg.display.set_mode((500, 800))
font = pg.font.SysFont(
    pg.font.get_default_font(),
    30
)


def screen_print():
    for i, button in enumerate(KEYS):
        text = ">{}: {}".format(button,
                                inputhandler.poll_button(button)
                                )
        im = font.render(text, False, GREEN, BLACK)
        screen.blit(im, (5, 5 + 30 * i))



game = True
示例#2
0
# encoding * utf-8 *
"""
text.py test
testing to see if I can actually post fonts in

Notes:
    Want this for general purpose text drawing
"""
import pygame as pg
from shmup.config import *
import shmup.inputhandler as inputhandler
import shmup.text as text

# initialization
pg.init()
inputhandler.setup(DEBUG_MAP)
screen = pg.display.set_mode(RESOLUTION)

# Items to be tested go here

# Game Loop
clock = pg.time.Clock()
game = True
while game:
    dt = clock.tick(FPS) / 1000
    for event in inputhandler.get():
        if event.key == "QUIT":
            game = False
        elif event.key == "console" and event.down:
            # debug prompts go here
            pass