cocos2d-x
3.3
|
#include <UILayoutComponent.h>
Public Types | |
enum | ReferencePoint { BOTTOM_LEFT, TOP_LEFT, BOTTOM_RIGHT, TOP_RIGHT } |
When a node has a ReferencePositoin with value equals LEFT_BOTTOM, it will treat the left bottom corner of its parent as the origin(0,0) when positioning itself which is the same as cocos2d-x does. More... | |
Public Member Functions | |
LayoutComponent () | |
~LayoutComponent () | |
virtual bool | init () override |
CREATE_FUNC (LayoutComponent) | |
bool | isUsingPercentPosition () |
void | setUsingPercentPosition (bool flag) |
const Vec2 & | getPercentPosition () |
void | setPercentPosition (const Vec2 &percent) |
const Vec2 & | getRelativePosition () |
void | setRelativePosition (const Vec2 &position) |
void | setReferencePoint (ReferencePoint point) |
ReferencePoint | getReferencePoint () |
const Vec2 & | getOwnerPosition () const |
void | setOwnerPosition (const Vec2 &point) |
Vec2 | getOwnerContentSize () const |
void | setOwnerContentSize (const Vec2 &size) |
const Vec2 & | getPercentContentSize () const |
void | setPercentContentSize (const Vec2 &percent) |
bool | isUsingPercentContentSize () |
void | setUsingPercentContentSize (bool flag) |
void | setActiveEnable (bool enable) |
![]() | |
virtual | ~Component (void) |
NA NA More... | |
virtual void | onEnter () |
virtual void | onExit () |
virtual void | update (float delta) |
virtual bool | serialize (void *r) |
virtual bool | isEnabled () const |
virtual void | setEnabled (bool b) |
const std::string & | getName () const |
void | setName (const std::string &name) |
void | setOwner (Node *pOwner) |
Node * | getOwner () const |
![]() | |
void | retain () |
Retains the ownership. More... | |
void | release () |
Releases the ownership immediately. More... | |
Ref * | autorelease () |
Releases the ownership sometime soon automatically. More... | |
unsigned int | getReferenceCount () const |
Returns the Ref's current reference count. More... | |
virtual | ~Ref () |
NA NA More... | |
Additional Inherited Members | |
![]() | |
static Component * | create (void) |
![]() | |
Ref () | |
Constructor. More... | |
![]() | |
Node * | _owner |
std::string | _name |
bool | _enabled |
![]() | |
unsigned int | _referenceCount |
count of references More... | |
|
strong |
When a node has a ReferencePositoin with value equals LEFT_BOTTOM, it will treat the left bottom corner of its parent as the origin(0,0) when positioning itself which is the same as cocos2d-x does.
But you can change it by assigning a different ReferencePosition. For example: If you use ReferencePosition with value equals RIGHT_TOP, then it will treat the right top corner of its parent as the origin(0,0) when positioning itself.
Enumerator | |
---|---|
BOTTOM_LEFT | |
TOP_LEFT | |
BOTTOM_RIGHT | |
TOP_RIGHT |
LayoutComponent | ( | ) |
~LayoutComponent | ( | ) |
CREATE_FUNC | ( | LayoutComponent | ) |
Vec2 getOwnerContentSize | ( | ) | const |
const Vec2& getOwnerPosition | ( | ) | const |
const Vec2& getPercentContentSize | ( | ) | const |
const Vec2& getPercentPosition | ( | ) |
ReferencePoint getReferencePoint | ( | ) |
const Vec2& getRelativePosition | ( | ) |
|
overridevirtual |
Reimplemented from Component.
bool isUsingPercentContentSize | ( | ) |
bool isUsingPercentPosition | ( | ) |
void setActiveEnable | ( | bool | enable | ) |
void setOwnerContentSize | ( | const Vec2 & | size | ) |
void setOwnerPosition | ( | const Vec2 & | point | ) |
void setPercentContentSize | ( | const Vec2 & | percent | ) |
void setPercentPosition | ( | const Vec2 & | percent | ) |
void setReferencePoint | ( | ReferencePoint | point | ) |
void setRelativePosition | ( | const Vec2 & | position | ) |
void setUsingPercentContentSize | ( | bool | flag | ) |
void setUsingPercentPosition | ( | bool | flag | ) |