Jump to content

Problem with Image on screen(Resolutions problem)


Recommended Posts

Posted

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.

Posted

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 
  

Posted

use

screenWidth,screenHeight = guiGetScreenSize()

and then screenWidth and screenHeight +/- to put your image where you want

TY DjSt3rios

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

Posted

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 

Posted

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

Posted

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

Posted

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 

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