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

Pages: [1]
1
Window / Re: Can't make Joystick work
« on: December 11, 2012, 05:08:31 pm »
Thanks for the answer, I changed that, but I'm still getting the same error. It's really weird though. I have also tried to find a finished project using sf::Joystick but with no luck at all.
I have had a great response from this community, I'm really considerating money donation right now.
Laurent, if you think of something that could help me solve this, please let me know

2
Window / Re: Can't make Joystick work
« on: December 11, 2012, 03:55:24 pm »
Laurent, as I said, I have followed step by step from here (with Static options).

This is how my build options are:


RELEASE


DEBUG


And I also tried simply writing sfml-window and sfml-system, but I'm getting the same error

3
Window / Re: Can't make Joystick work
« on: December 11, 2012, 02:36:29 am »
I finally made the transition to v2.0 - I have followed this guide and noticed that the Joystick function is Static, so I configured my build options according the basic tutorial

I just wrote the line sf::Joystick::update(); just to test if I can compile the program, so my function is this:

int parsekey() {
    sf::Joystick::update();
    char k;
    if (_kbhit() == 0) return 0;
        k = _getch();
    switch (k){
    case 'w': if (movedir != 3) {movedir = 1;} return 0; break;
    case 'a': if (movedir != 4) {movedir = 2;} return 0; break;
    case 's': if (movedir != 1) {movedir = 3;} return 0; break;
    case 'd': if (movedir != 2) {movedir = 4;} return 0; break;
    case 'p':
        gotoxy(console_x / 2 - 5, console_y / 2 - 1);
        printf ("P A U S E D");
        do { k = _getch(); } while (k != 'p');
        pos p; p.y = (world_y) / 2 - 1;

        for (   p.x  = (world_x) / 2 - 5;
                p.x <= (world_x) / 2 + 5;
                p.x++)

                render_pos(p);
        break;
    case 27: // esc
        return 1;
        break;
    }
    return 0;
}

Now, the error I'm having it's the next one:


I don't need to say I don't get this:
undefined reference to `_imp___ZN2sf8Joystick6updateEv'
What? I have to define the sf::joystick somewhere? Isn't is enough with just including <SFML/Window.hpp>?

4
Window / Re: Can't make Joystick work
« on: December 11, 2012, 12:13:52 am »
You should have said earlier that you wanted to do that without a window. So that we could understand why you made so many syntax errors ;)

Yeah, sorry for that. As I said, I'm a newbie. I will try v2.0 and keep you updated with my future problems ;D
Thank you for all the help, you are an awesome community

5
Window / Re: Can't make Joystick work
« on: December 10, 2012, 11:08:40 pm »
Thanks a lot for your answers. I am having a headache with this. Every time I think I am getting close to what I want, a nwe problem appears. First of all, this is the final code.

   x =  sf::Window().GetInput().GetJoystickAxis(0, sf::Joy::AxisX);

And it seems it is working, because I didn't get any errors when I was compiling.
The big problem: Code::Blocks never finish the compilation. Check this out:


Link to the image

It is just freezing there. The only thing I can do is abort the compilation.

Maybe I'm misunderstanding this whole library. I don't want to open any other window. My game it is just a Snake in ascii.


Link to the picture

I just want to be able to control its movement with 4 buttons in a Joystick. Does the Version 2.0 allows me to do this? without opening any window?

6
Window / Re: Can't make Joystick work
« on: December 10, 2012, 05:43:42 am »
Thanks for the Answer  :) - But unfortunately, I'm stuck again with another error. I changed the code of that line and now it is:

x =  sf::Window::GetInput.GetJoystickAxis(0,sf::Joy::AxisX);

The error is:
request for member 'GetJoystickAxis' in 'sf::Window::GetInput', which is of non-class type 'const sf::Input& (sf::Window::)()const'

This time, I'm more disoriented than before. I didn't use v2.0 because I thought it was relatively new, and it wouldn't have enough documentation to learn. I will give it a try, but if you could figure out why I keep getting that error, you would really help me.
By the way, thanks again!

7
Window / Can't make Joystick work
« on: December 10, 2012, 03:17:36 am »
Hi. I'm really sorry for my noob questions, but I'm pretty new to all this. The thing is I donĀ“t know how to make Joystick works. For Example, I have this code:

int parsekey() {
    char k;
    if (_kbhit() == 0) return 0;
        k = _getch();
    switch (k){
    case 'w': if (movedir != 3) {movedir = 1;} return 0; break;
    case 'a': if (movedir != 4) {movedir = 2;} return 0; break;
    case 's': if (movedir != 1) {movedir = 3;} return 0; break;
    case 'd': if (movedir != 2) {movedir = 4;} return 0; break;
    case 'p':
        gotoxy(console_x / 2 - 5, console_y / 2 - 1);
        printf ("P A U S E D");
        do { k = _getch(); } while (k != 'p');
        pos p; p.y = (world_y) / 2 - 1;

        for (   p.x  = (world_x) / 2 - 5;
                p.x <= (world_x) / 2 + 5;
                p.x++)

                render_pos(p);
        break;
    case 27: // esc
        return 1;
        break;
    }
    return 0;
}

This is an actual code intended to move a character, and it is functionally working. What I want to do is make use of the joystick function. I have Code::Blocks and SFML 1.6 already working and well configured, but maybe I'm missing something (I have followed THIS tutorial).
So, what I started doing is adding this lines just to make sure it is compilling.

    float x;
    x =  sf::Input::GetJoystickAxis(1, sf::Joy::AxisX);

And I have the following error:
cannot call member function 'float sf::Input::GetJoystickAxis(unsigned int, sf::Joy::Axis) const' without object
As I said, I'm pretty noob with all this, so I don't even know what's that error meaning. Please, if you could help I would be really gratefull. If you need to know something more, please tell. I need to have this working.

Pages: [1]
anything