当前位置: 首页>>代码示例>>C++>>正文


C++ spActor::getWidth方法代码示例

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


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

示例1: push

    float push(spActor s)
    {
        spActor last = _line->getLastChild();
        if (last)
            s->setY(last->getY() + getHeight());
        else
            s->setY(0.0f);

        s->setX(getWidth() / 2 - s->getWidth() / 2);

        _line->addChild(s);

        return last ? last->getHeight() : getHeight();
    }
开发者ID:Neo7k,项目名称:oxygine-framework,代码行数:14,代码来源:Counter.cpp

示例2: init

	void DeveloperMenu::init(const Vector2 &size, const char *text, spActor data, const Color &color)
	{
		const float BORDER = 3;

		float offset = 24;

		setSize(size);
		setWidth(data->getWidth() + BORDER * 2);
		setHeight(size.y + offset);
		//setSize(data->getSize() + Point(0, offset));

		spColorRectSprite top = new ColorRectSprite();
		top->setWidth(getWidth());
		top->setSize(size);


		_topDrag.init(top.get());
		_topDrag.setDragClient(this);
		
		addChild(top);

		

		top->setColor(windowColor);
		top->setSize(Vector2(getWidth(), offset));
		top->setPriority(100);

		spColorRectSprite body = new ColorRectSprite();
		body->setColor(color);
		addChild(body);

		

		body->setSize(Vector2(getWidth() - BORDER * 2, getHeight()));
		body->setX(BORDER);
		body->setY((float)offset);


		_body = body;	


		TextStyle style;
		style.font = _resSystem->getResFont("system")->getFont();
		style.vAlign = TextStyle::VALIGN_TOP;

		spButton close = initActor(new Button,
			arg_y = offset/2,
			arg_x = offset/2,
			arg_anchor = Vector2(0.5f, 0.5f),
			arg_resAnim = _resSystem->getResAnim("remove"),
			arg_attachTo = top);
		close->addEventListener(TouchEvent::CLICK, CLOSURE(this, &DeveloperMenu::close));


		spTextField title = initActor(new TextField,
			arg_style = style,
			arg_hAlign = TextStyle::HALIGN_MIDDLE,
			arg_vAlign = TextStyle::VALIGN_MIDDLE,
			arg_text = text,
			arg_width = top->getWidth(),
			arg_height = top->getHeight(),
			arg_input = false,
			arg_attachTo = top);

		//title->setSize(close->getTextRect().size);
		title->addEventListener(TouchEvent::CLICK, CLOSURE(this, &DeveloperMenu::close));

		data->attachTo(body);
	}
开发者ID:gotonis,项目名称:danmake,代码行数:69,代码来源:DeveloperMenu.cpp


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