Class Button

#include <Geode/ui/Button.hpp>
classButton:publiccocos2d::CCNodeRGBA,publiccocos2d::CCTouchDelegate{ ... }
No description provided
Examples0
Public static methods5
staticgeode::Button*create()

Create a Button with no nodes on it You will need to add a child yourself and position accordingly.

Parameters

activateCallback

The callback for when the button is activated
staticgeode::Button*createWithNode(,)

Create a Button with a nodes on it. The node will be automatically positioned in the center.

Parameters

node

The node that will show on the button.

activateCallback

The callback for when the button is activated
staticgeode::Button*createWithSprite(,)

Create a Button with a sprite by file name

Parameters

fileName

The file name of the sprite (not in a spritesheet)

activateCallback

The callback for when the button is activated
staticgeode::Button*createWithSpriteFrameName(,)

Create a Button with a sprite by frame name

Parameters

fileName

The frame name of the sprite (in a spritesheet)

activateCallback

The callback for when the button is activated
staticgeode::Button*createWithLabel(,,)

Create a Button with a label

Parameters

text

The text shown on the label

font

The font of the label

activateCallback

The callback for when the button is activated
Public member functions32
cocos2d::CCNode*getDisplayNode()

Get the Display Node, which was created or passed in on button creation Will be nullptr if you use the empty create method

voidsetAnimationType()

Set an animation type, which dictates how the button moves or scales or if it even has an animation at all

voidsetClickAnimation()

Set a click animation. This will override the AnimationType and set it to Custom. Will run every time the button is pressed

voidsetReleaseAnimation()

Set a release animation. This will override the AnimationType and set it to Custom. Will run every time the button is released

voidsetActivateCallback()

Set a callback for when the button is activated

voidsetSelectCallback()

Set a callback for when the button is selected

voidsetUnselectCallback()

Set a callback for when the button is unselected

voidsetTouchPriority(
intpriority
)

Set the touch priority of the Button

intgetTouchPriority()
No description provided
voidsetTouchMultiplier(
floatmultipler
)

Set the touch multiplier, which increases the distance from the center that the button can be pressed (default is 1)

floatgetTouchMultiplier()
No description provided
voidsetScaleMultiplier(
floatmultiplier
)

Set the scale multiplier, only used with AnimationType::Scale Will scale the button by this amount when pressed

floatgetScaleMultiplier()
No description provided
voidsetMoveOffset()

Set the move offset, only used with AnimationType::Move Will move the button by this amount when pressed

cocos2d::CCPointgetMoveOffset()
No description provided
voidsetSelectedDuration(
floatduration
)

Set how long the default animations will last when selected

floatgetSelectedDuration()
No description provided
voidsetUnselectedDuration(
floatduration
)

Set how long the default animations will last when unselected

floatgetUnselectedDuration()
No description provided
virtualvoidsetEnabled(
boolenabled
)

Set if the button can be clicked

virtualboolisEnabled()
No description provided
virtualboolisSelected()

Get the selected state of the button

virtualvoidonEnter()
No description provided
virtualvoidonExit()
No description provided
virtualvoidselected()
No description provided
virtualvoidunselected()
No description provided
virtualvoidactivate()
No description provided
virtualvoidregisterWithTouchDispatcher()
No description provided
virtualboolccTouchBegan(,)
No description provided
virtualvoidccTouchMoved(,)
No description provided
virtualvoidccTouchEnded(,)
No description provided
virtualvoidccTouchCancelled(,)
No description provided
Fields0
Protected member functions9
voidsetDefaults()
No description provided
voidresetDefaults()
No description provided
cocos2d::CCActionInterval*clickActionForType()
No description provided
cocos2d::CCActionInterval*releaseActionForType()
No description provided
boolinit()
No description provided
boolinitWithNode(,)
No description provided
boolinitWithSprite(,)
No description provided
boolinitWithSpriteFrameName(,)
No description provided
boolinitWithLabel(,,)
No description provided
Protected fields0
Derived classes0