gokalpfirat Posted June 29, 2012 Share Posted June 29, 2012 local sw,sh = guiGetScreenSize() guiCreateStaticImage( sw-203, sh-678, sw-1216, sh-618, "logo.png", false) function DXtext () dxDrawText(tostring "Hello",sw-241,sh-558,sw-634,sh-2,tocolor(148,0,220),1.5,"beckett") end addEventHandler ( "onClientRender", getRootElement(), DXtext ) In this script when I open this script In another resolution logo and text changes their position. Link to comment
Guest Guest4401 Posted June 29, 2012 Share Posted June 29, 2012 Because sw & sh will differ depending upon the resolution. Link to comment
gokalpfirat Posted June 29, 2012 Author Share Posted June 29, 2012 Yes but i want it to same in every resolution. Link to comment
Guest Guest4401 Posted June 29, 2012 Share Posted June 29, 2012 What was your screen resolution when it was at the correct position? Link to comment
TwiX! Posted June 29, 2012 Share Posted June 29, 2012 Yes but i want it to same in every resolution. you want image at the center? Link to comment
Mefisto_PL Posted June 29, 2012 Share Posted June 29, 2012 local x,y = guiGetScreenSize() guiCreateStaticImage( x/3.8, y/3.8, x/2.02, y/2, "logo.png", false) function DXtext () dxDrawText(tostring "Hello",x/3.5, y/3.6, x, y,tocolor(148,0,220),1.5,"beckett") end addEventHandler ( "onClientRender", getRootElement(), DXtext ) This positions is for example, but it still working Link to comment
Guest Guest4401 Posted June 29, 2012 Share Posted June 29, 2012 Yes but i want it to same in every resolution. Use relative positions if math with guiGetScreenSize() is too difficult for you. Link to comment
Guest Guest4401 Posted June 29, 2012 Share Posted June 29, 2012 local sw,sh = guiGetScreenSize() local image = guiCreateStaticImage( sw-203, 90, 150, 150, "logo.png", false) addEventHandler("onClientRender",root, function() dxDrawText(tostring "Hello",sw-241,210,sw,sh,tocolor(148,0,220),1.5,"beckett") end ) Link to comment
gokalpfirat Posted June 29, 2012 Author Share Posted June 29, 2012 Karthik It doesnt works(works but it doesnt in my x and y) Link to comment
gokalpfirat Posted June 29, 2012 Author Share Posted June 29, 2012 Waiting for a good answer Link to comment
TwiX! Posted June 29, 2012 Share Posted June 29, 2012 Waiting for a good answer stop flood dude! learn here https://wiki.multitheftauto.com/wiki/GuiGetScreenSize no one will make it for you Link to comment
gokalpfirat Posted June 29, 2012 Author Share Posted June 29, 2012 I dont want to anyone to make it I give a code and want to unbug it. Link to comment
TwiX! Posted June 29, 2012 Share Posted June 29, 2012 I dont want to anyone to make it I give a code and want to unbug it. you code is not bugged follow the link// Link to comment
gokalpfirat Posted June 29, 2012 Author Share Posted June 29, 2012 Yes it is true bu it doesnt do what i want. Link to comment
GhostXoP Posted June 29, 2012 Share Posted June 29, 2012 WidthOfScreen/2-WidthOfWindow/2, HeightOfScreen/2-HeightOfWindow/2 for center screen coordinates Link to comment
TwiX! Posted June 29, 2012 Share Posted June 29, 2012 WidthOfScreen/2-WidthOfWindow/2, HeightOfScreen/2-HeightOfWindow/2 for center screen coordinates local sw,sh = guiGetScreenSize() local w,h = 300,100 guiCreateStaticImage( sw/2-w/2, sh/2-h/2, w, h, "logo.png", false) will on the center Link to comment
gokalpfirat Posted June 29, 2012 Author Share Posted June 29, 2012 No no I downt want In center I want it in my cordinates. Link to comment
50p Posted June 29, 2012 Share Posted June 29, 2012 No no I downt want In center I want it in my cordinates. You either need to use relative size and position or use fixed position but get its new position for different resolution (using relative values). If you test this: local w,h = guiGetScreenSize( ); local x,y = 300, 100; local img = guiCreateStaticImage( x, y, w, h, "logo.png", false ); x, y = guiGetPosition( img, true ); outputChatBox( "Relative coords, x:" .. tostring( x ) .. "; y: " .. tostring( y ) ); You should be able to see its relative coords, then you can use them to display the element at the same position on different resolution. Link to comment
gokalpfirat Posted June 30, 2012 Author Share Posted June 30, 2012 Yes when I test it I see a big logo in my center of screen and see relative values. But If I have relative values after what I must do to It where I want in every resolution. Link to comment
50p Posted June 30, 2012 Share Posted June 30, 2012 Yes when I test it I see a big logo in my center of screen and see relative values. But If I have relative values after what I must do to It where I want in every resolution. Read on relative parameter of guiCreateStaticImage. Link to comment
gokalpfirat Posted June 30, 2012 Author Share Posted June 30, 2012 x: 0.21961933374405; y: 0.13020832836628 Link to comment
50p Posted June 30, 2012 Share Posted June 30, 2012 x: 0.21961933374405; y: 0.13020832836628 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 measures relative to the parent. Link to comment
gokalpfirat Posted June 30, 2012 Author Share Posted June 30, 2012 But if I use relative then in every resolution It is in same? Link to comment
50p Posted June 30, 2012 Share Posted June 30, 2012 But if I use relative then in every resolution It is in same? Have you tried it? Link to comment
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