DePemy Posted October 23, 2014 Share Posted October 23, 2014 So, i wanted to make a custom Time Passed image with logo. But somehow i cant get the position right.. Anyone who can help me out? Thanks in advance. Code : function showClientImage() guiCreateStaticImage( 1920, 1080, 100, 100, "logo1.png", false ) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) Link to comment
ReSe Posted October 23, 2014 Share Posted October 23, 2014 Hmm here's pic of your script. I guess your monitor have native resolution of 1080p. You should first get size of screen and then place an img //Ok here's code if you don't understand. That should make it working local x, y = guiGetScreenSize() function showClientImage() guiCreateStaticImage( x-100, y-100, 100, 100, "logo1.png", false ) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) Link to comment
DePemy Posted October 23, 2014 Author Share Posted October 23, 2014 Very good. Altought my logo is very small now, and when i change the size, the positions isnt right again.. I understand what you said, but how can i figure out what the position number is? Now you used -100 . How do you know this? Link to comment
ReSe Posted October 23, 2014 Share Posted October 23, 2014 You have to declare size of your image. It's pixel size so if your width of screen is variable "x" and you would like to show image on center then you have to do some math: "x/2 - halfsizeofimage" Place img on center: local x, y = guiGetScreenSize() function showClientImage() guiCreateStaticImage( x/2-100, y/2-100, 200, 200, "logo1.png", false ) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) You should read description of guiCreateStaticImage function. First argument is horizontal position on screen, 2nd arg is vertical position, 3rd is width of ig, 4rd is height, ..." Link to comment
DePemy Posted October 23, 2014 Author Share Posted October 23, 2014 Ah i see, now i have encountered the following problem. For my screen it is good. But when i ask some other players, it says they see it half.. How can i make this responsive like a website has? This is what i see : http://i62.tinypic.com/2mcye6v.png This is what an other guy sees: http://i58.tinypic.com/5334pk.png Hopefully you can help me out Link to comment
rtx Posted October 24, 2014 Share Posted October 24, 2014 You need to work on the positioning. Could you post the code here? -- it should be something like this local imgWidth, imgHeight = 200, 150 guiCreateStaticImage ( x - imgWidth, 100, imgWidth, imgHeight, "logo1.png", false ) If the text above the image is relative to the screen size, you need to account for that. Alternatively you can also make the image relative to its parent. 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