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

Pages: [1]
1
General / Can't get SFML 1.4 to work properly!
« on: May 13, 2009, 10:41:45 pm »
Having downloaded and compiled the new SVN version with newest MinGW again gives me the bug that used to be issued where the entire app freezes on launch, before even entering the main function. Seeing as there's been no change between r1089 and r1890 other than those two lines though, which are the exact same I added yesterday, and it didn't freeze when I ran it then, the issue might be something else. I'll keep investigating and report back if I find something.

EDIT: My mistake, it works fine now. I had the joystick threshold set to 0, so my event loop was endless. Thanks for the help.

2
General / Can't get SFML 1.4 to work properly!
« on: May 13, 2009, 04:14:07 am »
UPDATE: MSDN says this about the JOYINFOEX pointer:
Quote
Pointer to a JOYINFOEX structure that contains extended position information and button status of the joystick. You must set the dwSize and dwFlags members or joyGetPosEx will fail. The information returned from joyGetPosEx depends on the flags you specify in dwFlags.


I added them to the JoyInfo structure (sizeof(JoyInfo) and JOY_RETURNALL, respectively) and my gamepad works now. Might be a good idea to update the SVN version to do that as well.

3
General / Can't get SFML 1.4 to work properly!
« on: May 13, 2009, 03:55:55 am »
Some experimenting with modifying the Joystick::Initialize function and I found some weird output. The modified method is at the end of the post. This is the output it gives me:

Code: [Select]
Entered Joystick::Initialize(0)
ERROR: JOYERR_PARMS on index '0'.

Entered Joystick::Initialize(1)
For Joystick::Initialize(0)
Not the requested index: '0'. '1' requested.
ERROR: JOYERR_PARMS on index '1'.


So basically, when the method is run with 0 as parameter, joyGetPosEx instantly returns JOYERR_PARMS. When Initialize is run with 1 as index however, it finds one joystick with index 0, but since the requested index was 1 it chooses to ignore this. Quite odd. :?


Code: [Select]
void Joystick::Initialize(unsigned int Index)
{
    // Reset state
    myIndex     = JOYSTICKID1;
    myNbAxes    = 0;
    myNbButtons = 0;

    std::cout << "Entered Joystick::Initialize(" << Index << ")" << std::endl;

    // Get the Index-th connected joystick
    MMRESULT Error;
    JOYINFOEX JoyInfo;
    unsigned int NbFound = 0;
    for (NbFound = 0; (Error = joyGetPosEx(myIndex, &JoyInfo)) != JOYERR_PARMS; myIndex++)
    {
    std::cout << "For Joystick::Initialize(" << NbFound << ")" << std::endl;
        // Check if the current joystick is connected
        if (Error == JOYERR_NOERROR)
        {
            // Check if it's the required index
            if (NbFound == Index)
            {
                // Ok : store its parameters and return
                JOYCAPS Caps;
                joyGetDevCaps(myIndex, &Caps, sizeof(Caps));
                myNbAxes    = Caps.wNumAxes;
                myNbButtons = Caps.wNumButtons;
                if (myNbButtons > JoystickState::MaxButtons)
                    myNbButtons = JoystickState::MaxButtons;

                return;
            }
            else
            {
            std::cout << "Not the requested index: '" << NbFound << "'. '" << Index << "' requested." << std::endl;
            }

            // Go to the next valid joystick
            ++NbFound;
        }
    }
    std::cout << "ERROR: " << (Error == JOYERR_PARMS ? "JOYERR_PARMS" : "NONE") << " on index '" << NbFound << "'. " << std::endl << std::endl;
}

4
General / Can't get SFML 1.4 to work properly!
« on: May 13, 2009, 12:57:14 am »
The only really relevant code is from the event loop:

Code: [Select]
if (_window)
{
sf::Event event;

while (_window->GetEvent(event))
{
std::cout << event.Type << std::endl;

for (std::vector<EventHandler*>::iterator iter = _handlers.begin(); iter != _handlers.end(); iter++)
{
if ((*iter)->handleEvent(event))
break;
}
}
}


I redirected stdout to a file and searched for joystick events, not a single one of the events raised are joystick events, no matter how much I keep moving the axises or pressing the buttons.

5
General / Can't get SFML 1.4 to work properly!
« on: May 13, 2009, 12:16:55 am »
I'm using 32-bit XP with a PS2 adapter to connect a PS2 controller to the system. It's working fine in the control panel, and it's working fine everywhere I've tried it. I do not get a single joystick event under SFML however.

Edit: The PS2 controller is just for testing purposes and are not the controllers we will use as final controllers. We do not have access to the joysticks we will be using yet, however.

6
General / Can't get SFML 1.4 to work properly!
« on: May 12, 2009, 09:22:41 pm »
Quote from: "Laurent"
Quote
Oops! I guess this is fixed in SVN.

Indeed it is.

Sorry for the necro but, it is? I just compiled from SVN and now I'm getting no joystick input at all. I guess it's better than a deadlock, but we're in desperate need of joystick input for our project. Any specific revision we should turn to, or do we have to look for another lib for input?

Pages: [1]
anything