Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Automatically resizing window with pictures to monitor resolution  (Read 2243 times)

0 Members and 1 Guest are viewing this topic.

DzieckoBezZycia

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hello!
I have a problem.

If I make windows (resolution 500x500) with one picture (500x500) i can resize it and picture resizes too. How can I make a window with resolution 1440x900 (resolution of my monitor), which is fullscreen. I want to send this program to another computer (with different resolution) and during making it fullscreen I want to make picture automatically resizes. How can I do it?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
Re: Automatically resizing window with pictures to monitor resolution
« Reply #1 on: December 09, 2013, 06:38:41 pm »
You can either scale the sprite itself to the window's size or manipulate the view. Since it's just one image, I suggest to scale the sprite itself. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

DzieckoBezZycia

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Automatically resizing window with pictures to monitor resolution
« Reply #2 on: December 10, 2013, 02:57:21 pm »
Yes, but if someone for example has monitor with resolution 1366x768 and someone else 800x600, how can i know what int must I write?

entity.setScale(4.0f, 1.6f);
entity.setScale(a, b);

Of course I can get resolution of screen with

sf::VideoMode vm = sf::VideoMode::getDesktopMode();
sf::RenderWindow window( vm, "Title" );

but it's maybe the hardest way.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Automatically resizing window with pictures to monitor resolution
« Reply #3 on: December 10, 2013, 03:01:15 pm »
Quote
Yes, but if someone for example has monitor with resolution 1366x768 and someone else 800x600, how can i know what int must I write?

It's not an int, it is a float and there is a difference ;)

Target Size / Initial Size = Scale
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor