Jump to content

شرح guiGetScreenSizeClient


iiv03

Recommended Posts

لو سحمتم انا عندي هال الوظيفة 

--setup a function when the resource starts
function checkResolutionOnStart ()
	local x,y = guiGetScreenSize() --get their screen size
	if ( x <= 640 ) and ( y <= 480 ) then --if their resolution is lower or equal to 640x480
		--warn them about GUI problems.
		outputChatBox ( "WARNING: You are running on a low resolution.  Some GUI may be placed or appear incorrectly." )
	end
end
--attach the function to the event handler
addEventHandler ( "onClientResourceStart", resourceRoot, checkResolutionOnStart )

بدي اخليه علي اللوحة GUI كيف ؟

عندي ملف اخليه علي dx كيف؟

ال دي اكس موجود مع ملف GUI بس كل واحد ب ملفين يعني

دي اكس ملف اخر كلينت

و gui  ملف اخر كلينت

انا مسوي لوحة تشجيل دخةل تفتح ب زر 

بدي كل لاعب لما يفتح لوحه ب كل شاشات تنضبط علي النص تكفون والله م فهمت شيئ ب وظيفتة فهمت بس 

640x480

والله ساعدددوني :'(

 

Link to comment
13 minutes ago, liwahadri said:

لو سحمتم انا عندي هال الوظيفة 


--setup a function when the resource starts
function checkResolutionOnStart ()
	local x,y = guiGetScreenSize() --get their screen size
	if ( x <= 640 ) and ( y <= 480 ) then --if their resolution is lower or equal to 640x480
		--warn them about GUI problems.
		outputChatBox ( "WARNING: You are running on a low resolution.  Some GUI may be placed or appear incorrectly." )
	end
end
--attach the function to the event handler
addEventHandler ( "onClientResourceStart", resourceRoot, checkResolutionOnStart )

بدي اخليه علي اللوحة GUI كيف ؟

عندي ملف اخليه علي dx كيف؟

ال دي اكس موجود مع ملف GUI بس كل واحد ب ملفين يعني

دي اكس ملف اخر كلينت

و gui  ملف اخر كلينت

انا مسوي لوحة تشجيل دخةل تفتح ب زر 

بدي كل لاعب لما يفتح لوحه ب كل شاشات تنضبط علي النص تكفون والله م فهمت شيئ ب وظيفتة فهمت بس 

640x480

والله ساعدددوني :'(

 

ديب اكواد اللوحه

Link to comment
14 minutes ago, N3xT said:

ايه

 

2 hours ago, +Source|> said:

ديب اكواد اللوحه

تفضل :

GUI-Client :

GUIEditor = {
    button = {},
    window = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(392, 96, 474, 535, "× [ Skin Cars ] ×", false)
        guiWindowSetSizable(GUIEditor.window[1], false)
		guiSetVisible(GUIEditor.window[1], false)
        right = guiCreateButton(41, 476, 134, 43, "Left", false, GUIEditor.window[1])
        guiSetAlpha(right, 0.00)  
        left = guiCreateButton(303, 476, 134, 43, "Right", false, GUIEditor.window[1])
        guiSetAlpha(left, 0.00)  
        select = guiCreateStaticImage(54, 35, 373, 431, ":loginpanel/logo.png", false, GUIEditor.window[1]) 
		showCursor(false)
    end
)

function Open()
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1]))
showCursor(guiGetVisible(GUIEditor.window[1]))
end
bindKey("F4","down",Open)

DX-Client :

function isMouseInPosition ( x, y, width, height )
                if ( not isCursorShowing ( ) ) then
                        return false
                end
         
                local sx, sy = guiGetScreenSize ( )
                local cx, cy = getCursorPosition ( )
                local cx, cy = ( cx * sx ), ( cy * sy )
                if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
                        return true
                else
                        return false
                end
        end







    function dxskin()
        dxDrawRectangle(392, 94, 474, 28, tocolor(80, 80, 80, 255), true)
        dxDrawText("× [ Skin Cars ] ×", 391, 94, 866, 122, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, true, false, false)
		if ( isMouseInPosition(431, 571, 138, 47) ) then
        dxDrawRectangle(431, 571, 138, 47, tocolor(0, 0, 0, 255), true)
		else
        dxDrawRectangle(431, 571, 138, 47, tocolor(80, 80, 80, 100), true)
		end
		if ( isMouseInPosition(693, 571, 138, 47) ) then
        dxDrawRectangle(693, 571, 138, 47, tocolor(0, 0, 0, 255), true)
		else
        dxDrawRectangle(693, 571, 138, 47, tocolor(80, 80, 80, 100), true)
		end
        dxDrawText("Right", 433, 571, 563, 618, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, true, false, false)
        dxDrawText("Left", 701, 571, 831, 618, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, true, false, false)
    end
	
	
	bindKey("F4","down",function ( )
	if ( removeEventHandler("onClientRender",root,dxskin) ) then
	removeEventHandler("onClientRender",root,dxskin)
	showCursor(false)
	else
	addEventHandler("onClientRender",root,dxskin)
	showCursor(true)
	end
	 end
	 )

سويه بليز

Link to comment
4 hours ago, liwahadri said:

 

تفضل :

GUI-Client :


GUIEditor = {
    button = {},
    window = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(392, 96, 474, 535, "× [ Skin Cars ] ×", false)
        guiWindowSetSizable(GUIEditor.window[1], false)
		guiSetVisible(GUIEditor.window[1], false)
        right = guiCreateButton(41, 476, 134, 43, "Left", false, GUIEditor.window[1])
        guiSetAlpha(right, 0.00)  
        left = guiCreateButton(303, 476, 134, 43, "Right", false, GUIEditor.window[1])
        guiSetAlpha(left, 0.00)  
        select = guiCreateStaticImage(54, 35, 373, 431, ":loginpanel/logo.png", false, GUIEditor.window[1]) 
		showCursor(false)
    end
)

function Open()
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1]))
showCursor(guiGetVisible(GUIEditor.window[1]))
end
bindKey("F4","down",Open)

DX-Client :


function isMouseInPosition ( x, y, width, height )
                if ( not isCursorShowing ( ) ) then
                        return false
                end
         
                local sx, sy = guiGetScreenSize ( )
                local cx, cy = getCursorPosition ( )
                local cx, cy = ( cx * sx ), ( cy * sy )
                if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
                        return true
                else
                        return false
                end
        end







    function dxskin()
        dxDrawRectangle(392, 94, 474, 28, tocolor(80, 80, 80, 255), true)
        dxDrawText("× [ Skin Cars ] ×", 391, 94, 866, 122, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, true, false, false)
		if ( isMouseInPosition(431, 571, 138, 47) ) then
        dxDrawRectangle(431, 571, 138, 47, tocolor(0, 0, 0, 255), true)
		else
        dxDrawRectangle(431, 571, 138, 47, tocolor(80, 80, 80, 100), true)
		end
		if ( isMouseInPosition(693, 571, 138, 47) ) then
        dxDrawRectangle(693, 571, 138, 47, tocolor(0, 0, 0, 255), true)
		else
        dxDrawRectangle(693, 571, 138, 47, tocolor(80, 80, 80, 100), true)
		end
        dxDrawText("Right", 433, 571, 563, 618, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, true, false, false)
        dxDrawText("Left", 701, 571, 831, 618, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, true, false, false)
    end
	
	
	bindKey("F4","down",function ( )
	if ( removeEventHandler("onClientRender",root,dxskin) ) then
	removeEventHandler("onClientRender",root,dxskin)
	showCursor(false)
	else
	addEventHandler("onClientRender",root,dxskin)
	showCursor(true)
	end
	 end
	 )

سويه بليز

 

 

شف هذا حق GUI 

الدي اكس ما اعرفلها

 

GUIEditor = {
button = {},
window = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
local sh, sw = guiGetScreenSize()
GUIEditor.window[1] = guiCreateWindow((sh - 474)/2, (sw - 535)/2, 474, 535, "× [ Skin Cars ] ×", false)
guiWindowSetSizable(GUIEditor.window[1], false)
		guiSetVisible(GUIEditor.window[1], false)
right = guiCreateButton(41, 476, 134, 43, "Left", false, GUIEditor.window[1])
guiSetAlpha(right, 0.00) 
left = guiCreateButton(303, 476, 134, 43, "Right", false, GUIEditor.window[1])
guiSetAlpha(left, 0.00) 
select = guiCreateStaticImage(54, 35, 373, 431, ":loginpanel/logo.png", false, GUIEditor.window[1]) 
		showCursor(false)
end
)

function Open()
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1]))
showCursor(guiGetVisible(GUIEditor.window[1]))
end
bindKey("F4","down",Open)

 

Link to comment
local _dxDrawRectangle = dxDrawRectangle
local _dxDrawText = dxDrawText
local resolutionX = حجم الشاشة الي صممت فيها الوحة
local resolutionY = حجم الشاشة الي صممت فيها الوحة
function dxDrawText(text,posX,posY,right,bottom,color,scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI,kk,gg)
	return _dxDrawText(tostring( text ), ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( right/resolutionX )*sWidth, ( bottom/resolutionY)*sHeight, color, ( scale/resolutionX )*sWidth, mixed_font, alignX, alignY, clip, wordBreak, postGUI, kk, gg)
end
function dxDrawRectangle(posX, posY, width, height,color,postGUI)
    return _dxDrawRectangle(( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, color, postGUI)
end
-----------------------------
لو ما نفع
local resolutionX = حجم الشاشة الي صممت فيها الوحة
local resolutionY = =============================
function _dxDrawText( text,posX,posY,right,bottom,color,scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI )
    return dxDrawText(tostring( text ),( posX/resolutionX )*sWidth,( posY/resolutionY )*sHeight,( right/resolutionX )*sWidth,( bottom/resolutionY)*sHeight,color,( sWidth/resolutionX )*scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI, true,false)
end
function _dxDrawRectangle( posX, posY, width, height,color,postGUI )
    return dxDrawRectangle(( posX/resolutionX )*sWidth,( posY/resolutionY )*sHeight,( width/resolutionX )*sWidth,( height/resolutionY )*sHeight,color,postGUI)
end
-- و الباقي مثلها _dxDrawText كذا dxDrawText لو عميت الطريقة الثانية خلي 
function dxskin()
        dxDrawRectangle(392, 94, 474, 28, tocolor(80, 80, 80, 255), true)
        dxDrawText("× [ Skin Cars ] ×", 391, 94, 866, 122, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, true, false, false)
		if ( isMouseInPosition(431, 571, 138, 47) ) then
        dxDrawRectangle(431, 571, 138, 47, tocolor(0, 0, 0, 255), true)
		else
        dxDrawRectangle(431, 571, 138, 47, tocolor(80, 80, 80, 100), true)
		end
		if ( isMouseInPosition(693, 571, 138, 47) ) then
        dxDrawRectangle(693, 571, 138, 47, tocolor(0, 0, 0, 255), true)
		else
        dxDrawRectangle(693, 571, 138, 47, tocolor(80, 80, 80, 100), true)
		end
        dxDrawText("Right", 433, 571, 563, 618, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, true, false, false)
        dxDrawText("Left", 701, 571, 831, 618, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, true, false, false)
    end
	
	
	bindKey("F4","down",function ( )
	if ( removeEventHandler("onClientRender",root,dxskin) ) then
	removeEventHandler("onClientRender",root,dxskin)
	showCursor(false)
	else
	addEventHandler("onClientRender",root,dxskin)
	showCursor(true)
	end
	 end
	 )

 

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