Why doesn't my SFML program work?
Nov 16, 2011 at 9:22pm UTC
I'm trying to make a program that draws d circles onto the screen randomly with random color, radius, etc. All it does is glitch up when I try it, help please! I'm using Code::blocks with minGW and SFML 1.6.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#include <SFML/Graphics.hpp>
#include <iostream>
#include <stdlib.h>
#include<time.h>
using namespace std;
int main()
{
srand(time(NULL));
int d = 0;
bool fff = false ;
float vars[10];
cin >> d;
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics" );
while (App.IsOpened())
{
sf:: Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
{
App.Close();
}
}
for (int i = 0; i < d && !fff; i++)
{
vars[0] = rand( ) % 800 + 1;
vars[1] = rand( ) % 600 + 1;
vars[2] = rand( ) % 20 + 1;
vars[3] = rand( ) % 255 + 1;
vars[4] = rand( ) % 255 + 1;
vars[5] = rand( ) % 255 + 1;
vars[6] = rand( ) % 10 + 1;
vars[7] = rand( ) % 255 + 1;
vars[8] = rand( ) % 255 + 1;
vars[9] = rand( ) % 255 + 1;
App.Draw(sf::Shape::Circle(vars[0], vars[1], vars[2], sf::Color(vars[3], vars[4], vars[5]), vars[6], sf::Color(vars[7], vars[8], vars[9])));
}
fff = true ;
App.Display();
//App.Clear();
}
return EXIT_SUCCESS;
}
Topic archived. No new replies allowed.