TextField in cocos2d-x 3.0 with background image,

2019-07-22 20:52发布

问题:

I need a input text filed with:

  1. background image
  2. text aligned to center
  3. text color, shadow and shadow color options

But I cannot find and appropriate one. I have investigated and found:

  • cocos2d::extension::EditBox which has 1, but 2 and 3 are missing as I understand
  • cocos2d::TextFieldTTF
  • ui::UICCTextField
  • ui::TextField

The latest 3 ones don't have 2 and 3 and also are not easy to use in terms of getting input.

cocos2d::Label seams to hove what I want (I can use a sprite for background), but it is not for input. What solution suggests cocos2d-x?

回答1:

Now there is no way to do this not considering a new TextField definition. But cocos2d-x guys are going to merge TextField with UI system and maybe at that time it will support such features. See here: http://www.cocos2d-x.org/issues/5346#change-12942