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

Pages: [1]
1
General / Whats wrong with my emplace_back code
« on: April 12, 2016, 01:21:01 pm »
I just started coding with c++ sfml, i'm currently working on a game which I need to create 44 green rectangles and draw them on the screen, here is my code to create them: But when I run it, it says 'std::vector<_Ty>::emplace_back' : function does not take 2 arguments, how can I fix this or am I doing it completely wrong, any help please?


struct Brick {
    RectangleShape shape;

    Brick (float mX, float mY) {
        shape.setPosition(mX,mY);
        shape.setSize(Vector2f(60,20));
        shape.setFillColor(Color::Green);
        shape.setOrigin(60 / 2, 20 / 2);
    }
};

int countBlocksX = 11;
int countBlocksY = 4;

vector<Brick> bricks;

for (int iX = 0; iX < countBlocksX; iX++) {
    for (int iY = 0; iY < countBlocksY; iY++) {
        bricks.emplace_back ((iX + 1) * (60 + 3) , (iY + 2) * (20 +3));                
    }
}

Pages: [1]
anything