Jump to content

[Help] Why this doesn't draw


Kazafka

Recommended Posts

Code:

pliki = {
	mapa = "files/colormap.png"
}
	
hud = {
	szer = 320,
	przez = 200
}

addEventHandler("onClientResourceStart", resourceRoot, function()
	setPlayerHudComponentVisible("radar", false)
	
	minimap = dxCreateRenderTarget(hud.szer, hud.szer, true)
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
	setPlayerHudComponentVisible("radar", true)
end)

addEventHandler("onClientRender", root, function()
	local x, y, z = getElementPosition(localPlayer)
	local r = getScreenRotationFromWorldPosition(x, y, z)
		
	dxSetRenderTarget(minimap, false)
	dxSetBlendMode("modulate_add")
	dxDrawImageSection(0, 0, 3000, 3000, x, y, 3000, 3000, pliki.mapa)
	dxSetRenderTarget()
end)

Output: NONE

Why?

Link to comment

Cause you're only rendering onto a render-target. After you've rendered the contents in your render-target, you need to render the render-target itself as well.

-- add this somewhere at the top in outermost scope
local screenX, screenY = guiGetScreenSize()

-- add this right after setting rendering target to screen (line 27)
dxDrawImage(0, screenY - hud.przez, hud.szer, hud.przez, minimap)

 

Edited by MrTasty
Link to comment

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.
×
×
  • Create New...