Changeset 54:43cd89b20492


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

FPS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/level-editor

    r50 r54  
    11#!/usr/bin/env python
    22"Skaapsteker level editor"
     3
     4from __future__ import division
    35
    46import optparse
     
    1517from skaapsteker.constants import SCREEN
    1618from skaapsteker.level import Level
    17 import skaapsteker.widgets.text
     19from skaapsteker.widgets.text import Text
    1820
    1921FRAMERATE = 60
     
    2527    level_surface = level.get_surface()
    2628    position = [0, 0]
     29    fps = 0
    2730    while True:
    2831        events = pygame.event.get()
     
    5659        screen_surface.blit(level_surface, (0, 0), clip_rect)
    5760
    58         text = skaapsteker.widgets.text.Text("Level: %s.\nOffset: %r"
    59                                             % (levelname, position),
    60                                             color='white')
     61        tilepos = (position[0] // 64, position[1] // 64)
     62        text = Text("Level: %s.\nOffset: %r Tile: %r\nFPS: %.1f"
     63                    % (levelname, position, tilepos, fps),
     64                    color='white')
    6165        text.draw(screen_surface, (10, 10))
    6266
    6367        pygame.display.flip()
    64         clock.tick(FRAMERATE)
     68        fps = 1000 / clock.tick(FRAMERATE)
    6569
    6670def main():
Note: See TracChangeset for help on using the changeset viewer.