Bc# Posted November 3, 2012 Author Posted November 3, 2012 Cuando usas DirectX, tenes que usar posiciones en "absolute".Una posicion absolute seria asi: 500, 500, 100, 200 Una en relative seria algo asi: 0.05, 0.8, 0.65, 0.15 Eh probado muchas posisiones y multiples tamaños y aun no consigo nada. function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, endID = iEnd, imgID = 1, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for _, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do local gifData = getElementData ( gif, "gifData" ) if ( gifData ) then if ( currentTick - gifData.tick >= gifData.speed ) then gifData.tick = currentTick gifData.imgID = ( gifData.imgID + 1 ) if gifData.imgID > gifData.endID then gifData.imgID = 1 end setElementData ( gif, "gifData", gifData ) end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) end end end ) gif = dxDrawGifImage ( 769, 175, 193, 145, "img/logo", 13, "png", 60 ) Si puedes ves estoy usando la misma posision que sugeriste en el wiki, pero nisiquiera haci logra aparecer alguna imagen.
Castillo Posted November 3, 2012 Posted November 3, 2012 Subi el recurso en un .zip a mediafire.com y postea el link, asi lo pruebo.
Bc# Posted November 3, 2012 Author Posted November 3, 2012 http://www.mediafire.com/?eovb4xcdw3xbhvt Ahi esta. Ahora ultimo estube probando algo, con este script pude proyectar la primera imagen en el servidor pero la animacion es lo que me complica. local sWidth,sHeight = guiGetScreenSize() gif = dxDrawGifImage (sWidth*0.75,sHeight*-0.03,sWidth*0.3,sHeight*0.3, "img/logo1.png", 20, 120 )
Castillo Posted November 3, 2012 Posted November 3, 2012 Lo que paso es que alguien modifico mi funcion ( dxDrawGifImage ) y la modifico mal, porque ya no funciona. function dxDrawGifImage ( x, y, w, h, path, iStart, iType, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, startID = iStart, imgID = iStart, imgType = iType, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for index, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do local gifData = getElementData ( gif, "gifData" ) if ( gifData ) then if ( currentTick - gifData.tick >= gifData.speed ) then gifData.tick = currentTick gifData.imgID = ( gifData.imgID + 1 ) if ( fileExists ( gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) ) then gifData.imgID = gifData.imgID setElementData ( gif, "gifData", gifData ) else gifData.imgID = gifData.startID setElementData ( gif, "gifData", gifData ) end end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) end end end ) gif = dxDrawGifImage ( 769, 175, 193, 145, "img/logo", 1, "png", 60 ) Funca perfecto.
Bc# Posted November 3, 2012 Author Posted November 3, 2012 Lo que paso es que alguien modifico mi funcion ( dxDrawGifImage ) y la modifico mal, porque ya no funciona. function dxDrawGifImage ( x, y, w, h, path, iStart, iType, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, startID = iStart, imgID = iStart, imgType = iType, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for index, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do local gifData = getElementData ( gif, "gifData" ) if ( gifData ) then if ( currentTick - gifData.tick >= gifData.speed ) then gifData.tick = currentTick gifData.imgID = ( gifData.imgID + 1 ) if ( fileExists ( gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) ) then gifData.imgID = gifData.imgID setElementData ( gif, "gifData", gifData ) else gifData.imgID = gifData.startID setElementData ( gif, "gifData", gifData ) end end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) end end end ) gif = dxDrawGifImage ( 769, 175, 193, 145, "img/logo", 1, "png", 60 ) Funca perfecto. ¿Seguro que ese es el script? Yo lo probe y nada.
Castillo Posted November 3, 2012 Posted November 3, 2012 Si, lo probe en mi servidor local y funciono.
Bc# Posted November 3, 2012 Author Posted November 3, 2012 Se lo pase a un amigo para que lo probara y tampoco le funciono. ¿Me podrias pasar elq ue tu isiste?
Castillo Posted November 3, 2012 Posted November 3, 2012 Ese que poste es el que yo use y funciono. Capaz que no aparece en tu resolucion, yo uso 1024 * 768.
Bc# Posted November 3, 2012 Author Posted November 3, 2012 Ese que poste es el que yo use y funciono.Capaz que no aparece en tu resolucion, yo uso 1024 * 768. Si ese era el problema funciona perfect muchas grasias C:
iFoReX Posted November 3, 2012 Posted November 3, 2012 intente hacer el mio, tome posiciones de una imagen de test, pero no aparece el gif D: function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, endID = iEnd, imgID = 1, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for _, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do local gifData = getElementData ( gif, "gifData" ) if ( gifData ) then if ( currentTick - gifData.tick >= gifData.speed ) then gifData.tick = currentTick gifData.imgID = ( gifData.imgID + 1 ) if gifData.imgID > gifData.endID then gifData.imgID = 1 end setElementData ( gif, "gifData", gifData ) end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) end end end ) gif = dxDrawGifImage ( 504, 29, 105, 75, "img/logo", 33, "png", 60 )
Castillo Posted November 3, 2012 Posted November 3, 2012 Estas usando la funcion que algun pelo**** edito, copiala de nuevo de la wiki, puse de nuevo la mia original.
Bc# Posted November 5, 2012 Author Posted November 5, 2012 aparece pero se queda en la primera imagen D: Podrías probar con esto. gif = dxDrawGifImage ( 504, 29, 105, 75, "img/logo", 1, "png", 120 ) No estoy seguro pero el argumento que tenias en 33 debe estar en 1 o 0 dependiendo de el numero con el que comiese la primera imagen del ciclo. ejemplo: si tu primera imagen es logo0 usas: gif = dxDrawGifImage ( 504, 29, 105, 75, "img/logo", 0, "png", 120 ) y si es logo1 usas: gif = dxDrawGifImage ( 504, 29, 105, 75, "img/logo", 0, "png", 120 ) y por experiencia propia yo recomiendo usar 120 en el argumento de effectspeed por que sino va muy rápido el gif y no da tiempo de verlo. PD: Si quieres que funcione usa la funcion del wiki.
Recommended Posts