DjSt3rios Posted July 22, 2011 Share Posted July 22, 2011 Hello, I have a problem.. I have 1440 x 900 resolution, and i made an image appear down-left on the screen... but a friend has 1024 x 768 resolutios and he cant see it. Can i make somehow read the resolution and if its lower, draw the image higher? thanks. Link to comment
Uisaqin Posted July 22, 2011 Share Posted July 22, 2011 u can make the image display on any resolution if u use floats between 0 and 1 (relative positioning) -- image settings local ImageX = 0.45 local ImageY = 0.8 local ImageWidth = 0.5 local ImageHeight = 0.5 -- calculate pixel positions local ScreenWidth, ScreenHeight = guiGetScreenSize() ImageX = ScreenWidth * ImageX ImageY = ScreenHeight * ImageY ImageWidth = ScreenWidth * ImageWidth ImageHeight = ScreenHeight * ImageHeight Link to comment
bandi94 Posted July 22, 2011 Share Posted July 22, 2011 use screenWidth,screenHeight = guiGetScreenSize() and then screenWidth and screenHeight +/- to put your image where you want TY DjSt3rios Link to comment
DjSt3rios Posted July 22, 2011 Author Share Posted July 22, 2011 u can make the image display on any resolution if u use floats between 0 and 1 (relative positioning) -- image settings local ImageX = 0.45 local ImageY = 0.8 local ImageWidth = 0.5 local ImageHeight = 0.5 -- calculate pixel positions local ScreenWidth, ScreenHeight = guiGetScreenSize() ImageX = ScreenWidth * ImageX ImageY = ScreenHeight * ImageY ImageWidth = ScreenWidth * ImageWidth ImageHeight = ScreenHeight * ImageHeight I tried that, but the image becomes too big.. any other idea? Link to comment
Uisaqin Posted July 22, 2011 Share Posted July 22, 2011 find the width and height in pixels the image looks good at on your resolution eg. 200 x 250 then do 200 / 1440 = 0.139 and 250 / 900 = 0.278 then just update the floats local ImageWidth = 0.139 local ImageHeight = 0.278 Link to comment
DjSt3rios Posted July 22, 2011 Author Share Posted July 22, 2011 How should i find the pixels the image looks on my resolution or do u mean to resize it as its big? Link to comment
Uisaqin Posted July 22, 2011 Share Posted July 22, 2011 display the image on your screen using the width and height of the image file, if it displays too big then yeah keep making the image smaller until it looks good Link to comment
DjSt3rios Posted July 22, 2011 Author Share Posted July 22, 2011 hmm.. im trying, actually now i got a problem with a text mostly... I made it like that: local screenWidth, screenHeight = guiGetScreenSize() local x1,y1,x2,y2 = screenWidth*0.0,screenHeight*0.88,screenWidth*0.8,screenHeight*0.8 But it appears in the middle and a lil bit left. But i want to make it More to left, and i have to make it like: local x1,y1,x2,y2 = screenWidth*0.0-700 The thing is if i put -700 it wont work properly with other resolution Link to comment
Uisaqin Posted July 22, 2011 Share Posted July 22, 2011 if its at screenWidth - 700 pixels on your screen, thats 1440 - 700 = 740 pixels from the left. or relative: 740 / 1440 = 0.51388888888888888888888888888889 so this should make it look the same on any resolution local x1 = screenWidth*0.5139 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now