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 - bastien

Pages: 1 ... 11 12 [13]
181
SFML projects / Cool Runnings...
« on: November 03, 2010, 07:49:42 am »
Apparently there's only a Windows release and no source code, so I can't try it.

182
Window / Gracefully degrade resolution
« on: November 01, 2010, 11:02:56 pm »
In my opinion you should let the user choose the resolution, and use the best available by default. Isn't that possible in your game?

184
SFML website / Login bug?
« on: October 31, 2010, 10:47:48 pm »
Does anybody else have this problem?

185
System / Best way to setup GUI/TCP?
« on: October 31, 2010, 09:29:36 pm »
If you use TCP, by default the API calls probably block when you're not receiving anything, which means that if the server doesn't send anything for one second, the game will be stuck one second.

You can use something like timeouts, select() (I would recommend this) or threads (only if really needed) to avoid that.

186
Python / Image.Smooth() broken?
« on: October 31, 2010, 01:33:12 am »
Quote from: "Svenstaro"
PySFML needs a lot of work to make it maintainable again. It should be redone using SWIG instead of direct Python ctypes.


I thought PySFML was written by hand with the C extension API?

Quote from: "Svenstaro"
This revisit is planned for SFML 2 and at least I am not going to rebuild SFML 1 from svn to fix this bug.


If I understand correctly you don't have to rebuild SFML, I just downloaded the python directory from the trunk and built the extension module.
Making this module available instead of the broken one would allow people to use SetSmooth().
If for some reason that's not possible in my opinion we should tell people that the current version is broken and they may need to build it from SVN.

Quote from: "Svenstaro"
You should consider helping out with SWIG if you want a working PySFML 2.


Does SWIG automatically converts C++ names to Python names, creates properties instead of Get/Set and stuff like that?
Personally I was considering using Cython for creating a more pythonic binding, but I haven't tried it yet.

187
SFML website / Login bug?
« on: October 30, 2010, 09:05:57 pm »
Personally when I visit the forum it always shows me I'm not logged in. Then I click on “Profile” and it logs me in magically.

I also sometimes mail error pages when posting,by the way. I also had it when registering (didn't get any confirmation email).

188
Python / Image.Smooth() broken?
« on: October 29, 2010, 11:23:26 pm »
OK, it works with trunk. Why not make a new PySFML release with the fix? It's not very user-friendly to have to install from SVN for such an important and old bugs.

189
Python / Image.Smooth() broken?
« on: October 29, 2010, 09:19:28 pm »
Image.SetSmooth() doesn't seem to do anything in my programs (it doesn't crash though). I'm using PySFML 1.6 from the Arch Linux packages.

In February Tank talked about this bug here:

Quote from: "Tank"
Also sf::Image::SetSmooth() and sf::Image::Copy() are not working. This will be fixed with the next revision.


I had a quick look at SFML's code on SourceForge, and there's indeed a revision saying that SetSmooth() has been fixed.

Can anyone test SetSmooth() with 1.6 and tell me if it works? In that case I'll try to see if something is wrong with the Arch Linux package.

190
Graphics / Artifacts in isometric view
« on: October 29, 2010, 08:11:49 pm »
Thanks, it works perfectly. But for some reason it doesn't work in Python. :| Apparently it's a bug in the binding.

191
Graphics / Artifacts in isometric view
« on: October 29, 2010, 11:02:16 am »
I'm writing an isometric tile engine, and I can't seem to correctly piece the tiles together. There is always some kind of shadow. In the end it makes the map look like there's a grid, which isn't that bad, but I'd like to show a plain grass map. How can I achieve that?

Note: I have the same problem on two different computers, on both Windows and GNU/Linux.

Here is a simple example, with 64x30 tiles:



Code: [Select]
#include <iostream>
#include <vector>

#include <SFML/Graphics.hpp>


int main()
{
    sf::RenderWindow app(sf::VideoMode(640, 480, 32), "Tile test");
    app.SetFramerateLimit(10);
    sf::Image image;
    bool running = image.LoadFromFile("grass.png");
    std::vector<sf::Sprite> sprites;

    sf::Sprite s1(image);
    s1.SetPosition(0, 0);
    sprites.push_back(s1);
    sf::Sprite s2(image);
    s2.SetPosition(64, 0);
    sprites.push_back(s2);
    sf::Sprite s3(image);
    s3.SetPosition(32, 15);
    sprites.push_back(s3);
   
    while (running)
    {
        sf::Event event;

        while (app.GetEvent(event))
        {
            switch (event.Type)
            {
            case sf::Event::Closed:
                running = false;
                break;
            default:
                break;
            }
        }

        app.Clear(sf::Color(255, 255, 255));

        for (std::vector<sf::Sprite>::const_iterator it = sprites.begin();
             it != sprites.end();
             ++it)
        {
            app.Draw(*it);
        }

        std::cout << 1.0 / app.GetFrameTime() << " FPS\n";
        app.Display();
    }

    app.Close();

    return EXIT_SUCCESS;
}


Here is the tile:


192
Python / Re: Threading PySFML (Tank, remi, anyone familiar with GIL ?
« on: October 29, 2010, 05:28:26 am »
I guess that in a real life example one would use proper synchronization primitives and this would remove the need for that sleep.
Normally the interpreter releases the lock regularly so that another thread has the chance to run. I don't know if the fact that his thread sucked all CPU time comes from bad luck, poor GIL behavior or from a bug in PySFML.

Quote from: "Kaoron"
I made a test wrapping the Display call between python ALLOW_THREADS macros, but I don't have a very deep understanding on how the GIL works, and how extension modules can be safely threaded.


You mean thread-safe? To me it doesn't look like PySFML should bother with this. In my opinion the user should consider whether he really needs parallelism, and release the lock himself as needed during computations, after profiling his app.

But I may wrong, since I've never used the GIL. For example, what happens if a user thread starts drawing while you released the lock and are executing self->obj->Display()?

193
Python / [Linux] Installation troubleshooting about libsfml-graphics
« on: October 29, 2010, 04:44:02 am »
Also make sure that your distribution doesn't provide an easy way to install PySFML before building it manually. For example on Arch Linux it's available as a package.

194
Python / Respecting naming conventions & other possible changes
« on: October 29, 2010, 04:36:36 am »
For creating images and such, I would suggest two approaches:

Use a single constructor with optional parameters:

Code: [Select]
def __init__(self, path=None, buf=None):
    if path is None and buf is None:
        raise SomeException

    if path is not None:
        # ...

    if buf is not None:
        # ...


Use it like this:

Code: [Select]
Image(path='/some/path')
Image(buf=[])
Image()  # Raises an exception


In my opinion the problem with this approach is that the constructor does two very different things, and I'm a big fan of the “do one thing and do it well” approach. Also, you need to use keyword parameters in order to be explicit.

The second is to use class/static methods:

Code: [Select]
class Image(object):
    def __init__(self):
        # don't do anything, or raise NotImplementedError to make it somewhat private

    @staticmethod
    def load_from_file(self, path):
        # ...

    @staticmethod
    def load_from_memory(self, buf):
        # ...


I would use the second approach because it's more explicit, and there's a method for each concern.

If you're looking for ideas you should look at Pygame (http://www.pygame.org/docs/), it's a nice Python wrapper around SDL. It provides a lot of features that piichan talked about.

Pages: 1 ... 11 12 [13]