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

Recent Posts

Pages: [1] 2 3 ... 10
1
SFML projects / Re: Tail Smash! - Arcade driving game
« Last post by TobBot2 on May 28, 2024, 10:51:17 pm »
Hey! I wrote up a project report for the game cuz I thought it'd be fun and also be a great way to remind myself of my mistakes/what I would do differently. Finishing a game completely showed me a lot about aspects I never dived into (i.e. menus, levels, sound, shaders). So if you're curious on some high-level issues I ran into and what to avoid, for sure check out whichever section of the report interests you. It's organized pretty well, so it should be quick to read the information you're interested in.

Report is on a shared onedrive link cuz the file is ~1.3 MB (bigger than the attachment size for this forum).
https://1drv.ms/b/s!Akl3r7IgGzmfgbs4TvCixLDftutxsg?e=7lEqho
2
General / Re: Keyboard big issue
« Last post by Rhubarb on May 28, 2024, 10:24:16 pm »
I did this, and no letters are detected.
if(event.type == (sf::Event::KeyPressed)){
    std::cout << rand()%255 << std::endl;
};
 
Only functions keys, top keyboard numbers and some keys like "inser" "end" "page up" "page down" etc
The problem is also maybe because I have an french Azerty keyboard.
3
nevermind it fully works now apparently I needed to restart the computer and that's all
4
General / Re: Keyboard big issue
« Last post by eXpl0it3r on May 28, 2024, 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.
5
General / Re: Keyboard big issue
« Last post by Rhubarb on May 28, 2024, 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
6
General / Re: Keyboard big issue
« Last post by eXpl0it3r on May 28, 2024, 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?
7
General / Re: Keyboard big issue
« Last post by Rhubarb on May 28, 2024, 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
8
General / Re: Keyboard big issue
« Last post by eXpl0it3r on May 28, 2024, 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?
9
General / Re: Keyboard big issue
« Last post by Rhubarb on May 28, 2024, 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.
10
General / Re: Keyboard big issue
« Last post by eXpl0it3r on May 28, 2024, 03:16:25 pm »
Can you share some minimal and compiable code that reproduces the issue?
Pages: [1] 2 3 ... 10
anything