j'ai testé sur ta démo, mais visiblement, le zoom ne marche plus on dirait.
Code : Tout sélectionner
IncludeFile "EXT_sprite3D.pbi"
;{ global
Global quit.b,event.i
Global red.i,green.i,blue.i
Global sprite.i,spriteBis.i
Global sprite3d.i,sprite3dBis.i, newsizeX.f=1,newsizeY.f=1
;}
;{ init
InitSprite()
InitSprite3D()
InitKeyboard()
UsePNGImageDecoder()
; Open a 640x480 windowed screen
OpenWindow(0, 0, 0, 640, 480, "Extended Sprite 3D", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 640, 480, 0, 0, 0, #PB_Screen_SmartSynchronization)
;}
;{ Load a sprites sheet, i.e. a big image containing all the frames of the animation.
LoadSprite(0,"shado.png",#PB_Sprite_Texture|#PB_Sprite_AlphaBlending)
EXT_CreateSprite3D(0,0)
EXT_SetHandleSprite3D(0,115,68)
EXT_SetTransformHandle(0,#True)
; NB: it's better (faster) if the image's width and height are powers of 2.
sprite = LoadSprite(#PB_Any, "chara.png", #PB_Sprite_Texture)
; Creates the EXT_sprite3D from the image
sprite3d = EXT_CreateSprite3D(#PB_Any, sprite)
EXT_SetHandleSprite3D(sprite3d,128,230); Position its handle in its center
EXT_SetTransformHandle(sprite3d,#True)
;EXT_ZoomSprite3D(sprite3d,0.5,0.5); Resize it to 128x128
; Load and create another sprite
spriteBis = LoadSprite(#PB_Any, "robot.png", #PB_Sprite_Texture)
sprite3dBis = EXT_CreateSprite3D(#PB_Any, spriteBis)
; Resize it to 200x200
;EXT_ZoomSprite3D(sprite3dBis,3,3)
; Set its pivot outside of its boundary
EXT_SetHandleSprite3D(sprite3dBis,-50,50)
; Make it semi-transparent
EXT_SetAlphaSprite3D(sprite3dBis,200)
EXT_SetTransformHandle(sprite3dBis,#True)
;}
;{ Main loop
Repeat
Delay(1)
Repeat
; Process the windows events
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
Quit = #True
EndSelect
Until Event = 0
; Keyboard
If ExamineKeyboard()
If KeyboardReleased(#PB_Key_H)
EXT_FlipHoriSprite3D(sprite3d)
EndIf
If KeyboardReleased(#PB_Key_V)
EXT_FlipVertSprite3D(sprite3d)
EXT_FlipVertSprite3D(0)
EndIf
If KeyboardReleased(#PB_Key_Add)
newsizeX + 0.1 : newsizeY + 0.1
EXT_ZoomSprite3D(sprite3d,newSizeX,newSizeY)
ElseIf KeyboardReleased(#PB_Key_Subtract)
newsizeX - 0.1 : newsizeY - 0.1
EXT_ZoomSprite3D(sprite3d,newSizeX,newSizeY)
EndIf
If KeyboardPushed(#PB_Key_Escape)
Quit = #True
EndIf
EndIf
; Every 100ms, clip the first sprite for animation
If ElapsedMilliseconds() - oldTimer > 100
oldTimer = ElapsedMilliseconds()
xclip+50
If xclip >= 250
xclip = 0
yclip+50
EndIf
If xclip = 150 And yclip = 50
xclip = 0
yclip = 0
EndIf
EXT_ClipSprite3D(sprite3D,xclip,yclip,xclip+49,yclip+49)
EndIf
; Rotate and color the big transparent sprite
angle + 1
EXT_RotateSprite3D(sprite3dBis,Radian(angle/3))
red = 128+127*Cos(Radian(angle))
blue = 128+127*Sin(Radian(angle))
green = 255 - red - blue
If green < 0
green = 0
EndIf
EXT_SetColorSprite3D(sprite3dBis,RGB(red,green,blue))
; Clear the screen and draw some line to indicate the screen's center
ClearScreen(RGB(125,125,125))
StartDrawing(ScreenOutput())
Line(320,0,1,480)
Line(0,240,640,1)
DrawText(2,0,"H - Horizontal flip")
DrawText(2,15,"V - Vertical Flip")
DrawText(2,30,StrF(newsizeX)+" / "+StrF(newsizeY))
StopDrawing()
; Display the sprites
Start3D()
EXT_DisplaySprite3D(0,320,240+18)
EXT_DisplaySprite3D(sprite3d,320,240)
EXT_DisplaySprite3D(sprite3dBis,320,240)
Stop3D()
FlipBuffers()
Until Quit = #True
;}