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

Recent Posts

Pages: [1] 2 3 ... 10
1
nevermind it fully works now apparently I needed to restart the computer and that's all
2
General / Re: Keyboard big issue
« Last post by eXpl0it3r on Today at 04:55:17 pm »
Set a break point inside the key pressed event body, run the application through a debugger and check what the value of the key code is.

I have a feeling that you either have a different layout configured that you're expecting, so hitting the specific key doesn't actually trigger something. Or you have something installed on Debian that remaps keyboard values.

It's unlikely an SFML issue, since we've been using basically the same code for a long time now.
3
General / Re: Keyboard big issue
« Last post by Rhubarb on Today at 04:35:34 pm »
I installed SFML with apt-get so I have the 2.6 (I guess?) and I don't know why but the event.code you gave me doesn't work
4
General / Re: Keyboard big issue
« Last post by eXpl0it3r on Today at 04:29:00 pm »
Are you using a special keyboard layout?

So the following example application doesn't work?

#include <SFML/Graphics.hpp>

int main()
{
    auto window = sf::RenderWindow{ { 1920u, 1080u }, "Color Switcher" };
    window.setFramerateLimit(144);

    auto backgroundColor = sf::Color::Black;

    while (window.isOpen())
    {
        for (auto event = sf::Event{}; window.pollEvent(event);)
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
            else if (event.type == sf::Event::KeyPressed && event.code == sf::Keyboard::R)
            {
                backgroundColor = sf::Color::Red;
            }
            else if (event.type == sf::Event::KeyRelease && event.code == sf::Keyboard::G)
            {
                backgroundColor = sf::Color::Green;
            }
        }

        window.clear(backgroundColor);
        window.display();
    }
}

If you use SFML 2.6, can you try scancodes instead?
5
General / Re: Keyboard big issue
« Last post by Rhubarb on Today at 04:11:52 pm »
Yes, that's exactly that I tried O,P,C,A,V none worked, so I assume none letter is working.
And I just love semicolons lol
6
General / Re: Keyboard big issue
« Last post by eXpl0it3r on Today at 03:57:55 pm »
That's some interesting code formatting :D
(Btw. you don't need a semicolon after an if-body)

When you say for "letters" are you passing in as key for example sf::Keyboard::A?
7
General / Re: Keyboard big issue
« Last post by Rhubarb on Today at 03:30:40 pm »
Yes, I have a function thats takes input once, and not every frames here it is:
int isPressed(sf::Event event,sf::Keyboard::Key key){
    if(event.type == (sf::Event::KeyPressed)){
        if (event.key.code == key&&function_done==0){
            function_done=1;
            return 0;
        };};
        if(event.type == (sf::Event::KeyReleased)){
            if (event.key.code == key&&function_done==1)function_done=0;
    };
    return 1;
};

So it works with all keys I mentionned above but not with letters.
8
General / Re: Keyboard big issue
« Last post by eXpl0it3r on Today at 03:16:25 pm »
Can you share some minimal and compiable code that reproduces the issue?
9
General / Keyboard big issue
« Last post by Rhubarb on Today at 02:47:30 pm »
Hello, this is my first post here, so I don't know if it's the right place to ask, but I have an issue with SFML.
The "sf::Keyboard::" works, but only with the F1 to F12 and with Num1 to Num0, it doesn't works with the letters or anything else, I don't know why.

Thanks if you can help, you can answer in french.

edit:
I work with VSCode on Debian 12 and I build with g++
10
General / checking collisions with array of objects takes too much
« Last post by Ogn1k on Today at 09:28:52 am »
Hi everyone. I have this button script:
Button.cpp
(click to show/hide)
in short it just creates rectangleshape and text, chekcs its collision with mouse and returns it in "isPressed". My problem here is that when i try to create a vector with buttons it starts to freeze in some moments also taking up a lot of memory at these, i do it like this:
in game start function:
(click to show/hide)
in game update function:
(click to show/hide)
help me please to fix these freezes
Pages: [1] 2 3 ... 10