「Cocos2dx/EditBox」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→Extensionは非推奨) |
(→サンプル) |
||
行7: | 行7: | ||
HelloworldScene.cpp | HelloworldScene.cpp | ||
#include "cocos-ext.h" | #include "cocos-ext.h" | ||
− | cocos2d:: | + | cocos2d::ui::EditBox* _editPassword = ui::EditBox::create(editBoxSize, "extensions/orange_edit.png"); |
_editPassword->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2)); | _editPassword->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2)); | ||
_editPassword->setFont("American Typewriter", 80); | _editPassword->setFont("American Typewriter", 80); | ||
行17: | 行17: | ||
_editPassword->setDelegate(this); | _editPassword->setDelegate(this); | ||
addChild(_editPassword); | addChild(_editPassword); | ||
− | |||
==Extensionは非推奨== | ==Extensionは非推奨== |
2017年4月11日 (火) 16:21時点における版
EditBoxとは
入力欄のこと
サンプル
HelloworldScene.h
HelloworldScene.cpp
#include "cocos-ext.h" cocos2d::ui::EditBox* _editPassword = ui::EditBox::create(editBoxSize, "extensions/orange_edit.png"); _editPassword->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2)); _editPassword->setFont("American Typewriter", 80); _editPassword->setFontColor(Color3B::GREEN); _editPassword->setPlaceHolder("Password:"); _editPassword->setMaxLength(6); _editPassword->setInputFlag(ui::EditBox::InputFlag::PASSWORD); _editPassword->setInputMode(ui::EditBox::InputMode::SINGLE_LINE); _editPassword->setDelegate(this); addChild(_editPassword);
Extensionは非推奨
cocos2d-x ui::EditBoxを使う