Jump to content

Question


FuriouZ

Recommended Posts

Hello all!

I have question about resolution,that is here some easyer way to fix something eg: gui

i have a gui

GUIEditor.staticimage[1] = guiCreateStaticImage(0, 0, 800, 600, "img/backround.png", false) 

All buttons,labels etc are on image.

Default resolution is 800x600,but i need that it is in same position in all resolutions

i know that i can do it with

local x, y = guiGetScreenSize() 

800/800 = 1 
600/600 = 1 

But then i have to do it with all buttons etc and it is only waste of time ... so i ask,that is here some easyer way to fix gui position on all resolutions ?

Link to comment

Well,i created a fast gui..

GUIEditor = { 
    button = {}, 
    window = {}, 
    memo = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(547, 85, 249, 381, "TEST", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        GUIEditor.memo[1] = guiCreateMemo(10, 24, 229, 320, "Just testing gui......", false, GUIEditor.window[1]) 
        GUIEditor.button[1] = guiCreateButton(74, 344, 101, 27, "Close", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")     
    end 
) 

I need that i doesn't have to calculate all gui elements in

local x, y = guiGetScreenSize() 

Is it possible that i only calculate window and other elements on it changing automally or something.... ??

I say again i don't have good english.

Link to comment

What Pres is saying is that while you have the GUI Editor open, you'll need to right-click each GUI Element such as a Window or Button and change it from Absolute to Relative. And then output your code and copy that.

You'll see it uses a scale from 0-1 related to the parent element(I think) instead of X and Y co-ordinates.

Link to comment

What #Mr.Pres[T]ege want to tell you is to check the arg of your functions like :

guiCreateWindow, guiCreateMemo and guiCreateButton .

there is an argument called ' relative ' , like this one

guiCreateWindow ( float x, float y, float width, float height, string titleBarText, bool relative ) 

Required Arguments:

* x: A float of the 2D x position of the GUI window on a player's screen. This is affected by the relative argument.

* y: A float of the 2D y position of the GUI window on a player's screen. This is affected by the relative argument.

* width: A float of the width of the GUI window. This is affected by the relative argument.

* height: A float of the height of the GUI window. This is affected by the relative argument.

* titleBarText: A string of the text that will be displayed in the title bar of the window.

* relative: This is whether sizes and positioning are relative. If this is true, then all x,y,width,height floats must be between 0 and 1, representing sizes/positions as a fraction of the screen size. If false, then the size and co-ordinates are based on client's resolution, accessible using guiGetScreenSize.

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