Well, in my dxDrawImage with render target i see the png, in the material line with render target, i dont.
(I still see some text i drawed on it thought)
local nX,nY,nZ = getWorldFromScreenPosition(startX,hd*y+(h*y/2),0)
local nX2,nY2,nZ2 = getWorldFromScreenPosition(startX+(width2*x),hd*y+(h*y/2),0)
local eX,eY,eZ = getWorldFromScreenPosition(startX+(width2*x/2),hd*y+h*y,0)
dxSetRenderTarget(target,true)
dxSetBlendMode("modulate_add")
dxDrawImage(0, 0,width2*x,h*y,"misc/bg.png")
dxSetRenderTarget()
dxSetBlendMode("blend")
if target then
--dxDrawImage(startX, hd*y,width2*x,h*y,target)
dxDrawMaterialLine3D(nX,nY,nZ,nX2,nY2,nZ2,target,width2*x)
end
EDIT: Drawing the actual image as a texture with the function doesnt work either.
local mat = dxCreateTexture("misc/bg.png")
--
dxDrawMaterialLine3D(nX,nY,nZ,nX2,nY2,nZ2,mat,width2*x)
dxDrawMaterialLine3D(nX,nY,nZ,nX2,nY2,nZ2,target,width2*x)
EDIT: Whole function, what i'm doing wrong? if i stop drawing the material lines it should stop drawing the texts.. that they're assumed to be drawn on the target..
function renderToptimes()
if not bold then return end
local nX,nY,nZ = getWorldFromScreenPosition(startX,hd*y+(h*y/2),0)
local nX2,nY2,nZ2 = getWorldFromScreenPosition(startX+(width2*x),hd*y+(h*y/2),0)
local eX,eY,eZ = getWorldFromScreenPosition(startX+(width2*x/2),hd*y+h*y,0)
dxSetRenderTarget(target)
dxSetBlendMode("modulate_add")
dxDrawImage(0, 0,width2*x,h*y,"misc/bg.png")
--dxDrawImage(fix3+sx2, hd*y+h/2*y,width*x,h*y,"misc/bg.png")
--dxDrawRectangle(sx, hd*y,width*x,y*0.03,tocolor(70,70,70,150))
--dxDrawRectangle(sx, hd*y,width*x,h*y,tocolor(0,0,0,180))
local width22 = dxGetTextWidth("Toptimes ", 1*scale,sansb)
local width33 = dxGetTextWidth(mapname,1*scale,sansd)
dxDrawText("Toptimes ", 0+fix4+((width3*x)/2)-width33/2-width22,0+fixy3,width+fix4,0+y*0.025+fixy3,tocolor(255,255,255,255),1*scale,sansb,"left","center")
dxDrawText(mapname, 0+fix4+(width3*x/2)-width33/2,0+fixy3,width+fix4,0+y*0.025+fixy3,tocolor(255,255,255,255),1*scale,sansd,"left","center")
--[[dxDrawText("#",fix+sx+x*0.01,fixy+y*0.05+ hd*y+y*0.01,width*x+sx,fixy+y*0.05+hd*y,tocolor(255,255,255,255),1*scale,sansb,"left","center",false,false,true,true,true)
dxDrawText("Name",fix+sx+x*0.025,fixy+y*0.05+ hd*y+y*0.01,width*x+sx,fixy+y*0.05+hd*y,tocolor(255,255,255,255),1*scale,sansb,"left","center",false,false,true,true,true)
dxDrawText("Time",fix+sx+x*0.145,fixy+y*0.05+ hd*y+y*0.01,width*x+sx,fixy+y*0.05+hd*y,tocolor(255,255,255,255),1*scale,sansb,"left","center",false,false,true,true,true)
dxDrawText("Location",fix+sx+x*0.2,fixy+y*0.05+ hd*y+y*0.01,width*x+sx,fixy+y*0.05+hd*y,tocolor(255,255,255,255),1*scale,sansb,"left","center",false,false,true,true,true)
dxDrawText("Date",fix+sx+x*0.26,fixy+y*0.05+ hd*y+y*0.01,width*x+sx,fixy+y*0.05+hd*y,tocolor(255,255,255,255),1*scale,sansb,"left","center",false,false,true,true,true)
]]
local flagwidth = 15/1280*x
local flagheight = 10/720*y
local fwidth = dxGetTextWidth("Location", 1*scale,sansb)
local base = base or 1
local tablefind = nil
for i=base, base+7 do
if not defaultTable[i] then
defaultTable[i] = {serial="...",name="-- Empty --",time=0,country="ZZ",date=getRealTime().timestamp}
end
local serial = defaultTable[i].serial or ""
local name = defaultTable[i].name or "-- Empty --"
local time = defaultTable[i].time or 0
local date = defaultTable[i].date or getRealTime().timestamp
local country = defaultTable[i].country or "ZZ"
if serial == getPlayerSerial(localPlayer) then
--dxDrawRectangle(sx,y*0.04+hd*y+y*0.005 +(y*0.025*(i-base+1)),width*x,y*0.025,tocolor(100,100,100,50))
--dxDrawImage(fix+sx,fixy+y*0.04+hd*y+y*0.005 +(y*0.025*(i-base+1)),width*x,y*0.025,"misc/chosen.png",0,0,0,tocolor(255,255,255,255))
dxDrawRectangle(0+fix4,fixy+0+y*0.045+(y*0.025*(i-base+1)),width-fix5,y*0.025,tocolor(10,10,10,100))
end
dxDrawText(i,startX2+space,fixy+y*0.04+ hd*y+y*0.01 + (y*0.025*(i-base+1)),width*x+sx,fixy+y*0.04+hd*y+(y*0.025*(i+1-base+1)),tocolor(255,255,255,255),1*scale,sansd,"left","center",false,false,true,true,true)
dxDrawText(defaultTable[i].name,startX2+space+topspace+space,y*0.04+ hd*y+fixy+y*0.01 + (y*0.025*(i-base+1)),width*x+sx,fixy+y*0.04+hd*y+(y*0.025*(i+1-base+1)),tocolor(255,255,255,255),1*scale,sansb,"left","center",false,false,true,true,true)
if time then
if time == 0 then
ms,min,sec = "---","--","--"
else
time = tostring(defaultTable[i].time)
ms = tostring(math.round(tonumber((time/1000 - ("%02d"):format(time/1000))*1000)))
min = (((time-ms)/1000)/(60))
diff = (min - math.floor(min))*60
ms = ("%03d"):format(tostring(math.round(ms)))
min = ("%02d"):format(tostring(math.round(min)))
sec = ("%02d"):format(tostring(math.round(diff)))
end
dxDrawText(min..":"..sec..":"..ms,startX2+space+topspace+space+namespace+space,fixy+hd*y+y*0.05 + (y*0.025*(i-base+1)),width*x+sx,fixy+y*0.04+hd*y+(y*0.025*(i+1-base+1)),tocolor(255,255,255,255),1*scale,sansd,"left","center",false,false,true,true,true)
end
--dxDrawText(defaultTable[i].country,sx+x*0.01,y*0.04+ hd*y+y*0.01 + (y*0.025*i),width*x+sx,y*0.04+hd*y+(y*0.025*(i+1)),tocolor(255,255,255,255),0.55,semibold,"left","center",false,false,true,true)
if defaultTable[i].country:lower()~="zz" then
dxDrawImage(startX2+space+topspace+space+namespace+space+timespace+space+flagwidth/2,fixy+hd*y+y*0.057+(y*0.025*(i-base+1))-flagheight/2,flagwidth,flagheight,"flags/"..defaultTable[i].country:lower()..".png",0,0,0,tocolor(220,220,220,255),true)
end
local time = getRealTime(defaultTable[i].date)
local str = time.monthday or 1
local months = {"Jan","Feb","March","April","May","June","July","Aug","Sep","Oct","Nov","Dec"}
local str = str.."."..(time.month+1)
local str = str.."."..time.year+1900
dxDrawText(str,startX2+space+topspace+space+namespace+space+timespace+space+flagspace+space,y*0.04+fixy+ hd*y+y*0.01 + (y*0.025*(i-base+1)),width*x+sx,fixy+y*0.04+hd*y+(y*0.025*(i+1-base+1)),tocolor(255,255,255,255),1*scale,sansd,"left","center",false,false,true,true,true)
end
for a=1, table.size(defaultTable) do
if defaultTable[a] then
if defaultTable[a].serial == getPlayerSerial(localPlayer) then
local a,b = a,9
dxDrawRectangle(0+fix4,0+y*0.085 +(y*0.025*(b)),width-fix5,y*0.025,tocolor(10,10,10,100))
dxDrawText(a,startX2+space,fixy+y*0.04+ hd*y+y*0.01 + (y*0.025*(b)),width*x+sx,fixy+y*0.04+hd*y+(y*0.025*(b+1)),tocolor(255,255,255,255),1*scale,sansd,"left","center",false,false,true,true,true)
dxDrawText(defaultTable[a].name,startX2+space+topspace+space,y*0.04+ hd*y+fixy+y*0.01 + (y*0.025*(b)),width*x+sx,fixy+y*0.04+hd*y+(y*0.025*(b+1)),tocolor(255,255,255,255),1*scale,sansb,"left","center",false,false,true,true,true)
local time = tostring(defaultTable[a].time)
local ms = tostring(math.round(tonumber((time/1000 - ("%02d"):format(time/1000))*1000)))
local min = (((time-ms)/1000)/(60))
local diff = (min - math.floor(min))*60
local ms = ("%03d"):format(tostring(math.round(ms)))
local min = ("%02d"):format(tostring(math.round(min)))
local sec = ("%02d"):format(tostring(math.round(diff)))
if tonumber(time) == 0 then
dxDrawText("--:--:---",startX2+space+topspace+space+namespace+space,fixy+hd*y+y*0.05 + (y*0.025*(b)),width*x+sx,fixy+y*0.04+hd*y+(y*0.025*(b+1)),tocolor(255,255,255,255),1*scale,sansd,"left","center",false,false,true,true,true)
else
dxDrawText(min..":"..sec..":"..ms,startX2+space+topspace+space+namespace+space,fixy+hd*y+y*0.05 + (y*0.025*(b)),width*x+sx,fixy+y*0.04+hd*y+(y*0.025*(b+1)),tocolor(255,255,255,255),1*scale,sansd,"left","center",false,false,true,true,true)
end
local time = getRealTime(defaultTable[a].date)
local str = time.monthday or 1
local months = {"Jan","Feb","March","April","May","June","July","Aug","Sep","Oct","Nov","Dec"}
local str = str.."."..(time.month+1)
local str = str.."."..time.year+1900
dxDrawText(str,startX2+space+topspace+space+namespace+space+timespace+space+flagspace+space,y*0.04+fixy+ hd*y+y*0.01 + (y*0.025*(b)),width*x+sx,fixy+y*0.04+hd*y+(y*0.025*(b+1)),tocolor(255,255,255,255),1*scale,sansd,"left","center",false,false,true,true,true)
if defaultTable[a].country:lower()~="zz" then
dxDrawImage(startX2+space+topspace+space+namespace+space+timespace+space+flagwidth/2,fixy+hd*y+y*0.057+(y*0.025*(b))-flagheight/2,flagwidth,flagheight,"flags/"..defaultTable[a].country:lower()..".png",0,0,0,tocolor(255,255,255,255),true)
end
end
end
end
--dxDrawText("Test Text", x*0.4,y*0.5,x,y,tocolor(255,255,255,255),6.1,"clear","left","top",false,false,true,true,true)
--dxDrawText("Test Text", x*0.4,y*0.65,x,y,tocolor(255,255,255,255),1,clear,"left","top",false,false,true,true,true)
dxSetRenderTarget()
dxSetBlendMode("blend")
if target then
--dxDrawImage(startX, hd*y,width2*x,h*y,target)
--dxDrawMaterialLine3D(nX,nY,nZ,nX2,nY2,nZ2,mat,width2*x)
--dxDrawMaterialLine3D(nX,nY,nZ,nX2,nY2,nZ2,target,width2*x)
end
end