Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Fit image across screen

Author
Message
General Jackson
User Banned
Posted: 30th Apr 2010 04:39
So i am making a fps, and I have a working sniper scope, BUT, the image (1000x1000 pixels), of course, does not stretch to fit the screen resolution. How would i go about doing that?

IE i want the scope image to fit the screen no matter what the resolution is.

Cheers,

GJ

General Jackson
User Banned
Posted: 30th Apr 2010 05:06 Edited at: 30th Apr 2010 05:06
Hockeykid helped me sort it.

A mod can lock this.

Lost Coder
16
Years of Service
User Offline
Joined: 6th Aug 2009
Location: Lost in Space.
Posted: 30th Apr 2010 13:45
I'm thinking that it mite be a good idea to post how it was fixed
as others (like me) can benifit from your post.

As I can use the information as I have the same issue...

Thx
Garion
18
Years of Service
User Offline
Joined: 7th Dec 2007
Location: Poland
Posted: 30th Apr 2010 15:30
use the size sprite and screen width, screen height commands?
General Jackson
User Banned
Posted: 1st May 2010 05:34
Ok, here you be:

Make it a sprite and use this code: size sprite 1,screen width(),screen height()

A r e n a s
18
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 2nd Jun 2010 14:16
This is one problem I could have helped with

When doing programs with sprites which have mutiple resolutions, its a good idea to get a percentage of the screen width and height, that way you don't run into problems if you use set values (the X of 1800 on a resolution of 1200 in its X, instead use 90% of 1902 X, and then it will look similar in layout on lower resolutions).

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Jun 2010 00:49
If you do use a sprite remember to scale both sprite dimensions by the same amount, and probably by a percentage as suggested by Arenas. If you scale using screen width and screen height, you're going to get a squashed scope.

budokaiman
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 24th Jun 2009
Playing: Hard to get
Posted: 4th Jun 2010 01:03 Edited at: 4th Jun 2010 15:49
Yes, I have all of my sprites setup in a function, that will scale them and position them correctly based on screen percentages. Here is the code, if you want:



Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Jun 2010 22:31
If this is in 3D, I'd lock a plane onto the screen and texture it with your image.


"Any sufficiently advanced technology is indistinguishable from magic" ~ Arthur C. Clarke
budokaiman
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 24th Jun 2009
Playing: Hard to get
Posted: 4th Jun 2010 22:52
I've noticed though, the alpha mapping for images isn't great when texturing plains.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 5th Jun 2010 01:40
Just have the scope in the centre and draw black boxes around the outside to fill up the screen...

Login to post a reply

Server time is: 2026-07-25 16:20:14
Your offset time is: 2026-07-25 16:20:14