From: Nils Forssén Date: Thu, 9 Nov 2023 14:12:29 +0000 (+0100) Subject: Finally fixed scale constants X-Git-Url: https://gitweb.forssennils.se/?a=commitdiff_plain;h=1db565eb138e33daa0ac3dcf33cf00773969712a;p=TDDC76_proj.git Finally fixed scale constants --- 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(); }