Scripts / resolution

Author
Message
Big Dog Game Studios
11
Years of Service
User Offline
Joined: 18th Jun 2012
Location: Port Angeles, WA
Posted: 6th Mar 2015 02:15 Edited at: 6th Mar 2015 22:53
Hey all,

Looking to find the commands to determine the resolution of the screen. I looked in Global and couldn't find it. I am trying to center a picture in the middle of the screen, which changes due to resolution size. Any help would be appreciated.
MooKai
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 22nd Jul 2009
Location: World
Posted: 6th Mar 2015 07:59
I guess the engine is using the desktop res. , so if you're using full HD, the game should run in full HD.
You can find a entry in the setup.ini (or was it the visual.ini?). Height=1 width=1, so I guess the engine scale up to desktop res. there is also an option for full screen, which is by default at 0 (off) .
Old school FPS fan, DOOM !!!! Waiting for the zombies
PM
Big Dog Game Studios
11
Years of Service
User Offline
Joined: 18th Jun 2012
Location: Port Angeles, WA
Posted: 6th Mar 2015 14:29 Edited at: 6th Mar 2015 22:53
Sorry, I should have been more specific lol. I am not looking for MY resolution. I would like to know if anyone has the formula to calculate the player's resolution. I need to display something in my levels in the center of the player's screen. Not knowing what each individual player has as resolution makes this hard unless I can have my script calculate the resolution each time it is run for each player.
So, in essence, I need a formula that works in Lua that calculates the X and Y on the screen via script. I looked in global, and found the following commands:

SetImagePosition(x,y)
ShowImage(i)
SetImageAlignment(I)

Now, I am aware of how to use them, I just need help with the calculation (Mainly because I suck at math lol) because there is no command for "get screen resolution". If there was, I would write something similar to:

function resolution_init()
end

X = GetScreenResolutionX
Y = GetScreenResolutionY

function resolution_main()
CenterX = X / 50
CenterY = Y / 50

SetImagePosition(CenterX, CenterY)
ShowImage(Image)
end

Just an example, but hopefully that explains more about what I am looking for.
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 6th Mar 2015 15:21
I thought SetImagePosition(x,y) places image by % therefore SetImagePosition(50,50) would be dead centre. As long as you have your SetImageAlignment(I)
set to 0 the centre of your image should be placed centre of the screen?
Big Dog Game Studios
11
Years of Service
User Offline
Joined: 18th Jun 2012
Location: Port Angeles, WA
Posted: 6th Mar 2015 16:22 Edited at: 6th Mar 2015 22:53
@cybernescence You sir, are a boss. That worked perfectly. I thought it was asking for specific coordinates, not percentages. Thank you
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Mar 2015 20:23
yep it's percentage already, the only issue is image size doesnt scale so on smaller screens it'll take up more space than intended
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Login to post a reply

Server time is: 2024-05-20 03:36:25
Your offset time is: 2024-05-20 03:36:25