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

Pages: [1]
1
Window / Re: axis and buttons
« on: January 20, 2016, 06:43:03 pm »
oh my... it was so easy, and I didn't figure it out :(
shame on my head

thx, by the way

2
Window / Re: axis and buttons
« on: January 20, 2016, 03:40:33 pm »
this for some reason, may be it will be usefull
sf::RenderWindow mainWin(sf::VideoMode(800, 600), "JoySlime");
mainWin.setKeyRepeatEnabled(false);
mainWin.setFramerateLimit(240);
mainWin.setMouseCursorVisible(false);
mainWin.setJoystickThreshold(5);
sf::Event mwEvent;
 

and this is actually part with issue, it is wrapped in WHILE (mainWin.isOpen()), don't think this should be here
//main menu
//event handler
while (mainWin.pollEvent(mwEvent)) {
        //close window
        if (mwEvent.type == sf::Event::Closed) {
                GameState.isInMenu = false;
                mainWin.close();
        }
        //start new game while player press A (button 0) or SPACEBAR
        if (mwEvent.joystickButton.button == 0 || mwEvent.key.code == sf::Keyboard::Space) {
                GameState.isInMenu = false;
                GameState.isInGame = true;
                th_input.launch();                        //thread that handle input while in game
                mClock.restart();
        }
}
 

as I sad, all this works almost write, but this axis issue...
also noticed that while cursor is over window, event.joystickbutton returns mouse coords... is it intended, or I do something wrong?

3
Window / [solved] axis and buttons
« on: January 20, 2016, 09:36:22 am »
Hi all, I'm new here, and I need your help (pls).

Yes, I tried to search, but found nothing usefull (but mb I just did it wrong).

OK, the problem is with sf::Joystick axis and buttons. For now I work at simple arcade project, where core functionality is about using controller. Without it game will be awefull. So this problem is critical.

So, when I try to cath pressed button on joystick with event, it works as intended, buttons return and all works. BUT (here is problem) when I move sticks, event also returns pressed buttons, and they are absolutely same, as normal buttons.

Shortly, I get same event.JoystickButton.button from button itself and from axis, and this issue prevent any kind of normal controls.

P.S. using standart x360 wired controller, win10 x64
P.S.2 sent it to friend, asking to test buttons, waitng for results

upd: check event type before grabbing any values from it

Pages: [1]
anything