Page 1 of 1
Flip Sprite ???
Posted: Wed Sep 25, 2013 11:47 am
by DaylightDreamer
Is it possible to have something like FlipSprite or Mirror sprite function ? All OS
Or at least something to invert the 3D sprite polygon so it doesn't disappear when you try to flip it using the TransformSprite function.
Re: Flip Sprite ???
Posted: Wed Sep 25, 2013 12:03 pm
by STARGÅTE
but only optional, like TransformSprite(Sprite, x1, y1 ..., z4[, ShowBackSide]), I have written a small 3D-Engine with TransformSprite(), and I don't want to see the back side of my Sprites

.
But yes, it would be nice to flip a Sprite with ZoomSprite(Sprite, -256, 256) or with ClipSprite(Sprite, 100, 0, -100, 100).
Re: Flip Sprite ???
Posted: Wed Sep 25, 2013 4:58 pm
by DaylightDreamer
Another possible solution also could be is to have access to the polygons normals.
Re: Flip Sprite ???
Posted: Sun Oct 13, 2013 6:12 pm
by thyphoon
+1
I don't understand why not always simple solution to enable/disable backface culling when use transformsprite (All Os)
Fred Pleeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaaaase !!

Re: Flip Sprite ???
Posted: Mon Oct 14, 2013 6:11 am
by thyphoon
I found this way for 5.20 on windows.
press space to flip sprite
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 800, 600, "", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,WindowWidth(0),WindowHeight(0))
;Disable Backface Culling
; from
http://www.forums.purebasic.com/english ... 16&t=43718
; thanks Innesoft
Define pd3d.IDirect3DDevice9
EnableASM
!extrn _PB_Screen_Direct3DDevice
!MOV dword EAX, [_PB_Screen_Direct3DDevice]
!MOV dword [v_pd3d],EAX
DisableASM
pd3d\SetRenderState(22,1)
pd3d\SetRenderState(7,0)
;-create sprite
CreateSprite(0,128,128)
StartDrawing(SpriteOutput(0))
Circle(32,32,64,#Red)
Box(64,32,64,32,#Green)
StopDrawing()
Repeat
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
EndSelect
Until Event=0
ExamineKeyboard()
ClearScreen(#Black)
If KeyboardPushed(#PB_Key_Space)
TransformSprite(0,SpriteWidth(0),0,0,0,0,SpriteHeight(0),SpriteWidth(0),SpriteHeight(0))
Else
TransformSprite(0,0,0,SpriteWidth(0),0,SpriteWidth(0),SpriteHeight(0),0,SpriteHeight(0))
EndIf
DisplaySprite(0,32,32)
FlipBuffers()
Delay(1)
ForEver
But i have no solution for Linux/MacOsX

Re: Flip Sprite ???
Posted: Tue Oct 29, 2013 11:38 am
by DaylightDreamer
Thanks in PB 5.20 SpriteOutput drawing works ok now so its possible to create flipped sprite instance using Drawing functions .
Re: Flip Sprite ???
Posted: Sat Nov 23, 2013 2:51 pm
by thyphoon
DaylightDreamer wrote:Thanks in PB 5.20 SpriteOutput drawing works ok now so its possible to create flipped sprite instance using Drawing functions .
Yes, but it's very slow and you must to copy the orginal sprite ...
it is a shame not to use the hardware facilities
Re: Flip Sprite ???
Posted: Sun Jun 22, 2014 3:40 am
by eddy
STARGÅTE wrote:but only optional, like TransformSprite(Sprite, x1, y1 ..., z4 [, ShowBackSide])
But yes, it would be nice to flip a Sprite with: ZoomSprite(Sprite, -256, 256) or ClipSprite(Sprite, 100, 0, -100, 100).
+1
Re: Flip Sprite ???
Posted: Fri Oct 10, 2014 5:39 pm
by Lebostein
Yes, that is a shame. After 14 years PureBasic there is no function to mirror a sprite in an easy way...
The workaround with TransformSprite, is this possible with Win, Mac and Linux?
Re: Flip Sprite ???
Posted: Mon Jun 25, 2018 4:31 pm
by bfernhout
Damn.
Its not working for me. When i hit the spacebar it blank out the screen. Or maybe i see the backside of the sprite.
I am using PB 5.62 on a win 8.1 system 16 Gb mem,i7 core intel(64 bits). Nvidea Geforce 950m
There must be something i miss.
Bart.