Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Sonkun

Pages: 1 ... 9 10 [11] 12
151
General / Re: SFML 2.0 from apt-get
« on: October 18, 2012, 01:53:04 pm »
I packaged the RC in a private repository. If you want, you can add it:

Quote
sudo add-apt-repository ppa:sonkun/sfml
sudo apt-get update
sudo apt-get install libsfml2-dev

It also provides examples via the package "sfml2-examples". Once the package installed, you can launch the examples via command lines:

Quote
sudo apt-get install sfml2-examples
sfml2-pong
sfml2-shaders

The shader example is useful to see whether SFML runs well or not on your OS :)

For more details: http://openhelbreath.net/python-sfml2/installation.html#ubuntu

152
General discussions / Re: python-sfml2: version 1.1
« on: June 25, 2012, 04:48:15 am »
Someone made a pull request on Github, except him, has anyone tried the binding ? Feedbacks are appreciated :)

153
General discussions / Re: Another python binding: python-sfml2
« on: June 25, 2012, 04:45:54 am »
Quote
What's the point of implementing something and then discouraging its use? Confusing people? :P

Maybe should I have said "preferred" instead" of "discouraged". I find more confusing not to have the sfml network module implemented than having it.

It allows you to port C++ projects more easily. With minor syntactic changes (all of which are documented), you can port your code without having to trod through the standard library's documentation. Later, you can replace bits and pieces you like with the standard Python's built-in equivalents.

Quote
I think it's important to stick to the native classes and functions, so that SFML code can interact nicely with the rest of the code, and not require type conversions and duplicated functions everywhere. A binding must look natural, as if it was directly developed in the target language.

That's exactly what my binding offer compared to the official's one, a more natural look and on many points:

1) Types
In Python, numeric types (integer, float, complex, long) are inferred. Users shouldn't care about the Vector's type or Rect's type.

In my binding, instead of writing:
sf.Vector2f()
sf.Vector2i()
sf.IntRect()
sf.FloatRect()

You write:
sf.Vector2()
sf.Rectangle()

2) Copy
In the official binding, there are plenty of copy() methods to make copies but in Python copies are done via the copy module.

In my binding instead of writing:
image = sf.Image.load_from_file("myimage.png")
image2 = image.copy()

You write:
from copy import copy, deepcopy

image = sf.Image.from_file("myimage.png")
image2 = copy(image)

3) C++ multiple definitions are not emulated

In Python, there are no multiple definitions. Instead of emulating this C++ feature and make Python functions take any argument then check whether they match a C++ function definition, I split functions.

For example, instead of writing this:
texture.update(window)
texture.update(image)

You write:
texture.update_from_window(window)
texture.update_from_image(image)

Another typical example is with multiple constructors. Here are the C++ Shader constructors.

bool loadFromFile (const std::string &filename, Type type
bool loadFromFile (const std::string &vertexShaderFilename, const std::string &fragmentShaderFilename)

Instead of writing this:
shader = sf.Shader.load_from_file("vertex.vert", "fragment.frag")
vertex = sf.Shader.load_from_file("vertex.vert", sf.Shader.VERTEX)
fragment = sf.Shader.load_from_file("fragment.frag", sf.Shader.FRAGMENT)

In my binding, you write:
shader = sf.Shader.from_file("vertex.vert", "fragment.frag")
vertex = sf.Shader.from_file(vertex="vertex.vert")
fragment = sf.Shader.from_file(fragment="fragment.frag")

4) Methods/function's name more pythonic.
The standard Python library traditionally uses from_foo() and to_bar() to respectively load/open and save objects. The binding does that as well.

music = sf.Music.from_file() # pythonic
music = sf.Music.open_from_file() # less pythonic

5) All of SFML's native classes are found.

You don't find Window, VertexArray and probably others in Bastien's binding.

154
General discussions / Re: python-sfml2: version 1.1
« on: June 14, 2012, 11:07:26 pm »
I had forgotten to upload the documentation, it's done now :p

155
General discussions / Re: python-sfml2: version 1.1
« on: June 14, 2012, 11:01:36 pm »
I haven't made the Windows installers for 64bits machine yet, I'll provide them tomorrow. Also packages for Debian/Ubuntu are being built, so installing from depot would install the version 1.0 (and not 1.1), it should be done in five hours.

156
General discussions / Re: Another python binding: python-sfml2
« on: June 14, 2012, 10:49:11 pm »
Quote
If something's implemented and widely used in the standard library of the language, there's no reason to provide a binding for it. Is there a chance that SFML's binding is better than the language standard library?
By the way, many things of the new C++ standard already makes some SFML classes deprecated (thread and time, for example).
True, but it can be implemented to provide an exhaustive binding and its use discouraged at the same time :) It's not my major argument, even if I use this module in my projects.

Quote
I think that other  people want to highlight the fact that it's such a waste to put so much effort on two similar libraries. Can't they be somehow merged? What are the main differences that makes them incompatible?
They can't be merged since the code is totally different. Although it has used the official binding as starting point, all the code has been rewritten and re-thought following different implementation/technical choices. The binding is separated in fives modules: system, window, graphics, audio and network. The vector mechanism is not the same and involves modification everywhere (SFML uses massively vectors). The way I handle events works very differently. All classes are provided, for example you don't find Window in the official binding.

Quote
Okay. It's very nice to share your hard work, however a long-term user wants to know if the binding remains your personal project fitted for your needs or if you support it actively. You should probably clarify your strategy to avoid frustrated users ;)
You are right. I'll be clearer for the next release. It is of course, long-term support.


Quote
Quote
The standard library has also a time module that provides everything for handling time, is it a reason not to implement sf::Time, sf::sleep, sf::seconds, etc ?
If you mean <ctime>, it doesn't provide high resolution clocks, which is the application field of sf::Clock.
I was talking about the python standard library :D The module time has everything for manipulating time. If I follow the same logic, we shouldn't implement sf.Time, sf.sleep, etc.

157
General discussions / python-sfml2: version 1.1
« on: June 14, 2012, 10:28:56 pm »
The last release, which I announced two weeks ago was a fast release; a snapshot taken on the way to the release candidate build. I had focused on the most important parts of the API (classes/functions most used) to make it the most usable. I’m now pleased to announce that the update is over and that the binding is complete, clean and stable.

When saying complete I am referring to a binding containing all classes and functions available in SFML separated in five different modules: system, window, graphics, audio and network. The network module is provided in order to be exhaustive but its use is discouraged since the standard python library already provides one. Documentation, tutorials and the official examples are included to help you with using it. For example; it explains you how to integrate pySFML2 to PyQt4.

By saying clean, I mean a binding where error messages are handled properly and where you don’t have to use byte strings for everything when you use Python 3.  The source code is also clean so people who’d like to get involved or want to modify it will find code following conventions, using the right Cython syntax and split into different files.

By saying stable, I mean a binding where automatic tests have been performed, hopefully preventing myself from introducing new error later on with changes. Of course I can’t pretend there’s no bugs since it’s the first release and I hope to receive as much feedbacks as possible to fix the remaining issues.

I consider this binding more pythonic as it doesn’t try to emulate multiple definition function such as in C++ that Python doesn’t support, and you won’t have to deal directly with types, which give more flexibility to the binding.

This version includes two more examples: pong.py and shader.py.

Installers for Windows and packages for Ubuntu are provided for ease of installation.

To give you an overview, here are four pieces of code that summarize interesting features that you don't find in the official binding.

Import module independently.
from sfml.window import sf # need only the window module ?
from sfml.audio import sf # need only the audio module ?
 

More flexibility when using vectors.
vector = sf.Vector2()
vector.x = 23 # set an integer
vector.y = 6.42 # set a float
vector.z = Decimal(0.12346578) # set a decimal for advantages over the float datatype
 

The way you handle events in pySFML2 may surprise you :)
for event in window.events:
    if type(event) is sf.CloseEvent:
        window.close()

    if type(event) is sf.KeyEvent and event.pressed:
        character.fire()

    if type(event) is sf.FocusEvent:
        if event.lost: music.stop()
        elif event.gained: music.play()
 

sf.Image has an extra method that allows you to view the current image state. Useful for debugging.
image.load_from_file("myimage.png")
image.create_mask_from_color(sf.Color.YELLOW)
image.show() # launch a viewer with the current image state
 

I’m linking you to the on-line documentation for installation and explanations.

Website: http://openhelbreath.net/python-sfml2/
Documentation: http://openhelbreath.net/python-sfml2/documentation.html
Bugtracker: http://openhelbreath.net/python-sfml2/flyspray/
Github: https://github.com/Sonkun/python-sfml2

The next release should add the last missing official examples (voip.py, x11.py, cocoa.py and win32.py), fix a lot of issues (if any) and provide installers for Mac OSX and packages for Fedora.

I hope there aren’t any major bugs that will prevent you from using the binding.

158
C / Re: cmake SFML_DIR-NOTFOUND?
« on: June 10, 2012, 11:02:18 am »
I tried twice and put the right path in CMAKE_MODULE_PATH or SFML_DIR variable does not work. Only copying the file in the standard location for FindXxx.cmake files works.

By default, SFML installs FindSFML.cmake in <install-dir>/share/SFML/cmake/Modules/, why ?

159
C / Re: cmake SFML_DIR-NOTFOUND?
« on: June 04, 2012, 10:29:03 pm »
I had the same problem.

SFML installs this file by default in /usr/shared/SFML, is it its right location ?

160
General discussions / Re: Another python binding: python-sfml2
« on: June 04, 2012, 09:34:35 pm »
Quote
Regarding the network module, Python already provides sockets and ftp library (but I bet you already know this).

Yes, Python standard library already provides network stuff for socket, ftp, etc... and ? It offers built-in classes, written in C with its own interface while SFML has its own implementation with its own interface, why shouldn't we provide it ? The standard library has also a time module that provides everything for handling time, is it a reason not to implement sf::Time, sf::sleep, sf::seconds, etc ?

Quote
While I salute the initiative of enhancing the binding, I think a lot of users will be confused if two python bindings are proposed, especially since the both of them are up-to-date and look-alike.
I don't want people to be confused and I'll do my job to avoid this and highlight the difference. However, they may look-alike but acutally they are not.

Quote
Even more crucial, only bastien's pysfml2 is official, so you need good arguments to convince people of using your binding instead ("I don't like the API" without being concrete is none).
I don't need any arguments to convince people of using my binding. I'm just sharing a work that I use for personal projects. Take it or leave it.

Quote
And don't forget, the Python subforum has been created for pysfml2 support ;)
I don't think so, the Python subforum was created before pysfml-cython becomes the official binding. And if Laurent minds, he's old enough to tell himself.

161
Python / python-sfml
« on: June 01, 2012, 12:10:10 am »
Hello, I'm opening this topic to talk about the project. If you have any questions or want to report issues, you can do it here. :)

162
General discussions / Re: Another python binding: python-sfml2
« on: June 01, 2012, 12:06:07 am »
Hello, as promised the next release is out. I created a new topic: http://en.sfml-dev.org/forums/index.php?topic=8115.0

Hey, Bastien is still working on his bindings.
http://en.sfml-dev.org/forums/index.php?topic=5311.105
I know he is still working on his binding but I primarily maintain my own one because I don't want the same interface and I work on other projects that use the binding and need features that Bastien's binding doesn't provide and won't provide (the network module for example).

163
General discussions / python-sfml2 version 1.0 is available.
« on: May 31, 2012, 11:48:41 pm »
A MORE RECENT VERSION IS AVAILABLE! HERE


Three weeks ago I opened a topic to announce my project; a python binding for SFML2. At the time, it was the result of my work last winter but in the meantime I had to go abroad leaving the project in its current state without releasing it.  It was out-of-date with the then current sfml2 development version but I wanted to release it before carrying on and updating it to the release candidate. Three weeks later here we are; the project is updated to the release candidate as promised.

Although I spent the last 3 weeks on working on the update there are quite a lot of thing I didn't have time to implement. I focused on the functionality part: the most important classes have been implemented.  Tests to check whether they do run well on all platform have been performed.

I consider this version  a fast release which comes with bugs and non implemented functionality, yet comes with almost complete documentation.

This time the binding comes with installers for Windows (something I didn't have time to make last time) and, like always, a Ubuntu/Debian depot for ease of installation. This depot provides many packages: sfml2-rc, the
binding and the examples for the binding.

I'm linking to the on-line documentation where you will find explanations about installation, the documentation and various script examples as well as explanation about the project, etc.

Website: http://openhelbreath.net/python-sfml2/
Bug-tracker: http://openhelbreath.net/python-sfml2/flyspray

The bug-tracker is temporarily read-only.  If you find bugs then please report them on the forum or via the issues tab on the github page, I'll add them.

Download and installation
Windows:

Download the correct installer and follow the instructions (you don't need to have SFML2 installed).

pySFML2-1.0.0.win32-py2.7.exe [1.6 MB] [Python 2.7] [32 bit]
pySFML2-1.0.0.win32-py3.2.exe [1.6 MB] [Python 3.2] [32 bit]

Installer for 64bits platform are not available yet, if someone need them, just tell me and I'll speed up.

Ubuntu:
The depot can be added by typing:
Code: [Select]
sudo add-apt-repository ppa:sonkun/sfml
sudo apt-get update

The packages provided are:
  • libsfml2
  • libsfml2-dev
  • libsfml2-dbg
  • libsfml2-doc
  • sfml2-examples
  • python-sfml2
  • python3-sfml2
  • python-sfml2-doc
  • pysfml2-examples

Note that the examples package installs scripts that allow you to launch the examples with a simple command line.

Code: [Select]
sfml2-sound # run example 'sound'
sfml2-shader
sfml2-x11
sfml2-voip

pysfml2-sound         #run the same example but actually it's a script that uses the binding
pysfml2-sockets
pysfml2-spacial-music # not an official example
pysfml2-pyqt4         # not an official example

164
General discussions / Re: Another python binding: python-sfml2
« on: May 26, 2012, 06:16:22 pm »
The next version (compatible with the release candidate) will be available this Monday night.

The bug-tracker has been disabled temporarily.

165
General discussions / Re: SFML 2.0 RC
« on: May 18, 2012, 05:30:23 pm »
Quote
If this was explained, I wouldn't be here for asking
It's in the "Handling events" tutorial.
It was implicitly said :) Maybe a line like "The other three events (Closed, LostFocus and GainedFocus) have, of course, no specific parameters" would have removed my doubt.

By the way, maybe there's a small error in the documentation, shouldn't sf::Text::getStyle() and sf::Text::setStyle() returns/takes a sf::Text::Style instead of Uint32 ? I'm saying that based of sf::Sotcket::bind() which returns a sf::Socket::Status, they are both an enumeration. It's been a long I haven't practiced my C++ so I may be wrong...

Pages: 1 ... 9 10 [11] 12