1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Mac でも cocos2d::ui::EditBox を setContentSize でリサイズできるようにする

Posted at

cocos2d::ui::EditBoxImplCommon::setContentSize() を参考にしながら
以下の様に修正するといい感じにリサイズされるっぽい。

ui/UIEditBox/UIEditBoxImpl-mac.mm
void EditBoxImplMac::setContentSize(const Size& size)
{
    _contentSize = size;
    
    auto director = cocos2d::Director::getInstance();
    auto glview = director->getOpenGLView();
    
    NSSize nsSize;
    nsSize.width  = size.width * glview->getScaleX();
    nsSize.height = size.height * glview->getScaleY();
    [_sysEdit.textField setFrameSize:nsSize];
    [_sysEdit.secureTextField setFrameSize:nsSize];
}

他の環境も同じ様に修正することで対応できると考えられる。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?