Jump to content

Screen size


Recommended Posts

السلام عليكم

عندي نافذ مسويه على يمين الشاشة, يطلع عندي مضبوط

بس في ناس مايطلع عندهم, او يطلع بس مو كامل, وعفسسة

انا ادري اني احتاج

guiGetScreenSize() 

بس مو جاي يضبط مع كل الشاشات

هذا الكود

sx,sy=guiGetScreenSize() 
x,y=0.5*sx,0.5*sy 
  
        dxDrawRectangle(1146, 275, 250, 404, tocolor(0, 0, 0, 180), false) 
        dxDrawText("Test", x + 480, y - 140, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
        dxDrawText("Test", x + 475, y - 80, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
        dxDrawText("Test", x + 475, y - 50, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
        dxDrawText("Test", x + 475, y - 20, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
        dxDrawText("Test", x + 475, y + 10, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
        end 

Link to comment

فنكشن حسن الي عطاني زاحف

  
     ------------- 
     -- Screen 
     ------------- 
         function guiSetPositionAllScreen(wnd,ScreenH,ScreenW) 
        local LocalScreenH,LocalScreenW = guiGetScreenSize() 
        if ( isElement(wnd) ) then 
            if ( ScreenH and ScreenW ) then 
                local x,y = guiGetPosition(wnd,false) 
                guiSetPosition(wnd,LocalScreenH*(x/ScreenH),LocalScreenW*(y/ScreenW),false) 
            end 
        end 
    end 
     
  

Link to comment
فنكشن حسن الي عطاني زاحف
  
     ------------- 
     -- Screen 
     ------------- 
         function guiSetPositionAllScreen(wnd,ScreenH,ScreenW) 
        local LocalScreenH,LocalScreenW = guiGetScreenSize() 
        if ( isElement(wnd) ) then 
            if ( ScreenH and ScreenW ) then 
                local x,y = guiGetPosition(wnd,false) 
                guiSetPosition(wnd,LocalScreenH*(x/ScreenH),LocalScreenW*(y/ScreenW),false) 
            end 
        end 
    end 
     
  

زي ماتشوف انا استخدم dx

Link to comment
ولله شف في اكثر من طريقة عشان تسويها لكل الشاشات

جرب هذي الطريقة .. :

local sX, sY = guiGetScreenSize (     ); 
local pX = (sX/800)*200 
local pY = (sY/600)*200 

800, 600 = مقاس شاشتكـ

200 = x, y الاحداثيات

تيش هي ال 200 ؟

Link to comment
ولله شف في اكثر من طريقة عشان تسويها لكل الشاشات

جرب هذي الطريقة .. :

local sX, sY = guiGetScreenSize (     ); 
local pX = (sX/800)*200 
local pY = (sY/600)*200 

800, 600 = مقاس شاشتكـ

200 = x, y الاحداثيات

تطلع ملخبطة وحدة داخل وحدة + ابي لكل الشاشات مو ب 800, 600

Link to comment

شاشتي :

1366 x 768

وهذا اللي سويته

local sX, sY = guiGetScreenSize (     ); 
local pX = (sX/800)*200 
local pY = (sY/600)*200 
  
dxDrawRectangle(1146, 275, 250, 404, tocolor(0, 0, 0, 180), false) 
        dxDrawText("Test", x , y, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 

Link to comment
شاشتي :

1366 x 768

وهذا اللي سويته

local sX, sY = guiGetScreenSize (     ); 
local pX = (sX/800)*200 
local pY = (sY/600)*200 
  
dxDrawRectangle(1146, 275, 250, 404, tocolor(0, 0, 0, 180), false) 
        dxDrawText("Test", x , y, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 

جرب الكود هذا ,

جانب كلنت ----

  
  
  
dxDrawRectangle(1146, 275, 250, 404, tocolor(0, 0, 0, 180), false) 
  
        dxDrawText("Test", x , y, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
  
    function guiSetPositionAllScreen(MyWindow,ScreenH,ScreenW) 
        local LocalScreenH,LocalScreenW = guiGetScreenSize() 
        if ( isElement(MyWindow) ) then 
            if ( ScreenH and ScreenW ) then 
                local x,y = guiGetPosition(MyWindow,false) 
                guiSetPosition(MyWindow,LocalScreenH*(x/ScreenH),LocalScreenW*(y/ScreenW),false) 
            end 
        end 
    end 

guiSetPositionAllScreen(MyWindow,1366,768) ----- هذا الفنكشن ضروري تحطه في حدث عند تشغيل السكربت 

حدث تشغيل السكربت الي اقصده

  
addEventHandler("onClientResourceStrat", resourceRoot, 
  
    function() 
    MyWindow = GUIEditor.window(....)  
        guiSetPositionAllScreen(MyWindow,1366,768) ------- يصير هنا بعد الكود الي فوق 
end 
) 
  

+++

لاتنسى تستبدل MyWindow

الى اسم لوحتك

Link to comment
شاشتي :

1366 x 768

وهذا اللي سويته

local sX, sY = guiGetScreenSize (     ); 
local pX = (sX/800)*200 
local pY = (sY/600)*200 
  
dxDrawRectangle(1146, 275, 250, 404, tocolor(0, 0, 0, 180), false) 
        dxDrawText("Test", x , y, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 

جرب الكود هذا ,

جانب كلنت ----

  
  
  
dxDrawRectangle(1146, 275, 250, 404, tocolor(0, 0, 0, 180), false) 
  
        dxDrawText("Test", x , y, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
  
    function guiSetPositionAllScreen(MyWindow,ScreenH,ScreenW) 
        local LocalScreenH,LocalScreenW = guiGetScreenSize() 
        if ( isElement(MyWindow) ) then 
            if ( ScreenH and ScreenW ) then 
                local x,y = guiGetPosition(MyWindow,false) 
                guiSetPosition(MyWindow,LocalScreenH*(x/ScreenH),LocalScreenW*(y/ScreenW),false) 
            end 
        end 
    end 

guiSetPositionAllScreen(MyWindow,1366,768) ----- هذا الفنكشن ضروري تحطه في حدث عند تشغيل السكربت 

حدث تشغيل السكربت الي اقصده

  
addEventHandler("onClientResourceStrat", resourceRoot, 
  
    function() 
    MyWindow = GUIEditor.window(....)  
        guiSetPositionAllScreen(MyWindow,1366,768) ------- يصير هنا بعد الكود الي فوق 
end 
) 
  

+++

لاتنسى تستبدل MyWindow

الى اسم لوحتك

ماعندي لوحة, بس dx elements

Link to comment
شاشتي :

1366 x 768

وهذا اللي سويته

local sX, sY = guiGetScreenSize (     ); 
local pX = (sX/800)*200 
local pY = (sY/600)*200 
  
dxDrawRectangle(1146, 275, 250, 404, tocolor(0, 0, 0, 180), false) 
        dxDrawText("Test", x , y, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 

جرب الكود هذا ,

جانب كلنت ----

  
  
  
dxDrawRectangle(1146, 275, 250, 404, tocolor(0, 0, 0, 180), false) 
  
        dxDrawText("Test", x , y, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
        dxDrawText("Test", x , y, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
  
  
    function guiSetPositionAllScreen(MyWindow,ScreenH,ScreenW) 
        local LocalScreenH,LocalScreenW = guiGetScreenSize() 
        if ( isElement(MyWindow) ) then 
            if ( ScreenH and ScreenW ) then 
                local x,y = guiGetPosition(MyWindow,false) 
                guiSetPosition(MyWindow,LocalScreenH*(x/ScreenH),LocalScreenW*(y/ScreenW),false) 
            end 
        end 
    end 

guiSetPositionAllScreen(MyWindow,1366,768) ----- هذا الفنكشن ضروري تحطه في حدث عند تشغيل السكربت 

حدث تشغيل السكربت الي اقصده

  
addEventHandler("onClientResourceStrat", resourceRoot, 
  
    function() 
    MyWindow = GUIEditor.window(....)  
        guiSetPositionAllScreen(MyWindow,1366,768) ------- يصير هنا بعد الكود الي فوق 
end 
) 
  

+++

لاتنسى تستبدل MyWindow

الى اسم لوحتك

Triple-facepalm-picard-812.jpg

الفنكشن حق حسن مختص بـ النوافذ وش دخلها في الدي اكس :| وتقول له تستبدل ومادري وش

وكوده كله مافي نافذه كله دي اكس وين البازوكا عطوني اياها :lol::lol:

:bazooka::bazooka::bazooka::bazooka::bazooka::bazooka:

بالنسبه لصاحب الموضوع امسك سويته لك

لكن انت عدل الاحدثيات لان لازم لها رياضيات -_-

local x,y = guiGetScreenSize()  
dxDrawRectangle(x/2-200,y/2-200, 250, 404, tocolor(0, 0, 0, 180), false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
end 

Link to comment

هريس ..

مدري وش تقصد بها استبدلها لرقم x, y بالـ تكست حاط

local sX, sY = guiGetScreenSize (     ); 
  
function DxFunction (   )  
    dxDrawRectangle((sX/1366)*1146, (sY/768)*275, (sX/1366)*250, (sY/768)*404, tocolor(0, 0, 0, 180), false) 
    dxDrawText("Test", (sX/1366)*x, (sY/768)*y, (sX/1366)*1356, (sY/768)*431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
end 
addEventHandler ( "onClientRender", root, DxFunction ) 
Link to comment
هريس ..

مدري وش تقصد بها استبدلها لرقم x, y بالـ تكست حاط

local sX, sY = guiGetScreenSize (     ); 
  
function DxFunction (   )  
    dxDrawRectangle((sX/1366)*1146, (sY/768)*275, (sX/1366)*250, (sY/768)*404, tocolor(0, 0, 0, 180), false) 
    dxDrawText("Test", (sX/1366)*x, (sY/768)*y, (sX/1366)*1356, (sY/768)*431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
end 
addEventHandler ( "onClientRender", root, DxFunction ) 

Works perfectly, thanks mate :D

Link to comment

بالنسبه لصاحب الموضوع امسك سويته لك

لكن انت عدل الاحدثيات لان لازم لها رياضيات -_-

local x,y = guiGetScreenSize()  
dxDrawRectangle(x/2-200,y/2-200, 250, 404, tocolor(0, 0, 0, 180), false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
end 

images?q=tbn:ANd9GcSz_PFSJoHwe8QovWdjkxZIYA4DIJRA6fINQou0RTxaM11zjARx

بعدين كودك هريسه وانت اهرس منه

Link to comment

بالنسبه لصاحب الموضوع امسك سويته لك

لكن انت عدل الاحدثيات لان لازم لها رياضيات -_-

local x,y = guiGetScreenSize()  
dxDrawRectangle(x/2-200,y/2-200, 250, 404, tocolor(0, 0, 0, 180), false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 304, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "center", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 338, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 369, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 400, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
dxDrawText("Test", x/2-200,y/2-200, 1356, 431, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false,false,false) 
end 

images?q=tbn:ANd9GcSz_PFSJoHwe8QovWdjkxZIYA4DIJRA6fINQou0RTxaM11zjARx

بعدين كودك هريسه وانت اهرس منه

Calm down :lol:

Link to comment
هريسه اجل ي بكس :\

شوف الكود شغال لكن لازم له تعديل احدثيات ..

546526461.png

نظام البزرنه والدرعمه ذا ما يمشي عندي اوك ؟ +

انا ماجيت اطرح له كود جاهز

لأني في بدايتي ماحصلت اكواد جاهزه

كذا ماراح يتعلم

ثاني شيء البزر انت جاي مدرعم علي كودك خطأ

ياخي انطم واطرح كودك وانت ساكت

لأني مايعجبني اخذ واعطي

مع ناس مثلك

ثالث شيء

مجرب الكود وحدك ومصوره

وش الفايده من الكود

اذا كان يشغل المود على شاشتك

Link to comment

ههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههه

الله لا تبلانا حلوه " انا ما جيت اطرح له كود جاهز " ههههههههه

محسسني اننا ميتين عليك الحين ههههههههههههههههههههههههههههه

وكمان وش دخلك ! منت لا صاحب الموضوع ولا تساعد جاي بس شغال درعمه وزياده مشاركات يالله لك الحمد

اذا مسوي العضويه ومنت جاي تساعد الناس وجاي تردعم على الشعب

فـ الله لايهينك سقها من المنتدى واطلع لان اشكالك كثار هنيا -.-

يلا شقلب بس :\ بزرنه اخر رد لي مع صغار العقول

Link to comment
ههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههه

الله لا تبلانا حلوه " انا ما جيت اطرح له كود جاهز " ههههههههه

محسسني اننا ميتين عليك الحين ههههههههههههههههههههههههههههه

وكمان وش دخلك ! منت لا صاحب الموضوع ولا تساعد جاي بس شغال درعمه وزياده مشاركات يالله لك الحمد

اذا مسوي العضويه ومنت جاي تساعد الناس وجاي تردعم على الشعب

فـ الله لايهينك سقها من المنتدى واطلع لان اشكالك كثار هنيا -.-

يلا شقلب بس :\ بزرنه اخر رد لي مع صغار العقول

والله مالبزر الانت

اصلا من شفت كلامك عرفت انك بزر جاي هنا تفرغ الطاقه :lol::lol:

++

زيادة مشاركات ليه ؟

ههههههه

المشاركات هنا مامنها فائده خذها معلومه ذذ

++

المنتدى ماهو حلالك عشان اطلع منه :roll:

شاريه شي ونا مادري :lol::lol::!::!:

نسأل الله العفو والعافيه

برب

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