Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <SFML\Graphics.hpp>
- using namespace std;
- int main()
- {
- sf::RenderWindow Okno( sf::VideoMode( 800, 600, 32 ), "sss" );
- const sf::Input & sterowanie = Okno.GetInput();
- Okno.SetFramerateLimit(60);
- sf::Shape Red = sf::Shape::Rectangle(0,0,40,40,sf::Color::Red,1,sf::Color::Black);
- sf::Shape White = sf::Shape::Rectangle(0,0,40,40,sf::Color::White,1,sf::Color::Black);
- sf::Vector2f Center(400, 300);
- sf::Vector2f HalfSize(400, 300);
- sf::View Obraz(Center,HalfSize);
- Okno.SetView(Obraz);
- const sf::Input & mysz = Okno.GetInput();
- bool Color[20][15] = {0};
- string czesc;
- while(Okno.IsOpened())
- {
- sf::Event Event;
- while(Okno.GetEvent(Event))
- {
- if(Event.Type == sf::Event::MouseButtonPressed && Event.MouseButton.Button == sf::Mouse::Left)
- Color[((int)(mysz.GetMouseX()/40))][((int)(mysz.GetMouseY()/40))] = 1;
- if(Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Right)
- Obraz.Move(40,0);
- }
- Okno.Clear(sf::Color::Green);
- for(int x = 0 ; x < 20 ; x++)
- {
- for(int y = 0 ; y < 15 ; y++)
- {
- if(Color[x][y] == 0)
- {
- White.SetPosition(x*40,y*40);
- Okno.Draw(White);
- }
- else
- {
- Red.SetPosition(x*40,y*40);
- Okno.Draw(Red);
- }
- }
- }
- Okno.Display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement