Page 2 of 3
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Sat Sep 14, 2013 3:41 am
by jassing
Running the example; I got an IMA on
\Texture=CreateTexture(#PB_Any, Width, Height)
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Sat Sep 14, 2013 8:23 am
by Poshu
Mythros wrote:Still, I want to stick with what I know. I don't like upgrading alot.
More reason to go 5.20 then, it's LTS :D
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Sat Sep 14, 2013 11:08 am
by luis
Mythros wrote:Can you PLEASE make this work with version 5.1?
IMHO asking someone to make his T&T work with past versions of the compiler is going too far.
Install the beta, try the code, decide if you like it, if the answer is yes try to understand how it works (it's one thing programmers do) and convert it for PB 5.11 if it's possible.
You will get the benefit of knowing the code and you will acquire the ability to modify and enhance it. All this in exchange for some time well spent.
Time eddy should probably spend on something else instead.
On a side note: one nice thing about PB being not well known is that when you find code in another language elsewhere you need to understand it at least a little and then convert it.
It's full of copy/paste programmers in C/C+ forums, and I think this is very unhealthy for them and for the programming world in general.
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Sat Sep 14, 2013 3:29 pm
by Mythros
I'm not downloading 5.20. I am learning how to use what I am comfortable with tyvm.. -.-
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Sun Sep 22, 2013 10:58 pm
by eddy
Updated
- updated: Example 1
- updated: SetSpriteFrame with new "turned frame" parameter
- added: Skew & Deform Sprite
- fixed: FlipSprite updates hotspot position now
Re: Sprite3D: Atlas,View,Layer,HotSpot
Posted: Wed Sep 25, 2013 4:26 pm
by Danilo
eddy wrote:
Some problems on Mac OS X, for example the text "Atlas" is not displayed.
Sometimes I get weird stuff displayed. Not at every start, maybe every 3rd or 4th run.
Find the differences in the images.

Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Wed Sep 25, 2013 4:35 pm
by eddy
Calculation of Sprite Quad position is correct
but 2DDrawing on TextureOutput seems to be buggy on MacOSX:
- RGB or RGBA color is reverse

- DrawText does not work

I'll post a tiny sample code to confirm this issue.
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Thu Sep 26, 2013 7:02 am
by Thorium
eddy wrote:
but 2DDrawing on TextureOutput seems to be buggy on MacOSX:
RGB or RGBA color is reverse
Thats nor realy a bug. On MacOSX the channel order is different. On Windows ist BGR on MacOSX it's RGB.
I havent looked at you code, it's only a bug if you use the RGB command, that should allways work correctly.
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Thu Sep 26, 2013 5:56 pm
by Danilo
Thorium wrote:eddy wrote:
but 2DDrawing on TextureOutput seems to be buggy on MacOSX:
RGB or RGBA color is reverse
Thats nor realy a bug. On MacOSX the channel order is different. On Windows ist BGR on MacOSX it's RGB.
I havent looked at you code, it's only a bug if you use the RGB command, that should allways work correctly.
He is using RGB()/RGBA() for all colors. Maybe channel order is different from desktop GUI with 3D Engine (OpenGL).
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Sat Sep 28, 2013 7:48 pm
by eddy
preview
- layer shadow casting
- reorder layers and shadows

Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Sun Sep 29, 2013 2:23 pm
by eddy
updated
- SetLayerOrder
- SetLayerShadow
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Wed Oct 02, 2013 11:46 pm
by zxtunes.com
Thank you Eddy. Very interesting engine.
But I have to say - you have it too complicated. You made layers and animation - and I suddenly did not know how I upload a regular single sprite. The fact that PB makes a team, you're doing with a 10. And it spawns a bunch of dependencies.
For example, I asked a Hot Spot for a sprite, and it affected the other instances.
It's very unusual.
Your example is very complicated. I recommend to do something more simple and real-time traffic - otherwise spectacular work.
Ideally, you need one powerful example that shows all the features. And as a few simple examples.
And now I'm going to ask the most important question for me.
Is it possible to draw sprites in other sprites?
Let's say I have a polygon. I can change its shape (distortion), that would set up an even rectangle for the image of the projector. And I want to display this polygon rotating about its axis in the sprite.
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Wed Oct 02, 2013 11:50 pm
by zxtunes.com
I noticed a bug. Skew mix sprite from the center. It turns out that the Skew + Rotate = useless.
At the same time, Scale + Rotate working properly.
Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Wed Apr 02, 2014 10:43 pm
by idle
I had a look on linux x64 with Pb5.22 LTS
it had an IMA on line 866 with GetMeshData
changing line 864 to
Code: Select all
Dim vertices.PB_MeshVertex(MeshVertexCount(\Mesh))
made the problem go away
although the colors in the test aren't the same as your example

Re: SpriteEngine: Atlas,View,Layer,HotSpot,Flip,Animation,FX
Posted: Sat Jun 21, 2014 5:43 pm
by eddy
zxtunes.com wrote:I noticed a bug. Skew mix sprite from the center. It turns out that the Skew + Rotate = useless.
At the same time, Scale + Rotate working properly.
There's no bug
Code: Select all
; ******************************************
; EXAMPLE1 - ROTATING SKEW SPRITE
; ******************************************
CompilerIf #PB_Compiler_IsMainFile
DisableExplicit
If InitEngine3D()=0 Or InitSpriteEngine()=0
MessageRequester("Init", "Failed!")
End
EndIf
AntialiasingMode(#PB_AntialiasingMode_None)
win=OpenWindow(#PB_Any, 0, 0, 800, 600, "Sprite Engine FX", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(win), 0, 0, WindowWidth(win), WindowHeight(win))
;draw sprite image atlas
fontID=LoadFont(0, "Arial", 22, #PB_Font_Bold|#PB_Font_HighQuality|#PB_Font_Italic)
spriteAtlas=CreateAtlas(#PB_Any, 128, 128)
If StartDrawing(AtlasOutput(spriteAtlas))
DrawingMode(#PB_2DDrawing_AlphaBlend)
FrontColor(RGBA(200, 110, 20, 255))
Box(0, 0, 128, 128)
StopDrawing()
EndIf
;define sprite frames (with centered hotspot)
squareFrame=SetAtlasFrame(spriteAtlas, #PB_Any, 5, 5, 16, 64,8,32)
dotFrame=SetAtlasFrame(spriteAtlas, #PB_Any, 5, 5, 2,2 ,1 ,1)
;create front view
frontView=CreateView(#PB_Any, RGB(62, 62, 62), #False, 0, 0, 64.0, 85.34)
Debug "View Camera="+ViewCameraY(frontView)+","+ViewCameraX(frontView)+","+ViewCameraWidth(frontView)+","+ViewCameraHeight(frontView)
If frontView
;add layer
newLayer=CreateLayer(#PB_Any, frontView, AtlasID(spriteAtlas))
;dot sprites
dot=CreateAnimatedSprite(#PB_Any, newLayer, 224, 153, dotFrame)
SetSpriteColor(dot,RGBA(10, 156, 63, 255))
;skew sprites
rotatingSprite=CreateAnimatedSprite(#PB_Any, newLayer, 224, 153, squareFrame)
SkewSprite(rotatingSprite, 32, -32)
EndIf
Repeat
RenderSprites()
RenderWorld()
RotateSprite(rotatingSprite,1)
FlipBuffers()
Until WaitWindowEvent(1)=#PB_Event_CloseWindow
End
CompilerEndIf