Created
October 27, 2019 13:21
-
-
Save EugenyB/ff6413a5909e72337a2036519a3e925a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SFML/Graphics.hpp> | |
#include <cmath> | |
int main() | |
{ | |
sf::RenderWindow window(sf::VideoMode(400, 400), "SFML works!"); | |
sf::CircleShape shape(100.f); | |
shape.setFillColor(sf::Color::Green); | |
sf::Vertex line[2]; | |
line[0].position = sf::Vector2f(0, 0); | |
line[0].color = sf::Color::Red; | |
line[1].position = sf::Vector2f(200, 200); | |
line[1].color = sf::Color::Red; | |
sf::ConvexShape convex(4); | |
convex.setPoint(0, sf::Vector2f(-50,-50)); | |
convex.setPoint(1, sf::Vector2f(-50,50)); | |
convex.setPoint(2, sf::Vector2f(50,50)); | |
convex.setPoint(3, sf::Vector2f(50,-50)); | |
convex.setOutlineColor(sf::Color::Yellow); | |
convex.setOutlineThickness(10); | |
convex.setFillColor(sf::Color::Transparent); | |
float ten = acos(0)/9; | |
sf::Transform t3(cos(ten), sin(ten), 0.f, | |
-sin(ten), cos(ten), 0.f, | |
0.f, 0.f, 1.f); | |
sf::Transform t0( | |
1,0,100, | |
0,1,100, | |
0,0,1); | |
while (window.isOpen()) | |
{ | |
sf::Event event; | |
while (window.pollEvent(event)) | |
{ | |
if (event.type == sf::Event::Closed) | |
window.close(); | |
if (event.type == sf::Event::KeyPressed) { | |
if (event.key.code == sf::Keyboard::Escape) //key | |
window.close(); | |
if (event.key.code == sf::Keyboard::R) { | |
t0 *= t3; | |
} | |
} | |
} | |
window.clear(); | |
// window.draw(shape); | |
// window.draw(line, 2, sf::Lines); | |
window.draw(convex,t0); | |
window.display(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment