SFML community forums

Help => General => Topic started by: Raptor88 on October 10, 2012, 10:04:09 pm

Title: What image resolution to fit on 1024x768 screen?
Post by: Raptor88 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

Title: Re: What image resolution to fit on 1024x768 screen?
Post by: eXpl0it3r 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. ;)
Title: Re: What image resolution to fit on 1024x768 screen?
Post by: Raptor88 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
Title: Re: What image resolution to fit on 1024x768 screen?
Post by: eXpl0it3r 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:
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. ;)

Title: Re: What image resolution to fit on 1024x768 screen?
Post by: Raptor88 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