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

Pages: [1]
1
General / Re: Im stuck with tutor. #1
« on: January 07, 2014, 02:44:33 pm »
silly me shape.setSize({paddleWidth, paddleHeight}); has curly brackets cos setSize has only 1 parameter !  :P

2
General / Re: Im stuck with tutor. #1
« on: January 07, 2014, 12:40:10 pm »
I'm using it right away!  :D But didn't find anything about constexpr  :(  Now I'm trying to figure out why he use the brace in setSize func and doesn't use it in setOrigin func  :o

 shape.setSize({paddleWidth, paddleHeight});

 shape.setOrigin(paddleWidth / 2.f, paddleHeight /2.f);
 

3
General / Re: Im stuck with tutor. #1
« on: January 07, 2014, 08:22:41 am »
added the QMAKE_CXXFLAGS += -std=c++11 in my .pro file And now I'm using C++11 The problem solved Thanks everyone  :D

4
General / Re: Im stuck with tutor. #1
« on: January 06, 2014, 11:49:46 pm »
My problem is

const float BALL_VELOCITY = 8.F;
Vector2f velocity(-BALL_VELOCITY,-BALL_VELOCITY);
The compil says : expected identifier before '-' token

If I delet '-' Comp. says : BALL_VELOCITY is not a type
(os windows, qt creator(gcc))

5
General / Im stuck with tutor. #1
« on: January 06, 2014, 11:23:51 pm »
Im new in SFML and Im new in C++ too And I don't even speak engl. (OMG What am I doing in here  :o) Just want to do the video tutor 1 But seems Im stuck. I can't use the "constexpr" So I decided to use just CONST And I got the problem witch i can't solve The problem is "Vector2f velocity". Any help please  :) 
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

using namespace std;
using namespace sf;

const unsigned WINDOW_WIDTH = 800;
const unsigned WINDOW_HEIGHT = 600;
const float BALL_RADIUS = 10.f;
const float BALL_VELOCITY = 8.f;

struct Ball
{
    CircleShape shape;

    Vector2f velocity(-BALL_VELOCITY, -BALL_VELOCITY);

    Ball(float mX, float mY)
    {
        shape.setPosition(mX, mY);
        shape.setRadius(BALL_RADIUS);
        shape.setFillColor(Color::Red);
        shape.setOrigin(BALL_RADIUS, BALL_RADIUS);
    }

    void update(){shape.move(velocity);}
};

int main()
{
    Ball ball(WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2);

    RenderWindow window(VideoMode(WINDOW_WIDTH, WINDOW_HEIGHT), "Arkanoid-1");
    window.setFramerateLimit(60);

    while(true)
    {
        Event event;
        window.pollEvent(event);

        window.clear(Color::Black);

        if(Keyboard::isKeyPressed(Keyboard::Escape)) break;

        ball.update();
        window.draw(ball.shape);
        window.display();
    }

    return 0;
}
 

Pages: [1]
anything