Kigs Framework  Doc version 0.8
Open source multi purpose Rapid Application Development framework
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Base2DLayer Class Referenceabstract

#include <Base2DLayer.h>

Inheritance diagram for Base2DLayer:
Abstract2DLayer Scene3D Node3D SceneNode CoreModifiable GenericRefCountedBaseClass

Public Member Functions

 Base2DLayer (const kstl::string &name, DECLARE_CLASS_NAME_TREE_ARG)
 constructor More...
 
void addCamera (CoreModifiable *) override
 no camera for 2D Layer, throw an error
 
bool removeCamera (CoreModifiable *) override
 no camera for 2D Layer, throw an error
 
virtual void updateLayerFromBuffer (unsigned char *buffer, unsigned int width, unsigned int height, kstl::string name, TinyImage::ImageFormat format=TinyImage::ABGR_16_1555_DIRECT_COLOR)=0
 update the texture from a buffer (used with camera) More...
 
bool addItem (const CMSP &item, ItemPosition pos=Last DECLARE_DEFAULT_LINK_NAME) override
 call directly CoreModifiable addItem (not Scene3D or Node3D) More...
 
bool removeItem (const CMSP &item DECLARE_DEFAULT_LINK_NAME) override
 call directly CoreModifiable addItem (not Scene3D or Node3D) More...
 
void TravDraw (TravState *state) override=0
 draw the scene3D More...
 
void TravCull (TravState *state) override=0
 call cull process for this node and all sons at visible positions More...
 
BaseTilesBank * GetTileBank ()
 get the tile bank More...
 
VirtualTileScreen * GetVirtualScreen ()
 get the virtual screen More...
 
BaseTileBuffer * GetTileBuffer ()
 get the tile buffer More...
 
void LoadData ()
 load the tile data
 
void SetTileInfo (unsigned short info, unsigned int posX, unsigned int posY)
 set the tile info More...
 
void setScroll (int scrollX, int scrollY)
 set the scrolling values of the layer (used by virtual screen) More...
 
- Public Member Functions inherited from Abstract2DLayer
 Abstract2DLayer (const kstl::string &name, DECLARE_CLASS_NAME_TREE_ARG)
 constructor More...
 
- Public Member Functions inherited from Scene3D
void TravCull (TravState *state) override
 call cull process for this node and all sons at visible positions More...
 
bool operator< (Scene3D const &A) const
 overload operator < for comparison
 
void NotifyUpdate (const unsigned int) override
 to be done when changing More...
 
virtual bool removeLight (CoreModifiable *light)
 remove a light return true if light was attached to this scene More...
 
virtual void addLight (CoreModifiable *light)
 add a light More...
 
virtual bool hasLight (CoreModifiable *light)
 true is has a light More...
 
- Public Member Functions inherited from Node3D
 DECLARE_DECORABLE_2_PARAMS (bool, Cull, Node3D, TravState *, unsigned int)
 
bool addItem (const CMSP &item, ItemPosition pos=Last DECLARE_DEFAULT_LINK_NAME) override
 add item at first or last position
 
bool removeItem (const CMSP &item DECLARE_DEFAULT_LINK_NAME) override
 
void localMove (const v3f &move)
 move local node position ( pos = move + pos )
 
void globalMove (const v3f &move)
 move global node position ( gpos = gmove + gpos )
 
- Public Member Functions inherited from SceneNode
bool addItem (const CMSP &item, ItemPosition pos=Last DECLARE_DEFAULT_LINK_NAME) override
 add item at first or last position
 
- Public Member Functions inherited from CoreModifiable
void Init ()
 Modifiable managmenent.
 
void EmptyItemList ()
 remove all items (sons)
 
CMSP GetInstanceByPath (const std::string &path)
 return the instance corresponding to the given path in sons tree
 
std::string GetRuntimeID () const
 ID.
 
CoreModifiableAttributegetAttribute (KigsID labelid) const
 Attribute management.
 
u32 getNbArrayElements (KigsID attributeLabel) const
 return element count for an array type attribute
 
template<typename attribute_type , typename value_type >
attribute_type * AddDynamicAttribute (KigsID ID, const value_type &value)
 Dynamic attribute management.
 
const kigs::unordered_map< KigsID, ModifiableMethodStruct > * GetMethods ()
 Method management.
 
bool aggregateWith (CMSP &item, ItemPosition pos=Last)
 Aggregate management.
 
void flagAsNotificationCenterRegistered ()
 Flags.
 
void InitParametersFromList (const std::vector< CoreModifiableAttribute * > *params)
 Utility. More...
 
virtual void ProtectedDestroy ()
 Destroy method decrement refcounter and delete instance if no more used. More...
 
virtual bool removeItem (const CMSP &item)
 remove item (son)
 

Protected Member Functions

virtual ~Base2DLayer ()
 destructor
 
void InitModifiable () override
 init the modifiable and set the isInit flag to true if OK
 
- Protected Member Functions inherited from Abstract2DLayer
bool StartDrawing (TravState *state)
 set rendering screen active
 
void EndDrawing (TravState *state)
 close rendering screen
 
- Protected Member Functions inherited from Scene3D
void InitModifiable () override
 initialize modifiable
 
void UninitModifiable () override
 called when InitModifiable has failled : reset read/write flag on all init params More...
 
- Protected Member Functions inherited from Node3D
void removeUser (CoreModifiable *user) override
 remove user (parent)
 
void addUser (CoreModifiable *user) override
 add the given parent to list
 
void PreDrawDrawable (TravState *state)
 call predraw for drawable sons of this node return true if at least one drawable son was found More...
 
void DrawDrawable (TravState *state)
 call draw for drawable sons of this node More...
 
void PostDrawDrawable (TravState *state)
 call postdraw for drawable sons of this node More...
 
void RecomputeGlobalToLocal ()
 
void RecomputeGlobalBoundingBox ()
 
virtual void RecomputeBoundingBox ()
 
- Protected Member Functions inherited from CoreModifiable
void UpdateAggregates (const Timer &timer, void *addParam)
 Internals.
 
void Export (std::vector< CoreModifiable * > &savedList, XMLNode *currentNode, bool recursive, ExportSettings *settings)
 Export. More...
 
CoreModifiableAttributeGenericCreateDynamicAttribute (CoreModifiable::ATTRIBUTE_TYPE type, KigsID ID)
 create and add dynamic attribute except arrays
 

Protected Attributes

maEnum< 3 > mType
 type of the layer ("Character","Bitmap" or "Sprite")
 
maEnum< 4 > mColorMode
 type of the layer color mode ("16","256","256x16","DC")
 
maString mVirtualScreenName
 name of the linked virtualScreen
 
maBool mRepeatX
 repeat mode
 
SpriteManager * mSpriteManager
 linked sprite manager if any
 
TexturemBitmapTexture
 pointer to the texture (from a bitmap)
 
maString mFileName
 file name (texture file)
 
BaseTilesBank * mTilesBank
 pointer to the tile bank
 
VirtualTileScreen * mVirtualScreen
 pointer to the virtual screen
 
BaseTileBuffer * mTileBuffer
 tile buffer
 
int mScrollX
 Scroll on X axis of the screen.
 
int mScrollY
 Scroll on Y axis of the screen.
 
- Protected Attributes inherited from Abstract2DLayer
maReference mRenderingScreen
 pointer to the renderingSreen
 
maInt mSizeX
 size on X axis
 
maInt mSizeY
 size on Y axis
 
- Protected Attributes inherited from Scene3D
kstl::set< Camera *, sortCamera > mCameras
 link to the cameras
 
kstl::set< CoreModifiable * > mLights
 link to the lights
 
maInt mPriority
 priority
 
- Protected Attributes inherited from Node3D
unsigned int mIsVisible
 valid after scene TravCull : mIsVisible store current frame index if object is visible
 
unsigned short mFirstVisibleNodeIndex
 first visible Node in ModuleSceneGraph::mVisiblesNodeList
 
unsigned short mVisibleNodeCount
 number of visible node
 
Matrix3x4 mTransform
 Local transformation matrix (father => this local coordinate system)
 
Matrix3x4 mLocalToGlobal
 Local to global transformation matrix (Local coordinate system => global "world" coordinate system)
 
Matrix3x4 mGlobalToLocal
 Global to local transformation matrix (Global "world" coordinate system => local coordinate system)
 
BBox mLocalBBox
 AABounding box in local coordinate system.
 
BBox mBBox
 AABounding box in father coordinate system.
 
BBox mGlobalBBox
 AABounding box in global "world" coordinate system.
 

Additional Inherited Members

- Static Public Member Functions inherited from CoreModifiable
static std::vector< CMSP > GetRootInstances (const KigsID &cid, bool exactTypeOnly=false)
 static method : return the set of all root instances of the given type
 
static void Append (std::string &XMLString, const std::list< CoreModifiable * > &toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the several CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static void Export (const std::string &filename, CoreModifiable *toexport, bool recursive=false, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static XMLNodeExportToXMLNode (CoreModifiable *toexport, XML *owner_xml_file, bool recursive, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML Node. if recursive flag is set to true, export also all sons tree More...
 
static std::string ExportToXMLString (CoreModifiable *toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static void Export (std::string &XMLString, const std::list< CoreModifiable * > &toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the several CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static CMSP Import (const std::string &filename, bool noInit=false, bool keepImportFileName=false, ImportState *state=nullptr, const std::string &override_name="")
 return an new CoreModifiable instance using the description found in XML file given by name
 
static CMSP GetInstanceByGlobalPath (const std::string &path)
 static method : return the instance corresponding to the given path, and given search start
 
static void debugPrintfFullTree (int maxindent=3)
 Editor. More...
 
- Static Protected Member Functions inherited from CoreModifiable
template<typename StringType >
static CMSP Import (XMLNodeTemplate< StringType > *currentNode, CoreModifiable *currentModifiable, ImportState &importState)
 recusrive method to add sons and attributes found in the XML file
 

Detailed Description

Obsolete 2D Layer.

2 Now use UI2DLayer insteed.

Constructor & Destructor Documentation

◆ Base2DLayer()

Base2DLayer::Base2DLayer ( const kstl::string &  name,
DECLARE_CLASS_NAME_TREE_ARG   
)

constructor

Parameters
name: instance name
DECLARE_CLASS_NAME_TREE_ARG: list of arguments

Member Function Documentation

◆ addItem()

bool Base2DLayer::addItem ( const CMSP &  item,
ItemPosition  pos = Last DECLARE_DEFAULT_LINK_NAME 
)
overridevirtual

call directly CoreModifiable addItem (not Scene3D or Node3D)

Parameters
item: item to add
linkName: name of the added item
Returns
TRUE if the item is added, FALSE otherwise

Reimplemented from CoreModifiable.

◆ GetTileBank()

BaseTilesBank * Base2DLayer::GetTileBank ( )
inline

get the tile bank

Returns
the tile bank

◆ GetTileBuffer()

BaseTileBuffer * Base2DLayer::GetTileBuffer ( )
inline

get the tile buffer

Returns
the tile buffer

◆ GetVirtualScreen()

VirtualTileScreen * Base2DLayer::GetVirtualScreen ( )

get the virtual screen

Returns
the frame buffer

◆ removeItem()

bool Base2DLayer::removeItem ( const CMSP &item  DECLARE_DEFAULT_LINK_NAME)
override

call directly CoreModifiable addItem (not Scene3D or Node3D)

Parameters
item: item to remove
linkName: name of the removed item
Returns
TRUE if the item is removed, FALSE otherwise

◆ setScroll()

void Base2DLayer::setScroll ( int  scrollX,
int  scrollY 
)

set the scrolling values of the layer (used by virtual screen)

Parameters
scrollX: scrolling on X axis
scrollY: scrolling on Y axis

◆ SetTileInfo()

void Base2DLayer::SetTileInfo ( unsigned short  info,
unsigned int  posX,
unsigned int  posY 
)

set the tile info

Parameters
info: index of the info
posX: pos on X axis of the tile
posY: pos on Y axis of the tile

◆ TravCull()

void Base2DLayer::TravCull ( TravState state)
overridepure virtual

call cull process for this node and all sons at visible positions

Parameters
state: travstate

Reimplemented from Node3D.

◆ TravDraw()

void Base2DLayer::TravDraw ( TravState state)
overridepure virtual

draw the scene3D

Parameters
state: the current TravState
Returns
TRUE if this node is visible or we are in a "all visible" branch of the scenegraph

Reimplemented from Node3D.

◆ updateLayerFromBuffer()

virtual void Base2DLayer::updateLayerFromBuffer ( unsigned char *  buffer,
unsigned int  width,
unsigned int  height,
kstl::string  name,
TinyImage::ImageFormat  format = TinyImage::ABGR_16_1555_DIRECT_COLOR 
)
pure virtual

update the texture from a buffer (used with camera)

Parameters
buffer: pixel color buffer

The documentation for this class was generated from the following file: