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

Pages: 1 ... 7 8 [9]
121
General / Re: Making SFML smoother and more accurate
« on: June 17, 2013, 04:58:49 pm »
Alright, I'll eat some pizza first and then post some stuff up :D

122
General / Making SFML smoother and more accurate
« on: June 17, 2013, 04:13:32 pm »
I'm getting through the input commands and such as you'll all know looking at my posts  but one thing I'm finding quite annoying is how glitchy everything looks at the moment when I put the code in. I see different things like velocity in other peoples' code when it comes to input though again these all seem to be for 1.6 versions of SFML.

Are there commands out there that can help me with the problems I'm having? For instance, when I move with the keys my object sort of just blinks across the screen rather than move in a smooth way. There's that same sort of effect with camera command as well and so on. There's also this annoying thing where when it comes to my mouse input that the object the mouse cursor moves is away from the actual cursor as opposed to on it or in the centre.

123
General / Re: How does MouseMoveEvent work exactly?
« on: June 11, 2013, 09:58:58 pm »
lol I'm using codeblocks and it does some weird ass things sometimes but I guess this must be something you have to get used to when programming.

124
General / Re: How does MouseMoveEvent work exactly?
« on: June 11, 2013, 07:39:30 pm »
wow just got it sort of working! nevermind, for some reason the IDE at first didn't like it very much when I used MouseMoved then when I fiddled around some more it did.

125
General / Re: How does MouseMoveEvent work exactly?
« on: June 11, 2013, 07:29:07 pm »
>_< :(

Quote


    while (window.isOpen())
    {

    sf::Event event;
    while (window.pollEvent(event))

if ( event.type == sf::Event::mouseMove );

{
    std::cout << "Mouse Move X works!: " << event.mouseMove.x;
    std::cout << "Mouse Move Y works!: " << event.mouseMove.y;
}


{
 if (event.type == sf::Event::Closed)
 window.close();
}

        window.clear();
        window.display();

    }

    return 0;

}



Quote
error: invalid use of non-static data member 'sf::Event::<anonymous union>::mouseMove'

I'm a bit baffled by this error message, it seems to be complaining about the classes? Not quite sure about this one the problem is when I tried changing "event" it threw up scope error messages instead, I've tried using MouseMoveEvent instead but of course that just caused more problems.

126
General / Re: How does MouseMoveEvent work exactly?
« on: June 11, 2013, 03:29:19 pm »
Yey! In that case I can experiment more now :) thanks for the help.

127
General / Re: How does MouseMoveEvent work exactly?
« on: June 11, 2013, 03:10:14 pm »
Well now I feel stupid this section had exactly what I needed.

http://www.sfml-dev.org/tutorials/2.0/window-events.php

Just a quick question though, would the syntax be the same if I were to say replace cout with my sprite class?

128
General / How does MouseMoveEvent work exactly?
« on: June 11, 2013, 02:58:32 pm »
In my continuous mission of making more interactive stuff I'm having some difficulty understanding the way MouseMoveEvent works and I know this is what I'll need if I want to make things like buttons etc. I've been trying the usual methods other code uses but of course that isn't working.

Does anyone have know of any source code examples and such that show a basic button working for example? What I'm trying to do is to get the code to detect my mouse going over a sprite and then replacing it with another sprite when I click for example. I bet it's going to be one of those things where it just has a specific way of working to the other input commands and I've missed it completely.

Just so you know, I have looked at the documentation but of course it only explains the syntax and doesn't show it actually being used in a practical way which I think is why I'm having trouble understanding it.

129
I FOUND IT OUT WOOT! WOOT! :D

http://en.sfml-dev.org/forums/index.php?topic=8539.0

Quote
To be a bit more precise, it's now sf::Mouse::getPosition().y, if it should be relative to your screen resolution and sf::Mouse::getPosition(window).y, if it should be relative to your window, were window is of type sf::RenderWindow.

Now I just need to find out why the bugger is warping all over the place and then I'll be able to do whatever I want with this.

130
I think I know what the problem is properly, I don't know the command needed for move to recognise where my mouse cursor coordinates are, I tried GetPosition but that just seemed to cause even more problems, I'd appreciate help if someone could post, in the mean time I'll keep digging around.

131
I've had a lot of success and found it surprisingly easy to get keys set up in SFML but I'm currently struggling with the mouse commands, is it possible to get a basic point and click function going? I'm talking the type you see on RPGs like Diablo 2, click to move the sprite across the screen. All the drawing commands work fine for me and I can get what I want on the screen no problem. I realise the localPosition is the wrong command for what I want but I've hit a wall now with it and I'd appreciate some tips, I can get stuff to happen if I specify exact coordinates and such but I want the sprite to follow where the cursor goes.

Quote


    while (window.isOpen())
    {

    sf::Event event;
    while (window.pollEvent(event))

        sf::Vector2i localPosition = sf::Mouse::getPosition( window );

        if ( sf::Mouse::isButtonPressed( sf::Mouse::Left ) );

        {
            spritename1.move ( localPosition );
        }


        {
            if (event.type == sf::Event::Closed)
                window.close();
            }

        window.clear();
        window.draw( spritewasteland1 );
        window.draw ( spritename1 );
        window.display();

    }

    return 0;


Note: Oops! I think I may have found the solution already! Let me know if you can think of anything better though! I think I'm going to have to use some of this: http://www.sfml-dev.org/documentation/2.0/structsf_1_1Event_1_1MouseMoveEvent.php

Extra Note: Okay found that events are the things I need to look at carefully so I can understand the syntax better: http://sfml-dev.org/tutorials/2.0/window-events.php

132
I'm a windows user and still learning so I couldn't say for sure what your problem is, but have you tried using an OpenGL window instead to see if that changes anything? If it doesn't, it might be something to do with the way your code is put together and that would need someone more experienced to have a look.

I have noticed in general games just don't like alt-tabbing a lot, especially if they're in fullscreen, that's why developers often offer up windowed modes.

133
General / Possible SFML configuration fix for Codeblocks users
« on: May 26, 2013, 11:43:30 am »
Okay, It took me awhile to figure it out but as the tutorial says Codeblocks seems to use the SJLJ version of SFML but I'll have a minor rant about that after showing people what to do and see if this helps fix this problem.

1) Download the GCC 4.7 TDM (SJLJ) version of SFML 2.0 ( NOT GCC 4.7 MinGW (DW2) - 32 bits ) and follow the tutorial as normal

2) Be sure to copy the .dll files to the saved codeblocks project folder that you have

Note: I did this without having to use CMake at all and in the end Codeblocks seems to work fine with the SJLJ version of SFML 2.0, I was getting .dll errors and entry procedure errors until I tried this.

I followed these steps myself having had an annoying number of problems getting it to work after following the tutorial normally, to an absolute beginner the SJLJ/DW2 business isn't very clearly explained. I looked in MINGW's Bin folder and found libgcc_s_sjlj-1.dll and libgcc_s_dw2-1.dll files and just through randomness I tried downloading the SJLJ version instead and followed the steps again. It worked and so far there hasn't been any crashes or error messages.

What I want to know is, why are there are two .dll files in this folder when there are only supposed to be one? And why does Codeblocks default to the SJLJ version? None of this is explained in the tutorial and it's clearly frustrating a lot of newbies, I think the only reason I solved this is because of my random tinkering.

Let me know if this solution works for those using Codeblocks.

Pages: 1 ... 7 8 [9]
anything