A package to show your fps in pygame
Project description
pygameFPS
A simple python package to show your fps in pygame
Example:
import pygame
import pygameFPS as fps
pygame.init()
screen = pygame.display.set_mode([500, 500])
running = True
pygame.init()
screen = pygame.display.set_mode((1280, 720))
pygame.display.set_caption('Graphing calculator')
clock = pygame.time.Clock()
maxFPS = 144
running = True
while running:
mouse_pos = pygame.mouse.get_pos()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
fps.tick()
# default rendering
fps.render(screen)
# custom args(surface, x, y, size, color)
fps.render(screen, 50, 50, 24, (255, 255, 255))
screen.fill("black")
width = 1280
height = 720
colour = (255, 255, 255)
font = pygame.font.SysFont(None, 24)
img = font.render(f'FPS: {getFPS()}', True, colour)
screen.blit(img, (20, 20))
pygame.draw.line(screen, colour, (width / 2, 0), (width / 2, height), 3)
pygame.draw.line(screen, colour, (0, height / 2), (width, height / 2), 3)
for line in lines:
if not line.getCalculated():
line.calculate()
x = line.x
y = line.y
x2 = line.x2
y2 = line.y2
half_width = width / 2
half_height = height / 2
pygame.draw.line(screen, colour, (half_width + x, half_height + y), (half_width + x2, half_height + y2), 3)
pygame.display.flip()
clock.tick(maxFPS)
pygame.quit()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pygameFPS-1.0.4.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygameFPS-1.0.4.tar.gz.
File metadata
- Download URL: pygameFPS-1.0.4.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
558e10afeb5fbbfcf5f4093517fac90eee4a3b12067cae21c212e29e05fcb34a
|
|
| MD5 |
fa4fb892cd64efe88a9f2ed539a95f98
|
|
| BLAKE2b-256 |
03de029b7a78cd5facedf0d7a52fa243c0531ef70ff479eba0ce6eb39f03762e
|
File details
Details for the file pygameFPS-1.0.4-py3-none-any.whl.
File metadata
- Download URL: pygameFPS-1.0.4-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b1666870788064f8b63ba56683f2b980ca40140e165a7845135fdc9c84d8ea3
|
|
| MD5 |
ab121b81f339346b13a38d7e0ca04c20
|
|
| BLAKE2b-256 |
a4c31ebc4f61533ce159e1c1d7b24e50d35fb33f98bb81aa092ea4ad11d89811
|