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

Author Topic: What image resolution to fit on 1024x768 screen?  (Read 4498 times)

0 Members and 1 Guest are viewing this topic.

Raptor88

  • Full Member
  • ***
  • Posts: 111
    • View Profile
    • Email
What image resolution to fit on 1024x768 screen?
« on: October 10, 2012, 10:04:09 pm »
What resolution should a .png image in a SFML frame be, to fit on a 1024x768 screen at maximum size, allowing for the Windows taskbar at the bottom? 

To clarify, when the user's screen is 1024x768, I want the SFML window frame to fit from the top of the screen to just above the Windows taskbar.  The width of the frame can be smaller than 1024 pixels to retain the 4:3 aspect ratio of the image.  After the user sees the image, he/she can then continue in that mode or select Fullscreen mode.  Now the 4:3 aspect image should fit full screen.

I don't have a 1024x768 screen to test this on so I hope someone who knows will respond.

BTW, is there a chart of different image resolutions to fit on different screen sizes like 1024x768, 1280x800, 1440x900, etc., when the image is enclosed in a SFML window frame allowing for the Windows taskbar?

Thanks,
Raptor


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: What image resolution to fit on 1024x768 screen?
« Reply #1 on: October 10, 2012, 10:11:26 pm »
Well nobody can say that, because there's no standard for that. ;)
I'm using Windows 8 and have big icons and stuff (like in Win7) but obviously I could just change it to the old smaller style which would more look like XP and even with Windows XP you get the new and the old style. I haven't even mentioned that possibilites to tune the taskbar or to move it to the top or left or right.
And what about other OSs? Every OS implements taskbars differently (if at all).

Conclusion: There's no way to say for sure. ;)

If you want to hard code values for different resolutions into your game you'll get quite some headaches. It's way better to change things dynamically and only relative to the current window size, so you don't have care what the user does (or at least you could force a minimum window size), but everything will get applied automatically. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Raptor88

  • Full Member
  • ***
  • Posts: 111
    • View Profile
    • Email
Re: What image resolution to fit on 1024x768 screen?
« Reply #2 on: October 10, 2012, 11:52:58 pm »
If you want to hard code values for different resolutions into your game you'll get quite some headaches. It's way better to change things dynamically and only relative to the current window size, so you don't have care what the user does (or at least you could force a minimum window size), but everything will get applied automatically. ;)

Wish I had your knowledge.  Which SFML commands should I use to change screen size dynamically?

If I use:
App.create(sf::VideoMode(1024, 768, 32), "My Title", !sf::Style::Resize | sf::Style::Close);
sf::Texture Table;
sf::Sprite spr_CrapTable;

if(!Table.loadFromFile("Images/Table1024x768.png"))
{
    return;
}

App.clear();   //Is this necessary?  Works without this line but good form to use it?
App.draw(spr_CrapTable);
App.display();
 

Would I use some sort of resize command to make the SFML window frame and CrapTable smaller prior to the draw and display commands?

If so, could you please tell me how to do the resize?  I've been searching "resize" and don't know if I need to use a view, or sprite scale, or what.

Thanks,
Raptor

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: What image resolution to fit on 1024x768 screen?
« Reply #3 on: October 11, 2012, 12:47:05 am »
I feel like we had that discussion now several times in the past... ::)

There are essentially two ways:
  • Use the sf::View to stretch and shrink everything for all resolutions to match your needs. This mainly needs the understanding of sf::View (see my tutorial on the wiki) and a bit of math combined with logic to make everything fit.
  • Instead of using the same texture for every possible resolution you use different sizes of the texture for different subsets of resolutions. This doesn't mean that you make a texture for every possible screen resolution but you much rather say for all the resolutions from x to y use texture1 and from y to z texture2 etc. With this you basically get a better quality for those resolution 'sets'. Additionally this step requires the knowledge from step 1.
Maybe I'll write a tutorial about this in the future but until then you'll have to figure out the math on your own, sorry. ;)

Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Raptor88

  • Full Member
  • ***
  • Posts: 111
    • View Profile
    • Email
Re: What image resolution to fit on 1024x768 screen?
« Reply #4 on: October 11, 2012, 02:29:43 am »
Hi eXpl0it3r,

I think I "might" have found the command I can use to resize the SFML window:


App.setSize(sf::Vector2u(width, height));
 

This resizes (stretches/shrinks) the crap table image and the SFML frame around the image.  I'll use your suggestion to use about 3 different size .png images to retain decent image quality to cover small to large screen sizes.

But I still don't know what the "maximum" size image to use so that the SFML window frame fits on a 1024x768 screen less the Windows taskbar at the bottom.  If anyone knows this, please let me know.

Thanks for always helping out,
Raptor
« Last Edit: October 11, 2012, 02:31:35 am by Raptor88 »

 

anything