Flip Sprite ???
-
- User
- Posts: 52
- Joined: Wed Feb 04, 2009 8:11 am
- Location: Armenia
Flip Sprite ???
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.
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 ???
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).
But yes, it would be nice to flip a Sprite with ZoomSprite(Sprite, -256, 256) or with ClipSprite(Sprite, 100, 0, -100, 100).
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
-
- User
- Posts: 52
- Joined: Wed Feb 04, 2009 8:11 am
- Location: Armenia
Re: Flip Sprite ???
Another possible solution also could be is to have access to the polygons normals.
Re: Flip Sprite ???
+1
I don't understand why not always simple solution to enable/disable backface culling when use transformsprite (All Os)
Fred Pleeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaaaase !!
I don't understand why not always simple solution to enable/disable backface culling when use transformsprite (All Os)
Fred Pleeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaaaase !!
Re: Flip Sprite ???
I found this way for 5.20 on windows.
press space to flip sprite
press space to flip sprite
But i have no solution for Linux/MacOsXInitSprite()
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
-
- User
- Posts: 52
- Joined: Wed Feb 04, 2009 8:11 am
- Location: Armenia
Re: Flip Sprite ???
Thanks in PB 5.20 SpriteOutput drawing works ok now so its possible to create flipped sprite instance using Drawing functions .
Re: Flip Sprite ???
Yes, but it's very slow and you must to copy the orginal sprite ...DaylightDreamer wrote:Thanks in PB 5.20 SpriteOutput drawing works ok now so its possible to create flipped sprite instance using Drawing functions .
it is a shame not to use the hardware facilities
Re: Flip Sprite ???
+1STARGÅ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).
win10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Re: Flip Sprite ???
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?
The workaround with TransformSprite, is this possible with Win, Mac and Linux?
Re: Flip Sprite ???
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.
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.
From my first self made computer till now I stil like computers.