Multimedia library with the Adobe Flash-like API
Project description
Flappy
======
Flappy (the name stands for FLash-like APi for PYthon) is a cross platform multimedia library with the API very similar to the ActionScript 3 Flash API. Flappy is built on top of the SDL2_ library and a slightly modified subset of c/c++ code from the OpenFL-Lime_ project.
.. _SDL2: http://libsdl.org
.. _OpenFL-Lime: https://github.com/openfl/lime
Features
--------
* Runs on Windows, Linux, Mac OS X
* GPU accelerated
* Drawing images, text, shapes, gradients
* Tile sheet batch rendering
* Flash-like display list, display objects, containers
* User input events and other events handling and propagation
* 3D graphics support
Current status
--------------
* Alpha version
* No Python 3.x support
* No sound playing
Install binary package
----------------------
In Mac or Linux, try:
::
easy_install flappy
For windows, download the installer (one of Flappy-xxx.win32.exe files) here_
.. _here: http://pypi.python.org/pypi/Flappy#downloads
Build from source
-----------------
To build Flappy, Cython_ 0.19.1 or above is required.
.. _Cython: http://cython.org/#download
Also the following libraries needed:
* SDL2
* freetype 2
* libpng 1.6
* libjpeg 6b
You can either install development versions of these libraries to your system (or already have them installed), and build and install Flappy like this:
::
python setup.py install
Or you can clone this repository_ to the same directory as Flappy's source directory and build and install with this command:
::
python setup.py build_extensions_with_waf --use-prebuilt-libs install
.. _repository: https://github.com/pyronimous/flappy_prebuilt_dependencies
Quick example
-------------
This code draws a black-outlined orange circle inside a window sized 400x400 pixels. Each time you click on that circle you'll see the string "YAY!" in console output:
::
import flappy
from flappy.display import Sprite
from flappy.events import MouseEvent
class Example(Sprite):
def __init__(self):
super(Example, self).__init__()
circle = Sprite()
circle.graphics.lineStyle(4)
circle.graphics.beginFill(0xff8000)
circle.graphics.drawCircle(200, 200, 100)
circle.graphics.endFill()
self.addChild(circle)
circle.addEventListener(MouseEvent.CLICK, self.on_circle_click)
def on_circle_click(self, event):
print 'YAY!'
if __name__ == '__main__':
flappy.start(Example, width=400, height=400, title='Example')
.. image:: http://i.imgur.com/wqtfqz2.png
For the comparison, here is the code_ in ActionScript 3 which does the same.
.. _code: https://gist.github.com/pyronimous/9588523
Help
----
For now, documentation is a stub. But you can take a look at ActionScript3 API reference_ for Flash. Classes and method in packages flappy.display, flappy.events, flappy.geom, flappy.text are very similar to the classes and methods in Flash's corresponding packages.
.. _reference: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/
Also, see samples:
.. image:: http://i.imgur.com/VVUFH8f.png
======
Flappy (the name stands for FLash-like APi for PYthon) is a cross platform multimedia library with the API very similar to the ActionScript 3 Flash API. Flappy is built on top of the SDL2_ library and a slightly modified subset of c/c++ code from the OpenFL-Lime_ project.
.. _SDL2: http://libsdl.org
.. _OpenFL-Lime: https://github.com/openfl/lime
Features
--------
* Runs on Windows, Linux, Mac OS X
* GPU accelerated
* Drawing images, text, shapes, gradients
* Tile sheet batch rendering
* Flash-like display list, display objects, containers
* User input events and other events handling and propagation
* 3D graphics support
Current status
--------------
* Alpha version
* No Python 3.x support
* No sound playing
Install binary package
----------------------
In Mac or Linux, try:
::
easy_install flappy
For windows, download the installer (one of Flappy-xxx.win32.exe files) here_
.. _here: http://pypi.python.org/pypi/Flappy#downloads
Build from source
-----------------
To build Flappy, Cython_ 0.19.1 or above is required.
.. _Cython: http://cython.org/#download
Also the following libraries needed:
* SDL2
* freetype 2
* libpng 1.6
* libjpeg 6b
You can either install development versions of these libraries to your system (or already have them installed), and build and install Flappy like this:
::
python setup.py install
Or you can clone this repository_ to the same directory as Flappy's source directory and build and install with this command:
::
python setup.py build_extensions_with_waf --use-prebuilt-libs install
.. _repository: https://github.com/pyronimous/flappy_prebuilt_dependencies
Quick example
-------------
This code draws a black-outlined orange circle inside a window sized 400x400 pixels. Each time you click on that circle you'll see the string "YAY!" in console output:
::
import flappy
from flappy.display import Sprite
from flappy.events import MouseEvent
class Example(Sprite):
def __init__(self):
super(Example, self).__init__()
circle = Sprite()
circle.graphics.lineStyle(4)
circle.graphics.beginFill(0xff8000)
circle.graphics.drawCircle(200, 200, 100)
circle.graphics.endFill()
self.addChild(circle)
circle.addEventListener(MouseEvent.CLICK, self.on_circle_click)
def on_circle_click(self, event):
print 'YAY!'
if __name__ == '__main__':
flappy.start(Example, width=400, height=400, title='Example')
.. image:: http://i.imgur.com/wqtfqz2.png
For the comparison, here is the code_ in ActionScript 3 which does the same.
.. _code: https://gist.github.com/pyronimous/9588523
Help
----
For now, documentation is a stub. But you can take a look at ActionScript3 API reference_ for Flash. Classes and method in packages flappy.display, flappy.events, flappy.geom, flappy.text are very similar to the classes and methods in Flash's corresponding packages.
.. _reference: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/
Also, see samples:
.. image:: http://i.imgur.com/VVUFH8f.png
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
Flappy-0.3.7.tar.gz
(2.2 MB
view details)
Built Distributions
Flappy-0.3.7.win32.exe
(1.3 MB
view details)
File details
Details for the file Flappy-0.3.7.tar.gz
.
File metadata
- Download URL: Flappy-0.3.7.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 150792f0fe35536073fbcf4d7fd492db2a5a384f6691763e6eee7843d71947ca |
|
MD5 | 25a49450b05dd7ba61a6df72f61e4332 |
|
BLAKE2b-256 | 2018a0bf00d52eb99a04c3ce58e8c64755c5d038472d895bceba4cb6435bab81 |
File details
Details for the file Flappy-0.3.7.win32.exe
.
File metadata
- Download URL: Flappy-0.3.7.win32.exe
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6a5b2aeee8e1eda49dec57da40e132525ea0a34ddafaeff452e4fc471f6c4c3 |
|
MD5 | ee5c1b3880ff58563b18ae81f2ebc91a |
|
BLAKE2b-256 | 49358d5e87eb23488edec3518c1886c9064292ae7f65c9dd4b296bf5f0aab8dc |
File details
Details for the file Flappy-0.3.7-py2.7-macosx-10.7-x86_64.egg
.
File metadata
- Download URL: Flappy-0.3.7-py2.7-macosx-10.7-x86_64.egg
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa81c542e9846782235096bfb5a14488b4d33cf70480b6510f0c7b8224b63d4b |
|
MD5 | 2a45db2346d26f08420cbe4b79ad37a0 |
|
BLAKE2b-256 | 15cf6659ee86bc98e37859c3e3a2004ef70206cad1e33defcacafb5a83185727 |
File details
Details for the file Flappy-0.3.7-py2.7-linux-x86_64.egg
.
File metadata
- Download URL: Flappy-0.3.7-py2.7-linux-x86_64.egg
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e46896264c7ed4252ec8053497cc883f767eb169ad2eacf508b22b445c91957 |
|
MD5 | 24f00256e686eea8c480f33bcb54b1e1 |
|
BLAKE2b-256 | 82d952e8410ecc947bf1ef4700a0f7bee61e844b3698de9face4f9534056210c |