56 lines
1.1 KiB
Plaintext
56 lines
1.1 KiB
Plaintext
----------------
|
|
Pygame Framework
|
|
----------------
|
|
|
|
Classes to facilitate creation of Pygame projects
|
|
|
|
|
|
Example
|
|
-------
|
|
|
|
Save and run to create a project that redraws a square at a random location
|
|
every second. This script is also written in the `sample.py` file.
|
|
|
|
from time import sleep
|
|
from random import randint
|
|
|
|
from pgfw.Game import Game
|
|
|
|
class SampleGame(Game):
|
|
|
|
square_width = 30
|
|
|
|
# instructions in the update method automatically run once every frame
|
|
def update(self):
|
|
sleep(1)
|
|
screen = self.get_screen()
|
|
bounds = screen.get_size()
|
|
screen.fill((0, 0, 0))
|
|
screen.fill((255, 255, 255),
|
|
(randint(0, bounds[0]), randint(0, bounds[1]),
|
|
self.square_width, self.square_width))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
SampleGame().run()
|
|
|
|
|
|
License
|
|
-------
|
|
|
|
This software is dedicated to the public domain. See
|
|
http://creativecommons.org/publicdomain/zero/1.0/ for details.
|
|
|
|
|
|
Todo
|
|
----
|
|
|
|
- Remove unecessary python libraries from windows build
|
|
- Debug levels
|
|
|
|
|
|
Credit
|
|
------
|
|
|
|
Frank DeMarco <if.self.end@a-o.in>
|