image scale & screen res

Blitz3D Forums/Blitz3D Beginners Area/image scale & screen res

ZT(Posted 2004) [#1]
Any recommendations on the best way to handle different screen resolutions?

I have created some intro/option screens with a graphical background and text created with drawimage.

The problem arises when the user changes the screen resolution.

The options are:
1. leave background same size but centered - easy, but looks crap.
2. resize background (which adds a delay)
3. load in another pre-resized background = delay and need to create multiple background images)

Then there is the text (as images), similar problem to background. At each screen resolution, I need realign the positioning including the position of each letter in a word so that they remain the correct distance apart.

And I need to scale each letter (as an image) or use a different set of images.

Is there a better way than this, or do most people just keep start/intro screens to a single resolution to save hassle?


TomToad(Posted 2004) [#2]
Most games seem to have start screens set at a default resolution, then switch to the chosen resolution for actual game play. Another idea would be to make your start/intro screen from a certain perspective of your game, then render that onto the screen. For instance, in a helicopter simulator, you might position the helicopter on the landing pad, position the camera aimed at the helicopter, then render the scene at the chosen resolution. Doesn't help for the text, though, but if the text is minimal, you might make one large bitmap with the text at different sizes then use DrawImageRect to write the proper sized text.


ZT(Posted 2004) [#3]
I wanted the ability for the game to be played in any resolution from 640 to 1600 AND also to be be played in window or fullscreen mode as it's a puzzle type game. Is this reasonable?

I did initially think of having all the intro/config screens in a 640 window, and then I only have to alter the game to fit the res. I'd still like all the intro screens to match in with the main game res though, i.e. you change the res once, and everything then matches.

Is there a problem with loading all the images AND scaling them when the game resolution is first initialised, and keeping them in memory all the time the game is running, (e.g. lower computers run out of memory, or run slower)? That would mean only one initial delay and after that, all the graphics would appear at the right resolution?

I did also try loadbuffer to load a background image (as it automatically scales), but could not get it to work in double-buffer mode with an image for a a mouse-pointer. The pointer always flickered.

Any pointers as to the most accepted option welcome...


Ross C(Posted 2004) [#4]
Well, i wouldn't bother going to high-res for 2d stuff, done with images. Playing a 2D games at that resolution means, that that will be the resolution for all the graphics, as there's no point in really scaling the images and stuff upwards. Draw back to that is of course, downscaling the images. Downscaling using blitz scaleimage command gives pretty poor results i think, and it's pretty slow.

I would really maybe choose 2 different resolutions. My 2 cents anyway :o) And good luck!


WolRon(Posted 2004) [#5]
Use 3D and then you don't have to scale it at all.


ZT(Posted 2004) [#6]
thanks for the suggestions.

The game is actually in 3D, so that will scale fine. Its just the intro screen that have the problem.

I could use 3D for the intro screens, but that seems a massive overkill. The drawimage functions etc seem to ignore tha camera, so I'd have to use sprites or entities for everything, including text, in order for them to be automatically scaled?

Never had this problem on the C64!! LOL


Rob Farley(Posted 2004) [#7]
Drawimage and drawblock are 2D commands, hence the camera ignoring them.

If it's just a flash screen or menu screens I'd stick with 2D. In my latest project I've got a menugfx folder that contains 640480, 800600, 1024768 and 16001024 folders these hold different versions of the graphics for each of the resolutions. Then you position everything by fractions of the screen rather than pixels.

So you store a bunch of variables like x8th x16th (where x16th would be graphicswidth/16) etc so you can just position your stuff x16th in from the left so regardless of what the res is the text will still be in the same place.


WolRon(Posted 2004) [#8]
Just Drawimage or Drawblock to a sprite and then just position the sprite in front of the camera. You can even use transparency. No need to scale anything.


ZT(Posted 2004) [#9]
How do you drawimage to a sprite? I can only seem to drawimage to an image buffer.

Now if I could drawimagerect to a sprite, that would be ideal.


Rob Farley(Posted 2004) [#10]
Wolron is talking out of his arse ZT.

If you're using a 3D sprite the texture will resize itself to a power of 2 depending on your vid card so will blur and generally go pear shaped.

You can drawimage/block to an imagebuffer then copyrect to a texture however.


ZT(Posted 2004) [#11]
Can't seem to copyrect to a texture,

tex = LoadTexture( "images/10296.png" )
aa=CreateSprite()
EntityTexture aa,tex

DrawImageRect font1,100,100,0,0,50,50
CopyRect 100,100,50,50,100,100,BackBuffer(),tex

this says can't find buffer, i.e. tex


or did you mean something else?


Stevie G(Posted 2004) [#12]
You need to use .. Backbuffer(), TextureBuffer(tex) - tex is only a pointer to the texture not the buffer.

Stevie


ZT(Posted 2004) [#13]
thanks guys.

Wasn't aware that I could drawimagerect to a texture, which is great, cos I think that will solve my problem.