Jump to content

[TUT] How to make Advanced Gui Windows


Cyandie

Recommended Posts

Posted (edited)

Okay so this is a short tutorial but I will show you how to get your GUI's screen resolution's first you should

add something like this to your code

local screenX, screenY = guiGetScreenSize() 
local width, height = 200, 450 
local x = (screenX/2) - (width/2) 
local y = (screenY/2) - (height/2) 

the GUi Window would be like this

SampleWindow = guiCreateWindow(x, y, width, height, "Hello World", false) 

Whe you have a gui window like this

guiCreateWindow(15,125,129,17, "Hello World", false) 

you put the last two numbers at 'local width, height such as you put a new line in like this

local width, height = 129, 17

and when you do something like

guiCreateWindow(x, y, width, height, "Test Command", false)

you'll get it working for all screen res's.

Here is my Example Advanced Window GUI

http://imgur.com/o7Dzd

Edited by Guest
Posted

Updated - Fixed the 'local screenX, screenY = guiGetScreenSize()' Problem sorry I forgot about it but now it's there enjoy people.

  • 2 months later...
Posted
What adanced is in this tutorial?

can you atleast thank him for helping? or do you have to criticize every scripting topic?

He is right, I don't see anything advanced here but still good job he did.

Posted
Should teach people not to use variables if they're only ever going to use them once.

I dont agree with you. It teachs how to make gui for every resolution.

Posted
Should teach people not to use variables if they're only ever going to use them once.

I dont agree with you. It teachs how to make gui for every resolution.

Callum is right. It's not needed to use variables when you are going to use them one time only.

Posted

I wrote about tutorial, not - why we "Should teach people not to use variables if they're only ever going to use them once.".

Also i will tell you what I think about your opinion because I totally dont agree with you. Why? Because variables are mutch clear.

Example from my code:

  
local speedometer = {} 
speedometer.active = false 
--MTA Fixer 
speedometer.fWidth = 512  
speedometer.fHeight = 512 
--Real 
speedometer.rWidth = 290 
speedometer.rHeight = 289  
speedometer.distFromScreen = 10 
speedometer.x = screenX - speedometer.distFromScreen - speedometer.fWidth + ( speedometer.fWidth - speedometer.rWidth )/2 
speedometer.y = screenY - speedometer.distFromScreen - speedometer.fHeight + ( speedometer.fHeight - speedometer.rHeight )/2 
  

Next we just use:

  
dxDrawImage(speedometer.x,speedometer.y,speedometer.fWidth,speedometer.fHeight,"images/speedometer/background.png", 0, 0, 0, tocolor(255, 255, 255, galpha), true) 
             
  

etc.

Posted
I wrote about tutorial, not - why we "Should teach people not to use variables if they're only ever going to use them once.".

Also i will tell you what I think about your opinion because I totally dont agree with you. Why? Because variables are mutch clear.

Example from my code:

  
local speedometer = {} 
speedometer.active = false 
--MTA Fixer 
speedometer.fWidth = 512  
speedometer.fHeight = 512 
--Real 
speedometer.rWidth = 290 
speedometer.rHeight = 289  
speedometer.distFromScreen = 10 
speedometer.x = screenX - speedometer.distFromScreen - speedometer.fWidth + ( speedometer.fWidth - speedometer.rWidth )/2 
speedometer.y = screenY - speedometer.distFromScreen - speedometer.fHeight + ( speedometer.fHeight - speedometer.rHeight )/2 
  

Next we just use:

  
dxDrawImage(speedometer.x,speedometer.y,speedometer.fWidth,speedometer.fHeight,"images/speedometer/background.png", 0, 0, 0, tocolor(255, 255, 255, galpha), true) 
             
  

etc.

You didn't understand. Why will you save a variable in the memory which you will only use ONCE? It has nothing to do with being clear. Anyway, this is over.

  • Recently Browsing   0 members

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