megaman54 Posted February 5, 2012 Posted February 5, 2012 What is the best way to fit DX and GUI text and other elements in all resolutions?
Xeno Posted February 5, 2012 Posted February 5, 2012 (edited) For GUI I use this sx,sy = guiGetScreenSize() loginWindow = guiCreateWindow(0.020*sx,0.290*sy,0.300*sx,0.550*sy,"",false) Also local screenWidth, screenHeight = guiGetScreenSize() dxDrawText ( "You have level up!", 05, screenHeight - 100, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 4, "pricedown" ) Edited February 5, 2012 by Guest
Kenix Posted February 5, 2012 Posted February 5, 2012 https://wiki.multitheftauto.com/wiki/GuiGetScreenSize read it.
megaman54 Posted February 5, 2012 Author Posted February 5, 2012 For GUI I use this sx,sy = guiGetScreenSize() loginWindow = guiCreateWindow(0.020*sx,0.290*sy,0.300*sx,0.550*sy,"",false) https://wiki.multitheftauto.com/wiki/GuiGetScreenSize read it. Thank you both Really fast answer i like it.
Xeno Posted February 5, 2012 Posted February 5, 2012 I have updated my previous code with my dxDraw Example.
Kenix Posted February 5, 2012 Posted February 5, 2012 You can use this functions for dx drawing function dxDrawRelativeRectangle( posX, posY, width, height,color,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawRectangle( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, color, postGUI ) end function dxDrawRelativeText( text,posX,posY,right,bottom,color,scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) 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 ) end function dxDrawRelativeImage( posX, posY, width, height, mixed,rotation,rotationCenterOffsetX,rotationCenterOffsetY,color,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawImage ( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, mixed, rotation, rotationCenterOffsetX, rotationCenterOffsetY, color, postGUI ) 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