Missing closing brace in SFML program?











up vote
0
down vote

favorite












I made a program using C++ and SFML. The program is supposed to generate 20 circles that are either red or blue, and it did work. Yet, I made a few changes, saved, and came back to it on VS a few hours later to find that I keep getting an error:



'{': No matching token found (Line 9)



I keep scanning through the code and I can't seem to find the issue at all.



Code:



#include <SFML/Graphics.hpp>
#include <iostream>
#include <chrono>
#include <random>

using namespace std;

int main()
{ //Line 9
unsigned seed = chrono::system_clock::now().time_since_epoch().count();
default_random_engine generator(seed);
uniform_int_distribution<int> distribution1(0, 1024);
uniform_int_distribution<int> distribution2(1, 2);

sf::RenderWindow window(sf::VideoMode(1024, 1024), "Spooky Circle Box");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Red);
shape.setPosition(10, 10);

std::vector<sf::CircleShape> circles(20);

window.clear();

for (unsigned int i = 0; i < circles.size(); i++) {
int find = 0;
int find_color = 0;
while (find != 20) {
circles[i].setPosition(distribution1(generator), distribution1(generator));
for (unsigned int j = 0; j < circles.size(); j++) {
if (i == j || (circles[i].getPosition().x != circles[j].getPosition().x || circles[i].getPosition().y != circles[j].getPosition().y)) {
find++;
} else;
if (find != 20) {
find = 0;
} else;
}
find = 0;
find_color = distribution2(generator);
circles[i].setRadius(5.f);

if (find_color == 1) {
circles[i].setFillColor(sf::Color::Blue);
} else { circles[i].setFillColor(sf::Color::Red); }

window.draw(circles[i]);
}

window.display();

while (window.isOpen()) {
sf::sleep((sf::milliseconds(100)));
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}









share|improve this question






















  • You're missing a closing bracket at the end, but you should re-check all your braces and ensure you're closing them in the right place. I think you have some bad indentation somewhere
    – alseether
    Nov 20 at 10:44










  • Said that, your code is quite messy, you have at least two (unintended) infinite loops. First one unables you to scape from while(find != 20), because you're setting find to 0 each time inside the second for. Second "infinite" loop would be while(window.isOpen()) because, as it name says, you'll be there until your window closes
    – alseether
    Nov 20 at 10:54










  • I know I'm missing a brace somewhere, but I don't see the issue, and that's my problem. Also, those are both supposed to be infinite loops. The first one goes until it finds a position that works, and that only takes 1-3 tries. The second one is supposed to be that way, otherwise you'd never be able to close the window properly. I suppose I could add a pause to lower strain.
    – Anoraki
    Nov 21 at 3:48










  • If your intention is just to draw circles once, I think you're missing that closing brace just between lines 32 and 33. It seems you're indenting the code, but that for (line 29) needs the brace
    – alseether
    Nov 21 at 7:17

















up vote
0
down vote

favorite












I made a program using C++ and SFML. The program is supposed to generate 20 circles that are either red or blue, and it did work. Yet, I made a few changes, saved, and came back to it on VS a few hours later to find that I keep getting an error:



'{': No matching token found (Line 9)



I keep scanning through the code and I can't seem to find the issue at all.



Code:



#include <SFML/Graphics.hpp>
#include <iostream>
#include <chrono>
#include <random>

using namespace std;

int main()
{ //Line 9
unsigned seed = chrono::system_clock::now().time_since_epoch().count();
default_random_engine generator(seed);
uniform_int_distribution<int> distribution1(0, 1024);
uniform_int_distribution<int> distribution2(1, 2);

sf::RenderWindow window(sf::VideoMode(1024, 1024), "Spooky Circle Box");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Red);
shape.setPosition(10, 10);

std::vector<sf::CircleShape> circles(20);

window.clear();

for (unsigned int i = 0; i < circles.size(); i++) {
int find = 0;
int find_color = 0;
while (find != 20) {
circles[i].setPosition(distribution1(generator), distribution1(generator));
for (unsigned int j = 0; j < circles.size(); j++) {
if (i == j || (circles[i].getPosition().x != circles[j].getPosition().x || circles[i].getPosition().y != circles[j].getPosition().y)) {
find++;
} else;
if (find != 20) {
find = 0;
} else;
}
find = 0;
find_color = distribution2(generator);
circles[i].setRadius(5.f);

if (find_color == 1) {
circles[i].setFillColor(sf::Color::Blue);
} else { circles[i].setFillColor(sf::Color::Red); }

window.draw(circles[i]);
}

window.display();

while (window.isOpen()) {
sf::sleep((sf::milliseconds(100)));
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}









share|improve this question






















  • You're missing a closing bracket at the end, but you should re-check all your braces and ensure you're closing them in the right place. I think you have some bad indentation somewhere
    – alseether
    Nov 20 at 10:44










  • Said that, your code is quite messy, you have at least two (unintended) infinite loops. First one unables you to scape from while(find != 20), because you're setting find to 0 each time inside the second for. Second "infinite" loop would be while(window.isOpen()) because, as it name says, you'll be there until your window closes
    – alseether
    Nov 20 at 10:54










  • I know I'm missing a brace somewhere, but I don't see the issue, and that's my problem. Also, those are both supposed to be infinite loops. The first one goes until it finds a position that works, and that only takes 1-3 tries. The second one is supposed to be that way, otherwise you'd never be able to close the window properly. I suppose I could add a pause to lower strain.
    – Anoraki
    Nov 21 at 3:48










  • If your intention is just to draw circles once, I think you're missing that closing brace just between lines 32 and 33. It seems you're indenting the code, but that for (line 29) needs the brace
    – alseether
    Nov 21 at 7:17















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I made a program using C++ and SFML. The program is supposed to generate 20 circles that are either red or blue, and it did work. Yet, I made a few changes, saved, and came back to it on VS a few hours later to find that I keep getting an error:



'{': No matching token found (Line 9)



I keep scanning through the code and I can't seem to find the issue at all.



Code:



#include <SFML/Graphics.hpp>
#include <iostream>
#include <chrono>
#include <random>

using namespace std;

int main()
{ //Line 9
unsigned seed = chrono::system_clock::now().time_since_epoch().count();
default_random_engine generator(seed);
uniform_int_distribution<int> distribution1(0, 1024);
uniform_int_distribution<int> distribution2(1, 2);

sf::RenderWindow window(sf::VideoMode(1024, 1024), "Spooky Circle Box");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Red);
shape.setPosition(10, 10);

std::vector<sf::CircleShape> circles(20);

window.clear();

for (unsigned int i = 0; i < circles.size(); i++) {
int find = 0;
int find_color = 0;
while (find != 20) {
circles[i].setPosition(distribution1(generator), distribution1(generator));
for (unsigned int j = 0; j < circles.size(); j++) {
if (i == j || (circles[i].getPosition().x != circles[j].getPosition().x || circles[i].getPosition().y != circles[j].getPosition().y)) {
find++;
} else;
if (find != 20) {
find = 0;
} else;
}
find = 0;
find_color = distribution2(generator);
circles[i].setRadius(5.f);

if (find_color == 1) {
circles[i].setFillColor(sf::Color::Blue);
} else { circles[i].setFillColor(sf::Color::Red); }

window.draw(circles[i]);
}

window.display();

while (window.isOpen()) {
sf::sleep((sf::milliseconds(100)));
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}









share|improve this question













I made a program using C++ and SFML. The program is supposed to generate 20 circles that are either red or blue, and it did work. Yet, I made a few changes, saved, and came back to it on VS a few hours later to find that I keep getting an error:



'{': No matching token found (Line 9)



I keep scanning through the code and I can't seem to find the issue at all.



Code:



#include <SFML/Graphics.hpp>
#include <iostream>
#include <chrono>
#include <random>

using namespace std;

int main()
{ //Line 9
unsigned seed = chrono::system_clock::now().time_since_epoch().count();
default_random_engine generator(seed);
uniform_int_distribution<int> distribution1(0, 1024);
uniform_int_distribution<int> distribution2(1, 2);

sf::RenderWindow window(sf::VideoMode(1024, 1024), "Spooky Circle Box");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Red);
shape.setPosition(10, 10);

std::vector<sf::CircleShape> circles(20);

window.clear();

for (unsigned int i = 0; i < circles.size(); i++) {
int find = 0;
int find_color = 0;
while (find != 20) {
circles[i].setPosition(distribution1(generator), distribution1(generator));
for (unsigned int j = 0; j < circles.size(); j++) {
if (i == j || (circles[i].getPosition().x != circles[j].getPosition().x || circles[i].getPosition().y != circles[j].getPosition().y)) {
find++;
} else;
if (find != 20) {
find = 0;
} else;
}
find = 0;
find_color = distribution2(generator);
circles[i].setRadius(5.f);

if (find_color == 1) {
circles[i].setFillColor(sf::Color::Blue);
} else { circles[i].setFillColor(sf::Color::Red); }

window.draw(circles[i]);
}

window.display();

while (window.isOpen()) {
sf::sleep((sf::milliseconds(100)));
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}






visual-c++ sfml






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 at 5:54









Anoraki

11




11












  • You're missing a closing bracket at the end, but you should re-check all your braces and ensure you're closing them in the right place. I think you have some bad indentation somewhere
    – alseether
    Nov 20 at 10:44










  • Said that, your code is quite messy, you have at least two (unintended) infinite loops. First one unables you to scape from while(find != 20), because you're setting find to 0 each time inside the second for. Second "infinite" loop would be while(window.isOpen()) because, as it name says, you'll be there until your window closes
    – alseether
    Nov 20 at 10:54










  • I know I'm missing a brace somewhere, but I don't see the issue, and that's my problem. Also, those are both supposed to be infinite loops. The first one goes until it finds a position that works, and that only takes 1-3 tries. The second one is supposed to be that way, otherwise you'd never be able to close the window properly. I suppose I could add a pause to lower strain.
    – Anoraki
    Nov 21 at 3:48










  • If your intention is just to draw circles once, I think you're missing that closing brace just between lines 32 and 33. It seems you're indenting the code, but that for (line 29) needs the brace
    – alseether
    Nov 21 at 7:17




















  • You're missing a closing bracket at the end, but you should re-check all your braces and ensure you're closing them in the right place. I think you have some bad indentation somewhere
    – alseether
    Nov 20 at 10:44










  • Said that, your code is quite messy, you have at least two (unintended) infinite loops. First one unables you to scape from while(find != 20), because you're setting find to 0 each time inside the second for. Second "infinite" loop would be while(window.isOpen()) because, as it name says, you'll be there until your window closes
    – alseether
    Nov 20 at 10:54










  • I know I'm missing a brace somewhere, but I don't see the issue, and that's my problem. Also, those are both supposed to be infinite loops. The first one goes until it finds a position that works, and that only takes 1-3 tries. The second one is supposed to be that way, otherwise you'd never be able to close the window properly. I suppose I could add a pause to lower strain.
    – Anoraki
    Nov 21 at 3:48










  • If your intention is just to draw circles once, I think you're missing that closing brace just between lines 32 and 33. It seems you're indenting the code, but that for (line 29) needs the brace
    – alseether
    Nov 21 at 7:17


















You're missing a closing bracket at the end, but you should re-check all your braces and ensure you're closing them in the right place. I think you have some bad indentation somewhere
– alseether
Nov 20 at 10:44




You're missing a closing bracket at the end, but you should re-check all your braces and ensure you're closing them in the right place. I think you have some bad indentation somewhere
– alseether
Nov 20 at 10:44












Said that, your code is quite messy, you have at least two (unintended) infinite loops. First one unables you to scape from while(find != 20), because you're setting find to 0 each time inside the second for. Second "infinite" loop would be while(window.isOpen()) because, as it name says, you'll be there until your window closes
– alseether
Nov 20 at 10:54




Said that, your code is quite messy, you have at least two (unintended) infinite loops. First one unables you to scape from while(find != 20), because you're setting find to 0 each time inside the second for. Second "infinite" loop would be while(window.isOpen()) because, as it name says, you'll be there until your window closes
– alseether
Nov 20 at 10:54












I know I'm missing a brace somewhere, but I don't see the issue, and that's my problem. Also, those are both supposed to be infinite loops. The first one goes until it finds a position that works, and that only takes 1-3 tries. The second one is supposed to be that way, otherwise you'd never be able to close the window properly. I suppose I could add a pause to lower strain.
– Anoraki
Nov 21 at 3:48




I know I'm missing a brace somewhere, but I don't see the issue, and that's my problem. Also, those are both supposed to be infinite loops. The first one goes until it finds a position that works, and that only takes 1-3 tries. The second one is supposed to be that way, otherwise you'd never be able to close the window properly. I suppose I could add a pause to lower strain.
– Anoraki
Nov 21 at 3:48












If your intention is just to draw circles once, I think you're missing that closing brace just between lines 32 and 33. It seems you're indenting the code, but that for (line 29) needs the brace
– alseether
Nov 21 at 7:17






If your intention is just to draw circles once, I think you're missing that closing brace just between lines 32 and 33. It seems you're indenting the code, but that for (line 29) needs the brace
– alseether
Nov 21 at 7:17














1 Answer
1






active

oldest

votes

















up vote
0
down vote













I explain further my comments, but I'm not going to post any repaired code. I only suggest a way of doing things.



By the structure of you're code, it seems you're trying to generate some blue or red circles randomly distributed over the window, but, at the same time, you're trying to draw them.



You should differentiate you actual data from you're drawing stuff. My suggested pseude-code would be.



int main(){int main(){
// 1 . Declare your circle vector

// 2 . Populate that vector with random circles (random position, random color)

// Now draw those circles
// 3 . while(window.isOpen()) loop

// 3.1 Clear the window

// 3.2 Draw your circles

// 3.3 Display the stuff

}


That point 3 it's basically the way to draw stuff acording SFML tutorials.






share|improve this answer





















  • That's what I did, except for number 3. I know the first SFML example has the shapes being drawn in the isOpen loop, but that's really stupid. Not only is it wrong, it's tricking new people into thinking it's okay. If you make it clear, draw, and display inside the loop, it'll draw the shape(s) as many times as it can in the shortest amount of time. Running the example, which just draws a low res circle, caused the program to suck up 30% of my CPU usage. Moving the draw out of the loop or adding a pause lowered that to 0%.
    – Anoraki
    Nov 21 at 3:52










  • Oh, and I'm not generating the circles and drawing them at the same time. I'm generating them once, and then drawing them once after they're all generated. Not trying to be rude, but you shouldn't be trying to answer if you don't know SFML.
    – Anoraki
    Nov 21 at 3:55






  • 1




    @Anoraki If you don't clear-draw-display each time you won't be able to draw moving stuff. If you (i'm not sure if that's your case) want to move your circles, you'll be forced to clear and redraw each time.
    – alseether
    Nov 21 at 7:13











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387027%2fmissing-closing-brace-in-sfml-program%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













I explain further my comments, but I'm not going to post any repaired code. I only suggest a way of doing things.



By the structure of you're code, it seems you're trying to generate some blue or red circles randomly distributed over the window, but, at the same time, you're trying to draw them.



You should differentiate you actual data from you're drawing stuff. My suggested pseude-code would be.



int main(){int main(){
// 1 . Declare your circle vector

// 2 . Populate that vector with random circles (random position, random color)

// Now draw those circles
// 3 . while(window.isOpen()) loop

// 3.1 Clear the window

// 3.2 Draw your circles

// 3.3 Display the stuff

}


That point 3 it's basically the way to draw stuff acording SFML tutorials.






share|improve this answer





















  • That's what I did, except for number 3. I know the first SFML example has the shapes being drawn in the isOpen loop, but that's really stupid. Not only is it wrong, it's tricking new people into thinking it's okay. If you make it clear, draw, and display inside the loop, it'll draw the shape(s) as many times as it can in the shortest amount of time. Running the example, which just draws a low res circle, caused the program to suck up 30% of my CPU usage. Moving the draw out of the loop or adding a pause lowered that to 0%.
    – Anoraki
    Nov 21 at 3:52










  • Oh, and I'm not generating the circles and drawing them at the same time. I'm generating them once, and then drawing them once after they're all generated. Not trying to be rude, but you shouldn't be trying to answer if you don't know SFML.
    – Anoraki
    Nov 21 at 3:55






  • 1




    @Anoraki If you don't clear-draw-display each time you won't be able to draw moving stuff. If you (i'm not sure if that's your case) want to move your circles, you'll be forced to clear and redraw each time.
    – alseether
    Nov 21 at 7:13















up vote
0
down vote













I explain further my comments, but I'm not going to post any repaired code. I only suggest a way of doing things.



By the structure of you're code, it seems you're trying to generate some blue or red circles randomly distributed over the window, but, at the same time, you're trying to draw them.



You should differentiate you actual data from you're drawing stuff. My suggested pseude-code would be.



int main(){int main(){
// 1 . Declare your circle vector

// 2 . Populate that vector with random circles (random position, random color)

// Now draw those circles
// 3 . while(window.isOpen()) loop

// 3.1 Clear the window

// 3.2 Draw your circles

// 3.3 Display the stuff

}


That point 3 it's basically the way to draw stuff acording SFML tutorials.






share|improve this answer





















  • That's what I did, except for number 3. I know the first SFML example has the shapes being drawn in the isOpen loop, but that's really stupid. Not only is it wrong, it's tricking new people into thinking it's okay. If you make it clear, draw, and display inside the loop, it'll draw the shape(s) as many times as it can in the shortest amount of time. Running the example, which just draws a low res circle, caused the program to suck up 30% of my CPU usage. Moving the draw out of the loop or adding a pause lowered that to 0%.
    – Anoraki
    Nov 21 at 3:52










  • Oh, and I'm not generating the circles and drawing them at the same time. I'm generating them once, and then drawing them once after they're all generated. Not trying to be rude, but you shouldn't be trying to answer if you don't know SFML.
    – Anoraki
    Nov 21 at 3:55






  • 1




    @Anoraki If you don't clear-draw-display each time you won't be able to draw moving stuff. If you (i'm not sure if that's your case) want to move your circles, you'll be forced to clear and redraw each time.
    – alseether
    Nov 21 at 7:13













up vote
0
down vote










up vote
0
down vote









I explain further my comments, but I'm not going to post any repaired code. I only suggest a way of doing things.



By the structure of you're code, it seems you're trying to generate some blue or red circles randomly distributed over the window, but, at the same time, you're trying to draw them.



You should differentiate you actual data from you're drawing stuff. My suggested pseude-code would be.



int main(){int main(){
// 1 . Declare your circle vector

// 2 . Populate that vector with random circles (random position, random color)

// Now draw those circles
// 3 . while(window.isOpen()) loop

// 3.1 Clear the window

// 3.2 Draw your circles

// 3.3 Display the stuff

}


That point 3 it's basically the way to draw stuff acording SFML tutorials.






share|improve this answer












I explain further my comments, but I'm not going to post any repaired code. I only suggest a way of doing things.



By the structure of you're code, it seems you're trying to generate some blue or red circles randomly distributed over the window, but, at the same time, you're trying to draw them.



You should differentiate you actual data from you're drawing stuff. My suggested pseude-code would be.



int main(){int main(){
// 1 . Declare your circle vector

// 2 . Populate that vector with random circles (random position, random color)

// Now draw those circles
// 3 . while(window.isOpen()) loop

// 3.1 Clear the window

// 3.2 Draw your circles

// 3.3 Display the stuff

}


That point 3 it's basically the way to draw stuff acording SFML tutorials.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 at 11:03









alseether

1,28411329




1,28411329












  • That's what I did, except for number 3. I know the first SFML example has the shapes being drawn in the isOpen loop, but that's really stupid. Not only is it wrong, it's tricking new people into thinking it's okay. If you make it clear, draw, and display inside the loop, it'll draw the shape(s) as many times as it can in the shortest amount of time. Running the example, which just draws a low res circle, caused the program to suck up 30% of my CPU usage. Moving the draw out of the loop or adding a pause lowered that to 0%.
    – Anoraki
    Nov 21 at 3:52










  • Oh, and I'm not generating the circles and drawing them at the same time. I'm generating them once, and then drawing them once after they're all generated. Not trying to be rude, but you shouldn't be trying to answer if you don't know SFML.
    – Anoraki
    Nov 21 at 3:55






  • 1




    @Anoraki If you don't clear-draw-display each time you won't be able to draw moving stuff. If you (i'm not sure if that's your case) want to move your circles, you'll be forced to clear and redraw each time.
    – alseether
    Nov 21 at 7:13


















  • That's what I did, except for number 3. I know the first SFML example has the shapes being drawn in the isOpen loop, but that's really stupid. Not only is it wrong, it's tricking new people into thinking it's okay. If you make it clear, draw, and display inside the loop, it'll draw the shape(s) as many times as it can in the shortest amount of time. Running the example, which just draws a low res circle, caused the program to suck up 30% of my CPU usage. Moving the draw out of the loop or adding a pause lowered that to 0%.
    – Anoraki
    Nov 21 at 3:52










  • Oh, and I'm not generating the circles and drawing them at the same time. I'm generating them once, and then drawing them once after they're all generated. Not trying to be rude, but you shouldn't be trying to answer if you don't know SFML.
    – Anoraki
    Nov 21 at 3:55






  • 1




    @Anoraki If you don't clear-draw-display each time you won't be able to draw moving stuff. If you (i'm not sure if that's your case) want to move your circles, you'll be forced to clear and redraw each time.
    – alseether
    Nov 21 at 7:13
















That's what I did, except for number 3. I know the first SFML example has the shapes being drawn in the isOpen loop, but that's really stupid. Not only is it wrong, it's tricking new people into thinking it's okay. If you make it clear, draw, and display inside the loop, it'll draw the shape(s) as many times as it can in the shortest amount of time. Running the example, which just draws a low res circle, caused the program to suck up 30% of my CPU usage. Moving the draw out of the loop or adding a pause lowered that to 0%.
– Anoraki
Nov 21 at 3:52




That's what I did, except for number 3. I know the first SFML example has the shapes being drawn in the isOpen loop, but that's really stupid. Not only is it wrong, it's tricking new people into thinking it's okay. If you make it clear, draw, and display inside the loop, it'll draw the shape(s) as many times as it can in the shortest amount of time. Running the example, which just draws a low res circle, caused the program to suck up 30% of my CPU usage. Moving the draw out of the loop or adding a pause lowered that to 0%.
– Anoraki
Nov 21 at 3:52












Oh, and I'm not generating the circles and drawing them at the same time. I'm generating them once, and then drawing them once after they're all generated. Not trying to be rude, but you shouldn't be trying to answer if you don't know SFML.
– Anoraki
Nov 21 at 3:55




Oh, and I'm not generating the circles and drawing them at the same time. I'm generating them once, and then drawing them once after they're all generated. Not trying to be rude, but you shouldn't be trying to answer if you don't know SFML.
– Anoraki
Nov 21 at 3:55




1




1




@Anoraki If you don't clear-draw-display each time you won't be able to draw moving stuff. If you (i'm not sure if that's your case) want to move your circles, you'll be forced to clear and redraw each time.
– alseether
Nov 21 at 7:13




@Anoraki If you don't clear-draw-display each time you won't be able to draw moving stuff. If you (i'm not sure if that's your case) want to move your circles, you'll be forced to clear and redraw each time.
– alseether
Nov 21 at 7:13


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387027%2fmissing-closing-brace-in-sfml-program%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python