crismar Posted April 21, 2014 Share Posted April 21, 2014 YEs, I've read an entire philosophy about dxDraw and how their are just pixels and our mind tricks us and stuff but I'm curious. If guiCreate has relative and absolute positionning, and same GUI looks the same across all resolutions, isn't it possible at all to make dxDrawed text also relative/absolute? In short: I have a money system and it uses dxDraw and I have positioned money right under time (normal GtA SA hud component time), and now it simply doesn't show up/position well in some resolutions. For instance: in 1024x768 - Looks perfect 800x600 - Doesn't even show up 1920x1080 (or well, higher then 1280x1024) - Shows somewhere in the left of the current weapon hud component. I don't want that. Could you help me up ? Link to comment
Karuzo Posted April 21, 2014 Share Posted April 21, 2014 Could you show us your code how you calculated the positions ? Link to comment
cheez3d Posted April 21, 2014 Share Posted April 21, 2014 Use something like this to calculate the position relative to the screen size: _dxDrawText = dxDrawText -- keep original function as we'll need it; function dxDrawText(text,left,top,relative,right,bottom,color,scale,font,alignX,alignY,clip,wordBreak,postGUI,colorCoded,subPixelPositioning,fRotation,fRotationCenterX,fRotationCenterY) local sx,sy = guiGetScreenSize() local left = relative and left*sx or left local top = relative and top*sy or top local right = relative and right and right*sx or not relative and right or left local bottom = relative and bottom and bottom*sy or not relative and bottom or top local color = color or tocolor(255,255,255) local scale = scale or 1 local font = font or "default" local alignX = alignX or "left" local alignY = alignY or "top" local clip = clip or false local wordBreak = wordBreak or false local postGUI = postGUI or false local colorCoded = colorCoded or false local subPixelPositioning = subPixelPositioning or false local fRotation = fRotation or 0 local fRotationCenterX = fRotationCenterX or 0 local fRotationCenterY = fRotationCenterY or 0 return _dxDrawText(text,left,top,right,bottom,color,scale,font,alignX,alignY,clip,wordBreak,postGUI,colorCoded,subPixelPositioning,fRotation,fRotationCenterX,fRotationCenterY) end The new function. bool dxDrawText ( string text, float left, float top, bool relative [, float right=left, float bottom=top, int color=white, float scale=1, mixed font="default", string alignX="left", string alignY="top", bool clip=false, bool wordBreak=false, bool postGUI=false, bool colorCoded=false, bool subPixelPositioning=false, float fRotation=0, float fRotationCenterX=0, float fRotationCenterY=0 ] ) And now you can just use dxDrawText with the relative argument just like in GUI functions. Link to comment
kevenvz Posted April 21, 2014 Share Posted April 21, 2014 Just calculate the positions. local sX, sY = guiGetScreenSize() dxDrawText("Hello world",sX*0.4,sY*0.4,sX*0.2,sY*0.2,tocolor(255,255,255,255),sY/768,"default","center,"center") 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