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

Pages: [1]
1
General / Re: What is wrong with this code?
« on: January 15, 2013, 09:14:49 pm »
Wait never mind, I think I figured it out. I was doing it the way I would have in SDL. I didn't realize that SFML has a different system of making rectangles lol.

2
General / Re: What is wrong with this code?
« on: January 15, 2013, 09:05:48 pm »
I still don't know what I'm doing wrong. Is my code wrong or something. Am I just not putting in the parameters in right?

3
General / What is wrong with this code?
« on: January 15, 2013, 04:34:52 am »
Hi, Im new here on sfml forums and right now im trying to make a simple pong game in sfml 1.6.
When I get to making the shape of the second paddle, when I compile, it doesn't show up right. Like I put the exact parameters but it shows up in a different place.
Here's the code I have so far:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow Window (sf::VideoMode(640, 480, 32), "Pong");
    sf::Shape paddle1 = sf::Shape::Rectangle(0, 100, 10, 10, sf::Color(255, 0, 0));
    sf::Shape paddle2 = sf::Shape::Rectangle(0, 0, 10, 10, sf::Color(255,0,0)); // I put the parameters 0, 0 in here but the rectangle shows up in a different spot on the screen
    sf::Shape ball = sf::Shape::Circle(320, 240, 10, sf::Color(255,0,0));

    while(Window.IsOpened())
    {
        sf::Event Event;
        while(Window.GetEvent(Event))
        {
            if(Event.Type == sf::Event::Closed)
                Window.Close();
        }

        if(Window.GetInput().IsKeyDown(sf::Key::Down))
            paddle1.Move(0.0, 2.0);
        if(Window.GetInput().IsKeyDown(sf::Key::Up))
            paddle1.Move(0.0, -2.0);

        Window.Clear(sf::Color(255,255,255));
        Window.Draw(paddle1);
        Window.Draw(paddle2);
        Window.Draw(ball);
        Window.Display();
        sf::Sleep(0.06);
    }
}

Pages: [1]
anything