From 1db565eb138e33daa0ac3dcf33cf00773969712a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nils=20Forss=C3=A9n?= Date: Thu, 9 Nov 2023 15:12:29 +0100 Subject: [PATCH] Finally fixed scale constants --- src/Object.cc | 0 src/_main.cc | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 src/Object.cc diff --git a/src/Object.cc b/src/Object.cc deleted file mode 100644 index e69de29..0000000 diff --git a/src/_main.cc b/src/_main.cc index b77518e..47a5903 100644 --- a/src/_main.cc +++ b/src/_main.cc @@ -6,33 +6,33 @@ #include // includes most things in SFML -using namespace sf; +const unsigned int S_WIDTH {1280}; +const unsigned int S_HEIGHT {720}; -static const int s_width {1280}; -static const int s_height {720}; - -static const int scale_koeff {s_width / 1920}; +const double S_SCALE_KOEFF {s_width / 1920.0}; int main () { - RenderWindow window{ - VideoMode{s_width, s_height}, + sf::RenderWindow window{ + sf::VideoMode{S_WIDTH, S_HEIGHT}, "DespYrat" }; - Texture t; + + sf::Texture t; t.loadFromFile("assets/hel_bakgrund.png"); - Sprite s(t); - s.setScale(0.6666667, 0.6666667); + sf::Sprite s(t); + + s.setScale(S_SCALE_KOEFF, S_SCALE_KOEFF); while (window.isOpen()) { /* hantera events */ - Event event; + sf::Event event; // hämta ett event i taget while (window.pollEvent(event)) { - if (event.type == Event::Closed) + if (event.type == sf::Event::Closed) { window.close(); } -- 2.30.2