• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TextFieldTTF类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TextFieldTTF的典型用法代码示例。如果您正苦于以下问题:C++ TextFieldTTF类的具体用法?C++ TextFieldTTF怎么用?C++ TextFieldTTF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TextFieldTTF类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: new

TextFieldTTF * TextFieldTTF::textFieldWithPlaceHolder(const std::string& placeholder, const std::string& fontName, float fontSize)
{
    TextFieldTTF *ret = new (std::nothrow) TextFieldTTF();
    if(ret && ret->initWithPlaceHolder("", fontName, fontSize))
    {
        ret->autorelease();
        if (placeholder.size()>0)
        {
            ret->setPlaceHolder(placeholder);
        }
        return ret;
    }
    CC_SAFE_DELETE(ret);
    return nullptr;
}
开发者ID:CheukKin,项目名称:HelloWorld,代码行数:15,代码来源:CCTextFieldTTF.cpp


示例2: TextFieldTTF

TextFieldTTF * TextFieldTTF::textFieldWithPlaceHolder(const std::string& placeholder, const Size& dimensions, TextHAlignment alignment, const std::string& fontName, float fontSize)
{
    TextFieldTTF *ret = new TextFieldTTF();
    if(ret && ret->initWithPlaceHolder("", dimensions, alignment, fontName, fontSize))
    {
        ret->autorelease();
        if (placeholder.size()>0)
        {
            ret->setPlaceHolder(placeholder);
        }
        return ret;
    }
    CC_SAFE_DELETE(ret);
    return nullptr;
}
开发者ID:JeeLiu,项目名称:tutorial-puzzle,代码行数:15,代码来源:CCTextFieldTTF.cpp


示例3: CC_CALLBACK_2

bool MainScene::init()
{
	if ( !Layer::init() )
    {
        return false;
    }


	_size = Director::getInstance()->getWinSize();
	_xPosition = 0;
	_xMoved = 0;

	_touchListener = EventListenerTouchOneByOne::create();
	_touchListener->onTouchBegan = CC_CALLBACK_2(MainScene::touchBegan,this);
	_touchListener->onTouchMoved = CC_CALLBACK_2(MainScene::touchMoved, this);
	_touchListener->onTouchEnded = CC_CALLBACK_2(MainScene::touchEnded,this);
	getEventDispatcher()->addEventListenerWithFixedPriority(_touchListener, 100);

	addScreen(1, new MainScreen);
	addScreen(2, new MainScreen);

	_fon = Sprite::create("img/ScreenFon.png");
	_fon->setScaleX(_size.width/_fon->getContentSize().width);
	_fon->setScaleY(_size.height/_fon->getContentSize().height);
	_fon->setPosition(Point(_size.width/2, _size.height/2));
	this->addChild(_fon,0);

	_menu = new MenuView;
	_menu->initialization(this);


	TextFieldTTF * tf = TextFieldTTF::textFieldWithPlaceHolder("click for input",
        "fonts/menuFont.otf",
        26);
	tf->setPosition(Point(300,300));
	this->addChild(tf, 10);
	tf->attachWithIME();

	//this->schedule(schedule_selector(MainScene::update),0.05f);

	return true;
}
开发者ID:Dzhekson6000,项目名称:StepInTime,代码行数:42,代码来源:MainScene.cpp


示例4: CC_CALLBACK_1

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Point origin = Director::getInstance()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    MenuItemImage *closeItem = MenuItemImage::create(
                                        "button.png",
                                        "button.png",
                                        CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
    
	closeItem->setPosition(Point(981 ,720-288));

    // create menu, it's an autorelease object
    Menu* menu = Menu::create(closeItem, NULL);
    menu->setPosition(Point::ZERO);
    this->addChild(menu, 1);

    /////////////////////////////
    // 3. add your codes below...

    // add a label shows "Hello World"
    // create and initialize a label
    
    TextFieldTTF* label = TextFieldTTF::textFieldWithPlaceHolder("Username", "Arial Black", 25);

	//label->attachWithIME();
    
    // position the label on the center of the screen
    label->setPosition(Point(874,720-164));

    // add the label as a child to this layer
    this->addChild(label, 1);

	this->username=label;

	label = TextFieldTTF::textFieldWithPlaceHolder("Host Address", "Arial Black", 25);

	//label->attachWithIME();
    
    // position the label on the center of the screen
    label->setPosition(Point(874,720-229));

    // add the label as a child to this layer
    this->addChild(label, 2);

	this->sockaddr=label;

    // add "HelloWorld" splash screen"
    Sprite* sprite = Sprite::create("login.png");

    // position the sprite on the center of the screen
    sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

    // add the sprite as a child to this layer
    this->addChild(sprite, 0);

	CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic("Raujika-Pastoral.mp3", true);

	this->setTouchEnabled(true);

	/*CCSprite *player = CCSprite::create("cards.png", 
                                   CCRectMake(5, 5, 75, 104) );
    player->setPosition( Point(100,100 ));
	this->addChild(player);*/

	//while(1);
    
    return true;
}
开发者ID:velicue,项目名称:hearts,代码行数:82,代码来源:HelloWorldScene.cpp



注:本文中的TextFieldTTF类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TextFile类代码示例发布时间:2022-05-31
下一篇:
C++ TextField类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap