PySFML: Difference between revisions

From Chaosdorf Wiki
Jump to navigation Jump to search
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
== PySFML==
== PySFML==
Simple and Fast Multimedia Libraray and Python.


== Info ==
<b>HINWEIS:</b> python3-sfml ist erst seit jessie in Debian (Stand: 2015-06)
 
Simple and Fast Multimedia Libraray and Python.


== Installation ==
== Installation ==

Latest revision as of 18:00, 25 June 2015

PySFML[edit | edit source]

Simple and Fast Multimedia Libraray and Python.

HINWEIS: python3-sfml ist erst seit jessie in Debian (Stand: 2015-06)

Installation[edit | edit source]

Howto install on

Debian/Ubuntu[edit | edit source]

Eine Shell öffnen und mit root-rechten ausführen:

apt-get install python-sfml

oder

sudo apt-get install python-sfml

Benutzung[edit | edit source]

Der Standard Import lautet:

import PySFML

Notizen/Tasks für Pythonfoo[edit | edit source]

  • The Copyconstructor ???? siehe Displaying a Sprite
  • Sprite.SetScale(2.f, 0.5f)
  • Image.GetPixel(10,20)
  • Pixelfarbe feststellen ??? mGUI->getColorAtPixel(x,y).red; ???

Speicherplatz sparen/ Resourcenoptimierung[edit | edit source]

In a more complex engine, images would be automatically handled by a manager. This is a more generic and easy way of handling resources. The idea is to make the manager store the images, associated to their filename (or whatever unique identifier), so that if the same image is requested several times, the same instance will actually always be returned by the manager.

sf::Sprite Sprite;
// GetImage will always return the same image for the same filename
Sprite.SetImage(ImageManager.GetImage("data/missile.png"));


Links[edit | edit source]

Displaying a Sprite