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

Pages: [1]
1
Graphics / Re: SFML 2.0 Drawing random colored shape
« on: October 12, 2013, 04:27:58 pm »
I just removed system("pause"), and it works fine.

2
Graphics / Re: SFML 2.0 Drawing random colored shape
« on: October 12, 2013, 03:17:56 pm »
No, it doesn't work:( And i have latest version of videodriver (Intel HD 3000).

3
Graphics / Re: SFML 2.0 Drawing random colored shape
« on: October 10, 2013, 05:25:48 pm »
I have SFML 2.1 now. But it still not working.

4
Graphics / Re: SFML 2.0 Drawing random colored shape
« on: October 10, 2013, 05:19:44 pm »
Shit, it doesn't work :-( I will try to update my SFML.

5
Graphics / Re: SFML 2.0 Drawing random colored shape
« on: October 10, 2013, 05:06:13 pm »

rand() works.

6
Graphics / Re: SFML 2.0 Drawing random colored shape
« on: October 10, 2013, 04:32:05 pm »
i don't see anything wrong so far...

colorArray is an array that you predefined with some sf::Colors, right?
try changing its line to
 block.setFillColor(sf::Color::White);
and let's see if it works.
I've tried it before, and i learned that if i use sf::Color (nor from colorArray), it works. :o

7
Graphics / Re: SFML 2.0 Drawing random colored shape
« on: October 10, 2013, 04:17:48 pm »
My main():
int main()
{
        srand(time(NULL));
        RenderWindow window(VideoMode(Rows*16, Cols*16), "Blocks");
        RectangleShape block(Vector2f(16, 16));
        block.setFillColor(colorArray[rand()%5]);
        while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

       window.clear();
           block.setPosition(0, 0);
           window.draw(block);
       window.display();
    }
    system("pause");
    return 0;

}
In my first post of this topic i gave only key actions (without loop and events). This is full code of main();

8
Graphics / Re: SFML 2.0 Drawing random colored shape
« on: October 10, 2013, 04:10:30 pm »
Make sure you have a window.display() in your loop.
Yes, i have.

9
Graphics / Re: SFML 2.0 Drawing random colored shape
« on: October 10, 2013, 03:51:44 pm »
Hmm... Probably i am wrong, but i don't see the incomplete parts. Can you show me it, please?

10
Graphics / SFML 2.0 Drawing random colored shape
« on: October 10, 2013, 03:24:51 pm »
Hi all! I' m trying to realize drawing random colored shape with SFML 2.0. But i have a problem - shape is not dispalyed.
Code:
//array of colors for random selecting
const sf::Color colorArray[5]={sf::Color::Cyan, sf::Color::Blue, sf::Color::Green, sf::Color::Red, sf::Color::Yellow };
srand(time(NULL));
RenderWindow window(VideoMode(Rows*10, Cols*10), "Blocks");
RectangleShape block(Vector2f(10, 10));
block.setFillColor(colorArray[rand()%5]);
block.setPosition(0, 0);
window.draw(block);
I have a black screen only. What i am doing wrong?
Thanks.

Pages: [1]
anything