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.


Topics - Unarelith

Pages: [1]
1
Network / sf::Packet is probably not endianness-safe
« on: July 06, 2020, 11:25:37 pm »
Since there is no code handling it for floats and doubles, I think sf::Packet is not completely endianness-safe.
Also it doesn't seem to support non-IEC-559 floats and doubles, but it's even rarer.

Is it worth opening an issue?
I don't have a big-endian machine to test this on, unfortunately.

I think either the code or the doc needs to be changed accordingly if this is confirmed.
Either the doc by saying it's not safe for floats and doubles, or the code by actually handling it (but it might be hard to test considering big-endian machines are rare nowadays).

2
Feature requests / Raw mouse input/mouse delta
« on: May 12, 2020, 02:55:46 am »
Hello,

The search feature of this forum is currently broken on my end so I don't know if anybody already posted this request.

An user already created a PR for that feature, that works on both Windows and Linux: https://github.com/SFML/SFML/pull/1383

This post is here to request that feature on other OS, in order to make it available for a future SFML version.

This feature is mandatory to have a viable mouse-controlled FPS camera.
There is hacky ways to implement something like this without it, but they're far from perfect and have many flaws.

What do you think about this?

3
Feature requests / Ability to toggle fullscreen mode during runtime
« on: May 12, 2020, 02:49:06 am »
Hello,

The search feature of this forum is currently broken on my end so I don't know if anybody already posted this request.

However, I found those issues:

When using SFML for an OpenGL program (so, without using sf::RenderWindow) the only way to switch to fullscreen mode is to recreate the window.

This may not be a problem when using sf::RenderWindow because this class probably saves the OpenGL state and is able to restore it when the window is recreated.

However, when using sf::Window, users will have to save the paramters sent to sf::Window::create() + the current OpenGL state (calls to glEnable/glDisable/glClearColor and probably other things).

This is a real problem because it causes obscure bugs, and imo it shouldn't be up to the users to deal with that.

What is your opinion on that matter?

EDIT: Minimal example for glClearColor:

#include <SFML/OpenGL.hpp>
#include <SFML/Window.hpp>

int main(int, char **) {
        sf::ContextSettings settings;
        settings.depthBits = 24;
        settings.stencilBits = 8;
        settings.antialiasingLevel = 0;
        settings.majorVersion = 2;
        settings.minorVersion = 1;

        sf::Window window;
        window.create(sf::VideoMode(800, 600), "OpenGL", sf::Style::Close, settings);
        auto desktop = sf::VideoMode::getDesktopMode();
        window.setPosition(sf::Vector2i(
                desktop.width / 2 - window.getSize().x / 2,
                desktop.height / 2 - window.getSize().y / 2
        ));

        glClearColor(0.0f, 1.0f, 1.0f, 1.0f);

        bool running = true;
        bool fullscreen = false;
        while (running) {
                sf::Event event;
                while (window.pollEvent(event)) {
                        if (event.type == sf::Event::Closed || (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)) {
                                running = false;
                        }
                        else if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::A) {
                                window.create(sf::VideoMode(800, 600), "OpenGL", sf::Style::Close, settings);
                        }
                        else if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Z) {
                                window.create(sf::VideoMode(800, 600), "OpenGL", sf::Style::Close, settings);

                                auto desktop = sf::VideoMode::getDesktopMode();
                                window.setPosition(sf::Vector2i(
                                        desktop.width / 2 - window.getSize().x / 2,
                                        desktop.height / 2 - window.getSize().y / 2
                                ));

                                glClearColor(0.0f, 1.0f, 1.0f, 1.0f);
                        }
                }

                glClear(GL_COLOR_BUFFER_BIT);

                window.display();
        }

        window.close();

        return 0;
}

When you press 'A', the window is recreated but nothing is setup, so it resets to its original position and the clear color goes back to black.
When you press 'Z', the window is recreated but both the position and the clear color are setup again so it's fine.

However, I don't think the user should have to store and re-setup all those things (position, video mode, caption, style, context settings, glEnable/Disable/ClearColor, etc...).

Pages: [1]
anything