As of revision 538, the rendering2D engine is recoded to give better performance, smoother animations and basicly make life of us developers easier when we want to put our graphics onto the screen using the PushButton Game Engine.
The changes in a nutshell
- The Scene2DComponent class has been replaced by the DisplayObjectScene class.
- The Scene2DBitmapDataComponent class has been replaced by the
BitmapDataScene class. - The basic rendering is done using the DisplayObjectRenderer class that has a scene property
- The DisplayObjectRenderer has multiple properties that can be used to influence the drawing without linking it to a spatial
- position can be used to set the X/Y scene (screen) coordinates of the object (! not world coordinates)
- scale can be used to resize the object ( 1 = 100% )
- rotation can be used to rotate the object ( in degrees )
- alpha can be used to set the object’s transparancy
- layerIndex can be used to set the object’s layer
- zIndex can be used to set the object’s depth within the layer
- registrationPoint indicates the pivot point of this object. With the SpriteRenderer for example the center of the image is used as the registrationPoint so the sprite is centered upon its position and will rotate around its center.
- Each of those DisplayObjectRenderer properties has a corresponding
{property}Property of the PropertyReference type
we have a positionProperty, scaleProperty, rotationProperty, alphaProperty, layerIndexProperty, zIndexProperty and a registrationPointProperty.
For example , a SimpleSpatialComponent can be used to move or rotate the object using the positionProperty and rotationProperty. - If the positionProperty is used and the scene attribute of the renderer is set, the referenced coordinates are treated as worldcoordinates and will be transformed to the scene.
- There is a SpriteSheetRenderer class that can be used to draw spritesheet animations
- There is a SpriteRenderer class that can be used to draw a sprite on screen
- The static Global class has been renamed to PBE ( com.pblabs.engine.PBE ).
- There is a PBE.initializeScene function to quickly setup your scene.
- Find the scene you created with PBE.initializeScene using PBE.getScene()
- Find the spatialManager you created with PBE.initializeScene using PBE.getSpatialManager()
I have recoded the examples from the earlier posts.
Recoding : Create an animated spritesheet
Original post : Create an animated spritesheet
Download the 538+ code for AnimatedSprite01
Download the 538+ code and download the resources for AnimatedSprite02
Recoding : The PBEngine Scene2D BitmapData Component
Original post : The PBEngine Scene2D BitmapData Component
Download the 538+ code and download the resources for AnimatedSprite03
Tags: PBEngine
Thanks for the post. I’ve been going crazy trying to get Lesson 2 to work from the PBE site. For awhile, I thought it had something to do with my somewhat off-beat development environment setup. I wonder when these changes will make it into the docs. I’d be happy to help with the task, but I don’t know if I understand it enough yet.
very thanks! I’m crazy for understanding PBE until find this blog!