Sprite_Button()
精灵_按钮
显示按钮的精灵。
Sprite_Button
The sprite for displaying a button.
Kind: global function
- Sprite_Button()
- .initialize()
- .update()
- .updateFrame()
- .setColdFrame(x, y, width, height)
- .setHotFrame(x, y, width, height)
- .setClickHandler(method)
- .callClickHandler()
- .processTouch()
- .isActive() ⇒
boolean - .isButtonTouched() ⇒
boolean - .canvasToLocalX(x) ⇒
number - .canvasToLocalY(y) ⇒
number
sprite_Button.initialize()
初始化
Initialize
Kind: instance method of Sprite_Button
sprite_Button.update()
更新
Update
Kind: instance method of Sprite_Button
sprite_Button.updateFrame()
更新帧
Update frame
Kind: instance method of Sprite_Button
sprite_Button.setColdFrame(x, y, width, height)
设置冷帧
按钮未按下时的显示区域。
Set cold frame
The display area when the button is not pressed.
Kind: instance method of Sprite_Button
| Param | Type | Description |
|---|---|---|
| x | number | X 坐标 - X coordinate |
| y | number | Y 坐标 - Y coordinate |
| width | number | 宽度 - Width |
| height | number | 高度 - Height |
sprite_Button.setHotFrame(x, y, width, height)
设置热帧
按钮按下时的显示区域。
Set hot frame
The display area when the button is pressed.
Kind: instance method of Sprite_Button
| Param | Type | Description |
|---|---|---|
| x | number | X 坐标 - X coordinate |
| y | number | Y 坐标 - Y coordinate |
| width | number | 宽度 - Width |
| height | number | 高度 - Height |
sprite_Button.setClickHandler(method)
设置点击处理者
Kind: instance method of Sprite_Button
| Param | Type | Description |
|---|---|---|
| method | function | 点击处理方法 - Click handler method Set click handler |
sprite_Button.callClickHandler()
呼叫点击处理者
Call click handler
Kind: instance method of Sprite_Button
sprite_Button.processTouch()
处理触摸
Process touch
Kind: instance method of Sprite_Button
sprite_Button.isActive() ⇒ boolean
是否活动的
Kind: instance method of Sprite_Button
Returns: boolean - 是否活动 - Whether is active
Is active
sprite_Button.isButtonTouched() ⇒ boolean
是否按钮被触摸
Kind: instance method of Sprite_Button
Returns: boolean - 是否按钮被触摸 - Whether button is touched
Is button touched
sprite_Button.canvasToLocalX(x) ⇒ number
画布 X 坐标转换到本地 X 坐标
Kind: instance method of Sprite_Button
Returns: number - 本地 X 坐标 - Local X coordinate
Canvas X to local X
| Param | Type | Description |
|---|---|---|
| x | number | 画布 X 坐标 - Canvas X coordinate |
sprite_Button.canvasToLocalY(y) ⇒ number
画布 Y 坐标转换到本地 Y 坐标
Kind: instance method of Sprite_Button
Returns: number - 本地 Y 坐标 - Local Y coordinate
Canvas Y to local Y
| Param | Type | Description |
|---|---|---|
| y | number | 画布 Y 坐标 - Canvas Y coordinate |