Fabioxps Posted February 2, 2015 Share Posted February 2, 2015 when I set a visible image others disappear. Direct3D = {} Direct3D.__index = Direct3D rot,width,height,x,y = 600,800,800,guiGetScreenSize() visible = {} local Instance = {} function Direct3D(id,width,height,shader,image,rot) if Instance[id] == nil then Instance[id] = {} shader = dxCreateShader(shader) renderTarget = dxCreateRenderTarget(width,height,true) Instance[id].shader = shader Instance[id].renderTarget = renderTarget Instance[id].image = image Instance[id].rot = rot Instance[id].width = width Instance[id].height = height Instance[id].continuos = "" end end function up() for k,v in pairs(Instance) do dxSetRenderTarget(Instance[k].renderTarget,true) dxDrawImage(0,0,Instance[k].width,Instance[k].height,Instance[k].image) dxSetRenderTarget() dxSetShaderValue(Instance[k].shader,"Instance",Instance[k].renderTarget) end end addEventHandler("onClientRestore", root, function() up() end) Container3D_A = function() for k,v in pairs(Instance) do if Instance[k].rot == 600 or Instance[k].rot == 270 then return end up() dxSetShaderTransform(Instance[k].shader,0-Instance[k].rot,0,0) dxDrawImage(x/2-Instance[k].width/2-Instance[k].rot,y/2-Instance[k].height/2,Instance[k].width,Instance[k].height,Instance[k].shader) end end addEventHandler("onClientPreRender",root,Container3D_A) B = function() for k,v in pairs(Instance) do if Instance[k].continuos == true then Instance[k].rot = Instance[k].rot - 4 if Instance[k].rot < 0 then Instance[k].rot = 0 end end end end addEventHandler("onClientPreRender",root,B) C = function() for k,v in pairs(Instance) do if Instance[k].continuos == false then Instance[k].rot = Instance[k].rot + 4 if Instance[k].rot > 600 then Instance[k].rot = 600 end end end end addEventHandler("onClientPreRender",root,C) function addEve(id,bool) if Instance[id] ~= nil then Instance[id].continuos = bool end end Direct3D("1",800,800,"Efect/EFECTS.fx","Texture/rotatioIMG.png",600) addEve("1",true) Direct3D("2",800,800,"Efect/EFECTS.fx","Texture/rotatioIMG.png",600) setTimer(function() --kkk:addEve(true) -- addEve("1","-") end,8000,1) setTimer(function() addEve("2",true) -- kk:addEve(false) end,5000,1) Link to comment
Fabioxps Posted February 2, 2015 Author Share Posted February 2, 2015 maybe I should use createElement as table? 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