2012-07-05 04:21:49 -04:00
|
|
|
----------------
|
|
|
|
Pygame Framework
|
|
|
|
----------------
|
|
|
|
|
2013-04-26 10:54:21 -04:00
|
|
|
Classes to facilitate creation of Pygame projects
|
2012-07-05 04:21:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
Example
|
2014-01-12 11:07:39 -05:00
|
|
|
-------
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2014-01-12 11:07:39 -05:00
|
|
|
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.
|
2012-07-05 04:21:49 -04:00
|
|
|
|
|
|
|
from time import sleep
|
|
|
|
from random import randint
|
|
|
|
|
|
|
|
from pgfw.Game import Game
|
|
|
|
|
|
|
|
class SampleGame(Game):
|
|
|
|
|
|
|
|
square_width = 30
|
|
|
|
|
2014-01-12 11:07:39 -05:00
|
|
|
# instructions in the update method automatically run once every frame
|
2012-07-05 04:21:49 -04:00
|
|
|
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__':
|
2018-05-21 19:46:28 -04:00
|
|
|
SampleGame().run()
|
2012-07-05 04:21:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
License
|
2014-01-12 11:07:39 -05:00
|
|
|
-------
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2012-07-10 05:39:45 -04:00
|
|
|
This software is dedicated to the public domain. See
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ for details.
|
2012-07-05 04:21:49 -04:00
|
|
|
|
|
|
|
|
2012-08-02 17:38:18 -04:00
|
|
|
Todo
|
2014-01-12 11:07:39 -05:00
|
|
|
----
|
2012-08-02 17:38:18 -04:00
|
|
|
|
|
|
|
- Remove unecessary python libraries from windows build
|
2013-03-05 08:23:17 -05:00
|
|
|
- Debug levels
|
2012-08-02 17:38:18 -04:00
|
|
|
|
|
|
|
|
2017-12-14 03:47:26 -05:00
|
|
|
Credit
|
|
|
|
------
|
2012-07-05 04:21:49 -04:00
|
|
|
|
2017-12-14 03:47:26 -05:00
|
|
|
Frank DeMarco <if.self.end@a-o.in>
|