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

Pages: [1]
1
Window / Re: sf::Joystick::getAxisPosition is not recording Hold!
« on: November 15, 2012, 02:21:32 pm »
I figured it out thank you!

2
Window / Re: sf::Joystick::getAxisPosition is not recording Hold!
« on: November 15, 2012, 02:18:23 pm »
I need the code to be executed within the main loop (Shown Above) were would I then properly okace the checker then?

3
Window / sf::Joystick::getAxisPosition is not recording Hold!
« on: November 15, 2012, 03:15:36 am »
I am trying to test out the entirety of the window module to get a hang of it. As part of that project im trying to change the glClearColor on every frame depending on the position of the axis! Problem is when i first move the analogue stick it works just fine! Now when i try to hold the analogue stick  to the left it only works for the first frame then it fails the if test! All the code besides the axis part work. I am using the Xbox 360 Controller for PC if that helps. Code below:

   
        Event event;

        float R = 0.0f;
        float G = 0.0f;
        float B = 0.0f;

        while (window.isOpen())
        {      
        while (window.pollEvent(event))
        {
            if (event.type == Event::Closed)
            {
                window.close();
            }
            else if (event.type == Event::Resized)
            {
                glViewport(0, 0, event.size.width, event.size.height);
                        }
                        else if (Keyboard::isKeyPressed(Keyboard::Escape))
                        {
                                window.close();
                        }
                        else if (Joystick::isButtonPressed(0, 0))
                        {
                                window.close();
                        }
                        else if(Joystick::getAxisPosition(0, Joystick::X) > 50)
                        {
                                R = R + 0.01f;
                                G = R + 0.01f;
                                B = R + 0.01f;
                        }
                        else if(Joystick::getAxisPosition(0, Joystick::X) < -50)
                        {
                                R = R - 0.01f;
                                G = R - 0.01f;
                                B = R - 0.01f;
                        }
                }

        // clear the buffers
                glClearColor(R, G, B, 0.0f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // end the current frame (internally swaps the front and back buffers)
        window.display();
    }

Thanks in advance~!

Pages: [1]
anything