Commit 591ed0b9 authored by Jonas Johan Solsvik's avatar Jonas Johan Solsvik 🎮
Browse files

Open window, center camera, and draw circle

parent 59d3b173
#include <cstdio>
int main() {
std::puts("Hello cube!\n");
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
int main()
{
// # Create the main window and camera
sf::RenderWindow window(sf::VideoMode(800, 600), "Double trouble");
window.setFramerateLimit(90);
sf::View camera(sf::FloatRect(0, 0, 800, 600));
camera.setCenter(0, 0);
window.setView(camera);
// # Create things
sf::CircleShape circle;
circle.setPosition(0, 0);
circle.setRadius(10);
circle.setFillColor(sf::Color::Red);
while (window.isOpen())
{
// # Process events
sf::Event event;
while (window.pollEvent(event))
{
// ## Close window on exit
if (event.type == sf::Event::Closed ||
event.type == sf::Event::KeyPressed &&
event.key.code == sf::Keyboard::Escape)
{
window.close();
}
}
// # Render video
window.clear();
window.draw(circle);
window.display();
}
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment