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

Pages: [1]
1
General / Re: Missing library header, GCC 4.8.1
« on: August 21, 2013, 04:02:12 pm »
Yeaaaah finally! Thanks a ton!

2
General / Re: Missing library header, GCC 4.8.1
« on: August 21, 2013, 03:55:11 pm »
Thanks. That did the job. Still I have a problem though ... I was installing new compiler because old MinGW ( doesnt know that 'to_string' is a std member, but 4.8.1 doesn't know it either. It's kinda stupid Anyone knows how to make it work?

I found this:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52015
http://tehsausage.com/mingw-to-string
But not really sure what should I do. There is a patch for version 4.7.x that didn't worked for me when i was using 4.7.x. Any thoughts?

3
General / Missing library header, GCC 4.8.1
« on: August 21, 2013, 02:24:22 am »
I've recently changed compiler from earlier version of gcc 4.7.0 into gcc 4.8.1 from MinGW-builds project.
I've compiled sfml from sources, everything went okay, but somehow g++ refuses to see headers from sfml.
File it complains is exactly there "C:\MinGW\mingw32\include\SFML" where it should be. What could it be.


4
Nvm, I figured it out. I'm using simple detection ( not any sophisticated sweep test predictions ) anyway, if anyone will encounter similar problem, I did two way collision checks, for paddle->ball and ball->paddle.

5
I've got my collissions up and running ( up to a point ). In 1 situation if my moving object ( ball ) hits a stationary object everything is cool, 1 collision detected and behave as expected. Problem begins when an object moves towards other and second moves towards first as presented in situation 2. Then I get 2 collisions and I would like to get rid off such inconvenience. For learning purposes im using 1 pixel per frame movement for both objects so it is easier to understand. Collision checking is very simple and its basically something like this:
if( Rect.intersecting other Rect ){ then move away by one pixel }
in gameloop.
Since I like pictures i've drawn it, so here's pic:   


My question what's the solution? And maybe what are advantages and disadvantages if there are multiple solutions?
And the second question is kinda related, I guess ...  When we get into higher velocities, let's say ball is moving twice as fast ( 2 pixels per frame! :) ) then similar situation happens, except when we get 10 times speed we miss collision completely. It's called tunelling/ghosting but I need more details about how to solve it. Do I need prediction of movement, or checking ( sweep ) after? How to get actual point of collision?

6
Graphics / Re: Collision detection question
« on: August 18, 2013, 06:34:33 pm »
I mean this:
http://www.sfml-dev.org/documentation/2.1/classsf_1_1Rect.php#a5f1874792b04c7e221bb786b31f5836e

And eventually u will have to check collision at 4 sides for obstacles ;)

7
Graphics / Re: Collision detection question
« on: August 18, 2013, 05:51:22 pm »
U can make 4 rectangles for each side, or get information about intersection - so if height of intersection is bigger than width its vertical collision and if else its horizontal, else its corner :)

8
Graphics / Re: Rectangle coordinates.
« on: August 15, 2013, 02:57:14 pm »
I get it :) Thanks!

9
Graphics / Rectangle coordinates.
« on: August 15, 2013, 02:39:41 pm »
I've recently added simple collision detection for my pong like game. Basically it works like i've got 800x600 frame and im checking if this big frame contains player sprite. Everything is working fine except bottom.
Here's sample code
sf::FloatRect frameBig(0,0,800,600);
        if(!frameBig.contains(sprPlayer.getGlobalBounds().left,sprPlayer.getGlobalBounds().top)
         ||!frameBig.contains(sprPlayer.getGlobalBounds().left+sprPlayer.getGlobalBounds().width,sprPlayer.getGlobalBounds().top)
         ||!frameBig.contains(sprPlayer.getGlobalBounds().left+sprPlayer.getGlobalBounds().width,sprPlayer.getGlobalBounds().top+sprPlayer.getGlobalBounds().height)
         ||!frameBig.contains(sprPlayer.getGlobalBounds().left,sprPlayer.getGlobalBounds().top+sprPlayer.getGlobalBounds().height))

 

So checking top Left, top Right, bottom Right and bottom Left corners of the sprite if they are inside of frame. As I said left,top and right detection works perfectly ( pixel perfect ) but somehow when comming to bottom player sprite stops bit higher like one pixel is missing. Why is there a diffrence?

Here's pic:


Edit:
And the movement is set 1.0f per step.

10
General / Re: Smooth Movement
« on: August 14, 2013, 04:38:43 pm »
Point taken. I've run some tests with both implementations of movement ( 2 open windows set aside ) and while moving both my sprites simultaneously ( while having one window focused ) I noticed that with same input  after moving my sprite bit around, they don't end finally in same place. I feel like event driven implementation is kinda more accurate. Nice to meet you Laurent! ;D

11
General / Re: Smooth Movement
« on: August 14, 2013, 04:00:22 pm »
I hope you didn't do that in the event loop...
I actually did. Everything is working fine now. :-[
As for Morley - I've done this exactly this way with releasing key and turning off flag, I guess both ways will work fine now, but I'll check it. Still I guess what u're saying is not technical issue but rather design and esthetical.
Thanks again eX. Cheers for brave new pong :) We can change Topic name to [Solved].

12
General / Re: Smooth Movement
« on: August 14, 2013, 03:07:09 pm »
Thank you, and sorry. :-[

EDIT:

Actually I've changed this to:
sf::Vector2f movement(0.f, 0.f);
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
movement.y -= 10.0f;
... and it's still the same. I get the feeling that something is wrong with focusing window and updating the loop.
As i said if i keep moving mouse over the window, the input feels very smooth and framerate goes up, but if I dont i feel like framerate is rly low, I don't hear my gfx card running and movement is stuttering.

13
General / Smooth Movement
« on: August 14, 2013, 02:57:06 pm »
Hi, i've recently tried to move sprite in my Pong game, and it basically works but when i press key it moves one tick, and if i keep the key pressed it starts to move normally. Using sfml 2.1 and events and some booleans flags, something like this:
bool holdingLeft;

while(window.pollEvent(event))
        {
            switch(event.type)
            {
            case sf::Event::KeyPressed:
                    handlePlayerInput (event.key.code, true);
                    break;
            }
        }
void handlePlayerInput(sf::Keyboard::Key key, bool isPressed)
{
    if (key == sf::Keyboard::Left)
        holdingLeft = isPressed;
}

sf::Vector2f movement(0.f, 0.f);
if (holdingLeft)
            movement.x -= 10.0f;
sprPlayer.move(movement);
 

My question is why is this happening and how to make it run smoothly?
PS. I noticed that when i move the mouse over the window in the same time it is bit better. It seems like window isn't focused and rendering whole time and when u move mouse over it runs smoother. ( I haven't done anything connected with mouse in code )

14
SFML website / Re: New website
« on: August 14, 2013, 11:36:47 am »
There is wrong link in tutorials.
http://www.sfml-dev.org/tutorials/2.1/ -> when u're here
2.1 tutorials points to french
http://www.sfml-dev.org/tutorials/2.1/index-fr.php

Pages: [1]