Changeset 45:7f7b4bfbaf0e


Ignore:
Timestamp:
Apr 3, 2011, 6:48:26 PM (9 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Message:

Trivial text rendering widget

Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/level-editor

    r42 r45  
    1111import pygame.key
    1212from pygame.locals import (SWSURFACE, QUIT, KEYDOWN, K_UP, K_DOWN, K_LEFT,
    13                            K_RIGHT, KMOD_SHIFT, K_q)
     13                           K_RIGHT, KMOD_SHIFT, K_q, K_ESCAPE)
    1414
    1515from skaapsteker.constants import SCREEN
    1616from skaapsteker.level import Level
     17import skaapsteker.widgets.text
    1718
    1819FRAMERATE = 60
     
    4142                elif ev.key == K_RIGHT:
    4243                    position[0] += distance
    43                 elif ev.key == K_q:
     44                elif ev.key in (K_q, K_ESCAPE):
    4445                    return
    4546
     
    5354        level.draw(level_surface)
    5455        screen_surface.blit(level_surface, (0, 0), clip_rect)
     56
     57        text = skaapsteker.widgets.text.Text("Level: %s. Offset: %r"
     58                                            % (levelname, position),
     59                                            colour='white')
     60        text.draw(screen_surface, (10, 10))
    5561
    5662        pygame.display.flip()
Note: See TracChangeset for help on using the changeset viewer.