Tokio

[QUESTION] Why move dx elements in different resolutions?

Recommended Posts

http://imgur.com/a/og3e5

this is the problem, how to fix this? :/ 

code:

local screenW, screenH = guiGetScreenSize()

addEventHandler("onClientRender", root,
    function()
		local x, y, z = getElementPosition(localPlayer) 
	local location = getZoneName ( x, y, z )
        dxDrawImage(screenW * 0.0076, screenH * 0.7300, screenW * 0.2194, screenH * 0.2422, "mapbg.png", 360, 0, 0, tocolor(255, 255, 255, 255), false)
		        dxDrawText(location, screenW * 0.0965, screenH * 0.7370, screenW * 0.2250, screenH * 0.7567, tocolor(118, 224, 90, 255), 1.00, "default-bold", "left", "center", false, false, true, false, false)
    end
)

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function ()
		setPlayerHudComponentVisible( "area_name", false )
end)

local sx, sy = guiGetScreenSize()
local rt = dxCreateRenderTarget(290, 175)
local xFactor, yFactor = sx/1366, sy/768
local yFactor = xFactor

function findRotation(x1,y1,x2,y2)
  local t = -math.deg(math.atan2(x2-x1,y2-y1))
  if t < 0 then t = t + 360 end;
  return t;
end
function getPointFromDistanceRotation(x, y, dist, angle)
    local a = math.rad(90 - angle);
    local dx = math.cos(a) * dist;
    local dy = math.sin(a) * dist;
    return x+dx, y+dy;
end

function drawRadar()
	showPlayerHudComponent("radar", false)
	if disableGTASAhealth then showPlayerHudComponent("health", false) end
	if disableGTASAarmor then showPlayerHudComponent("armour", false) end
	if disableGTASAoxygen then showPlayerHudComponent("breath", false) end
	if (not isPlayerMapVisible()) then
		local mW, mH = dxGetMaterialSize(rt)
		local x, y = getElementPosition(localPlayer)
		local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH))
		local camX,camY,camZ = getElementRotation(getCamera())
		dxSetRenderTarget(rt, true)
		if alwaysRenderMap or getElementInterior(localPlayer) == 0 then
			dxDrawRectangle(0, 0, mW, mH, 0xFF5E656B) 
			dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "image/world.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255))
		end
		dxSetRenderTarget()
		-- dxDrawRectangle((10)*xFactor, sy-((200+10))*yFactor, (300)*xFactor, (200)*yFactor, tocolor(0, 0, 0, 175))
		dxDrawImage((10+5)*xFactor, sy-((200+5))*yFactor, (300-10)*xFactor, (175)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 255))

(this not the full code)

Edited by 50cent

Share this post


Link to post

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.