CapY Posted July 13, 2011 Posted July 13, 2011 How i can make my gui compatible on all resoulutions ? Here is the code: -- Created: 02/07/2011 09:45 addEventHandler("onClientResourceStart",resourceRoot, function() guiEditor_Memo = {} guiEditor_Label = {} guiEditor_Image = {} guiFgWelcomeWindow = guiCreateWindow(-2,3,1279,1023," R U L E S ! ",false) guiSetAlpha(guiFgWelcomeWindow,1) guiWindowSetMovable(guiFgWelcomeWindow,false) guiWindowSetSizable(guiFgWelcomeWindow,false) guiFgOkButton = guiCreateButton(564,943,172,59,"O K ! ",false,guiFgWelcomeWindow) showCursor( true ) guiSetAlpha(guiFgOkButton,1) guiSetFont(guiFgOkButton,"clear-normal") guiFgImage = guiCreateStaticImage(9,21,1261,333,"Logo.png",false,guiFgWelcomeWindow) guiEditor_Label[1] = guiCreateLabel(8,355,1271,570,"",false,guiFgWelcomeWindow) guiSetAlpha(guiEditor_Label[1],1) guiLabelSetColor(guiEditor_Label[1],0, 155 ,155) guiSetFont(guiEditor_Label[1],"clear-normal") guiEditor_Memo[1] = guiCreateMemo(2,5,1265,565," Welcome To [FG]Clan 24/7 Croatian Playground Freeroam \n\n\n\nPress F9 for any HELP or Commands. \n\n**********************************************************************************************************************************************************************************\nFreeroam Rules:\n \n\n*DO NOT ADVERTISE !\n\n*DO NOT SPAM THE CHAT !\n\n*DO NOT SPAM VEHICLES ! \n\n*DO NOT ANNOY OTHERS !\n\n*BE NICE, RESPECT OTHERS !\n\n*DO NOT USE HACKS, CHEATS OR HANDLING CFG !\n\n*DO NOT BOTHER STAFF !\n\n\n\n**********************************************************************************************************************************************************************************\n\nAtleast, you will be warned 2 times before BAN !\n\n\nAbove all, Have fun ! \n",false,guiEditor_Label[1]) guiMemoSetReadOnly(guiFgRulesMemo,false) guiEditor_Image[1] = guiCreateStaticImage(19,953,91,56,"Shruk.png",false,guiFgWelcomeWindow) addEventHandler("onClientGUIClick", guiFgOkButton, function() guiSetVisible(guiFgWelcomeWindow,false) showCursor(false) end, false) end )
CapY Posted July 14, 2011 Author Posted July 14, 2011 And that code is ? (Sry i don't understand that things so good. )
bandi94 Posted July 14, 2011 Posted July 14, 2011 use this here is an ex. what i use to draw the gear on my rpm+gear local screenWidth, screenHeight = guiGetScreenSize() addEventHandler("onClientRender",root, function ( ) dxDrawText( tostring(gear2), screenWidth-210, screenHeight-100, screenWidth, screenHeight, tocolor ( 255, 255, 255,255 ), 1, "pricedown","center","top", false,true,true ) end) Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Aibo Posted July 14, 2011 Posted July 14, 2011 And that code is ? (Sry i don't understand that things so good. ) you should read wiki about "relative" gui argument. it's present in every "guiCreate..." function. use this here is an ex. what i use to draw the gear on my rpm+gear local screenWidth, screenHeight = guiGetScreenSize() addEventHandler("onClientRender",root, function ( ) dxDrawText( tostring(gear2), screenWidth-210, screenHeight-100, screenWidth, screenHeight, tocolor ( 255, 255, 255,255 ), 1, "pricedown","center","top", false,true,true ) end) excuse me, how is this related to the topic? that's the second time i see you posting totally unrelated code, please stop that. ?
bandi94 Posted July 14, 2011 Posted July 14, 2011 he ask how he can make a GUI compatible on all resoulutions and i give him an exemple how to use guiGetScreenSize .... ex: for draw the gui windows on midel of screen on all resoulutions so ... Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Aibo Posted July 14, 2011 Posted July 14, 2011 well you don't really need guiGetScreenSize to make gui positioning relative. ?
CapY Posted July 14, 2011 Author Posted July 14, 2011 My default res is 1280x1024 and i was used that GUI on 1024x768 with this updated code : -- Created: 02/07/2011 09:45 -- Direct X Drawing addEventHandler("onClientRender",root, function() dxDrawText("",0.0,14.0,1279.0,1023.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) dxDrawLine(0.0,0.0,1279.0,0.0,tocolor(255,255,255,255),1.0,false) dxDrawText("",6.0,368.0,1277.0,935.0,tocolor(255,255,255,255),100.0,"default","left","top",false,true,false) end ) addEventHandler("onClientResourceStart",resourceRoot, function() guiEditor_Memo = {} guiEditor_Label = {} guiEditor_Image = {} guiFgWelcomeWindow = guiCreateWindow(-2,3,1279,1023," R U L E S ! ",false) guiSetAlpha(guiFgWelcomeWindow,1) guiWindowSetMovable(guiFgWelcomeWindow,false) guiWindowSetSizable(guiFgWelcomeWindow,false) guiFgOkButton = guiCreateButton(564,943,172,59,"O K ! ",false,guiFgWelcomeWindow) showCursor( true ) guiSetAlpha(guiFgOkButton,1) guiSetFont(guiFgOkButton,"clear-normal") guiFgImage = guiCreateStaticImage(9,21,1261,333,"Logo.png",false,guiFgWelcomeWindow) guiEditor_Label[1] = guiCreateLabel(8,355,1271,570,"",false,guiFgWelcomeWindow) guiSetAlpha(guiEditor_Label[1],1) guiLabelSetColor(guiEditor_Label[1],0, 155 ,155) guiSetFont(guiEditor_Label[1],"clear-normal") guiEditor_Memo[1] = guiCreateMemo(2,5,1265,565," Welcome To [FG]Clan 24/7 Croatian Playground Freeroam \n\n\n\nPress F9 for any HELP or Commands. \n\n**********************************************************************************************************************************************************************************\nFreeroam Rules:\n \n\n*DO NOT ADVERTISE !\n\n*DO NOT SPAM THE CHAT !\n\n*DO NOT SPAM VEHICLES ! \n\n*DO NOT ANNOY OTHERS !\n\n*BE NICE, RESPECT OTHERS !\n\n*DO NOT USE HACKS, CHEATS OR HANDLING CFG !\n\n*DO NOT BOTHER STAFF !\n\n\n\n**********************************************************************************************************************************************************************************\n\nAtleast, you will be warned 2 times before BAN !\n\n\nAbove all, Have fun ! \n",false,guiEditor_Label[1]) guiMemoSetReadOnly(guiFgRulesMemo,false) guiEditor_Image[1] = guiCreateStaticImage(19,953,91,56,"Shruk.png",false,guiFgWelcomeWindow) addEventHandler("onClientGUIClick", guiFgOkButton, function() guiSetVisible(guiFgWelcomeWindow,false) showCursor(false) end, false) end ) and still nothing ... Picture looks like a : http://imageshack.us/photo/my-images/836/unlednmn.png/
MTA Team qaisjp Posted July 14, 2011 MTA Team Posted July 14, 2011 @Bandi94 I don't see my variables here . "Example" He said example.
Aibo Posted July 14, 2011 Posted July 14, 2011 why the hell you're doing dx drawing now. forget about bandi94's comment, it's UNRELATED. read this: https://wiki.multitheftauto.com/wiki/GuiCreateWindow element guiCreateWindow ( float x, float y, float width, float height, string titleBarText, bool relative ) 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. ?
CapY Posted July 14, 2011 Author Posted July 14, 2011 I used relative screen,but now is the problem, to set the right cordinates
JR10 Posted July 14, 2011 Posted July 14, 2011 Use 0.5 to center it. Or load the gui using guieditor, and print it in relative. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
JR10 Posted July 14, 2011 Posted July 14, 2011 Then, next time, try before asking. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
bandi94 Posted July 14, 2011 Posted July 14, 2011 omg read the text and after comment whit "forget " ok no problem next time i will only say use guigetScreenSize its beter ? i write its an example to understand how its work Aibo its my foult that he can't read the "ex"=example ! ..... and Aibo i ask you to stop whit the "boss" things i give him an exemple you hmmm..... go and read so .... Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
CapY Posted July 14, 2011 Author Posted July 14, 2011 What the heck is not god now !? -- Created: 02/07/2011 09:45 local screenWidth, screenHeight = guiGetScreenSize() local x, y = screenWidth/2 - 1279/2, screenHeight/2 - 1023/2 addEventHandler("onClientResourceStart",resourceRoot, function() local guiFgWelcomeWindow = {} local guiFgOkButton = {} local guiEditor_Memo = {} local guiEditor_Label = {} local guiEditor_Image = {} guiFgWelcomeWindow[1] = guiCreateWindow(0,0,0.1279,0.1023," R U L E S ! ",true) guiFgOkButton[1] = guiCreateButton(0.441,0.9218,0.1345,0.0577,"O K ! ",true,guiFgWelcomeWindow[1]) guiSetAlpha(guiFgWelcomeWindow,1) guiWindowSetMovable(guiFgWelcomeWindow,false) guiWindowSetSizable(guiFgWelcomeWindow,false) showCursor( true ) guiSetAlpha(guiFgOkButton,1) guiSetFont(guiFgOkButton,"clear-normal") guiEditor_Image[1] = guiCreateStaticImage(0.007,0.0205,0.9859,0.3255,"Shruk.png",true,guiFgWelcomeWindow[1]) guiEditor_Label[1] = guiCreateLabel(0.0063,0.347,0.9937,0.5572,"",true,guiFgWelcomeWindow[1]) guiSetAlpha(guiEditor_Label[1],1) guiLabelSetColor(guiEditor_Label[1],0, 155 ,155) guiSetFont(guiEditor_Label[1],"clear-normal") guiEditor_Memo[1] = guiCreateMemo(0.0016,0.0088,0.9953,0.9912," Welcome To [FG]Clan 24/7 Croatian Playground Freeroam \n\n\n\nPress F9 for any HELP or Commands. \n\n**********************************************************************************************************************************************************************************\nFreeroam Rules:\n \n\n*DO NOT ADVERTISE !\n\n*DO NOT SPAM THE CHAT !\n\n*DO NOT SPAM VEHICLES ! \n\n*DO NOT ANNOY OTHERS !\n\n*BE NICE, RESPECT OTHERS !\n\n*DO NOT USE HACKS, CHEATS OR HANDLING CFG !\n\n*DO NOT BOTHER STAFF !\n\n\n\n**********************************************************************************************************************************************************************************\n\nAtleast, you will be warned 2 times before BAN !\n\n\nAbove all, Have fun ! \n",false,guiEditor_Label[1]) guiMemoSetReadOnly(guiEditor_Memo,true) addEventHandler("onClientGUIClick", guiFgOkButton, function() guiSetVisible(guiFgWelcomeWindow,false) showCursor(false) end, false) end ) http://imageshack.us/photo/my-images/828/bugam.png/ Im confused from this moment. Anybody can do that code ? : /
JR10 Posted July 14, 2011 Posted July 14, 2011 Lol, you took the same and just added 0. Do what i told you load it with guieditor and then make it relative, copy the code, this should work. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
JR10 Posted July 14, 2011 Posted July 14, 2011 Then how it's the same just with a 0. ?? Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
JR10 Posted July 14, 2011 Posted July 14, 2011 hehe, congratulation. Show it to me, you should be sure that i don't want it, i just want to see what did you do. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
CapY Posted July 14, 2011 Author Posted July 14, 2011 -- Created: 02/07/2011 09:45 local screenWidth, screenHeight = guiGetScreenSize() local x, y = screenWidth/2 - 1279/2, screenHeight/2 - 1023/2 addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(0,0,1279,1023," R U L E S ! ",true) guiWindowSetMovable ( GUIEditor_Window[1], false ) guiWindowSetSizable ( GUIEditor_Window[1],false ) GUIEditor_Button[1] = guiCreateButton(0.441,0.9218,0.1345,0.0577,"O K ! ",true,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") showCursor(true) GUIEditor_Image[1] = guiCreateStaticImage(0.007,0.0205,0.9859,0.3255,"Logo.png",true,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(0.0063,0.347,0.9937,0.5572,"",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,155,155) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Memo[1] = guiCreateMemo(0.0016,0.0088,0.9953,0.9912," Welcome To [FG]Clan 24/7 Croatian Playground Freeroam \n\n\n\nPress F9 for any HELP or Commands. \n\n**********************************************************************************************************************************************************************************\nFreeroam Rules:\n \n\n*DO NOT ADVERTISE !\n\n*DO NOT SPAM THE CHAT !\n\n*DO NOT SPAM VEHICLES ! \n\n*DO NOT ANNOY OTHERS !\n\n*BE NICE, RESPECT OTHERS !\n\n*DO NOT USE HACKS, CHEATS OR HANDLING CFG !\n\n*DO NOT BOTHER STAFF !\n\n\n\n**********************************************************************************************************************************************************************************\n\nAtleast, you will be warned 2 times before BAN !\n\n\nAbove all, Have fun ! ",true,GUIEditor_Label[1]) GUIEditor_Image[2] = guiCreateStaticImage(0.0149,0.9316,0.0711,0.0547,"Shruk.png",true,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) guiSetAlpha(GUIEditor_Window[1], 1 ) addEventHandler("onClientGUIClick", GUIEditor_Button[1], function() guiSetVisible(GUIEditor_Window[1],false) showCursor(false) end, false) end )
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