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 / Position font per screen resolution

Author
Message
locecode
User Offline
Joined: 11th Apr 2019
Location:
Posted: 21st Apr 2019 18:09
So I'm finding that positioning huds and font and images to the screen due to the screen size is the hardest thing to do.

So basically I'm thinking on saying something like

if screen x()=100 then imagex=200

but I'm lost on this issue

If there are any functions or help I would dearly appreciate it.
Xarcolt
12
Years of Service
User Offline
Joined: 29th Sep 2007
Location:
Posted: 17th May 2019 23:37
I too am also interested in knowing how that works. In the coming weeks I want to make my game scale properly in windowed and fullscreen modes because that stretching severely annoys me and probably anyone who would pay money to have bought said game . Granted when the time comes I'll pour over documentation and Google searches anyway but if there's a simple answer, I'll be eager to hear it
Derek Darkly
8
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 17th May 2019 23:47

It's all about percentages.
For example:

set text size screen width()*.02

Send your parents to noisy sprite demo hell... enter the D-Zone
Ortu
DBPro Master
11
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 18th May 2019 02:39 Edited at: 18th May 2019 02:41
this is old, but may give you some ideas

attached
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.

Attachments

Login to view attachments
Xarcolt
12
Years of Service
User Offline
Joined: 29th Sep 2007
Location:
Posted: 18th May 2019 03:17
I'll take a look after work and if nothing else try to make a Frankenstein's monster of a formula to scale a 640x480 workspace to any other resolution without stretching . Glad to hear everyone else is doing percentages though. I guess I can compare it to web development in my mind (since I try to make it not look weird on mobile .. But now it weirder on PC xD #noobyaf)
locecode
User Offline
Joined: 11th Apr 2019
Location:
Posted: 18th May 2019 03:38
Checking it out now, thanks.
locecode
User Offline
Joined: 11th Apr 2019
Location:
Posted: 18th May 2019 03:43
Ortu

What is .dbx?
locecode
User Offline
Joined: 11th Apr 2019
Location:
Posted: 18th May 2019 04:10 Edited at: 18th May 2019 04:34
Derek Darkly

Ok, i'm only going to offer 4 diffrent resolutions, so, how can I offer just the 4 to choose from.

This is the code i'm using to choose resolutions.

Ortu
DBPro Master
11
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 18th May 2019 15:48 Edited at: 18th May 2019 15:52
.dbx is just a regular .dba file that contains some custom preprocessor tokens

https://forum.thegamecreators.com/thread/220966

You can get the gist without knowing much about that though, the main thing for this thread would be the section for resolving flow properties and the update rendering

http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Raven
14
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 26th May 2019 22:44
Honestly the easiest approach is to build the UX / UI on a Dedicated Image Layer.
In this respect you can simply Render all of the Components to said Image at "Native" Resolution (which should be the "Maximum" Supported)
Then you just Scale the Image (0.1 to 1.0) depending on the actual Output Resolution.

Sure, it uses more Video Memory., but honestly the UI Elements will remain clear and sharp regardless of the Resolution; and it saves on producing Multiple Resolutions for each UI Element.
The only thing you really need to change in said situations (typically) is switching between Aspect Ratio Layouts; but other than that... you can have a single UI Routine, that outputs everything to said Image; that is then essentially a Single Sprite Drawn Last, scaled to the Screen.

Simple... arguably Lazy... but effective.

Login to post a reply

Server time is: 2019-10-17 15:29:02
Your offset time is: 2019-10-17 15:29:02