Jump to content

Problem with Image on screen(Resolutions problem)


Recommended Posts

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

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
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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...