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

C++ spActor类代码示例

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

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



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

示例1: init

    void TreeInspectorPreview::init(spActor item)
    {
        //_item = item;
        STDRenderer r(&_videoCache);
        RenderState rs;
        rs.renderer = &r;
        rs.transform = item->getTransform();
        r.begin(0);
        //r.setTransform(rs.transform);
        item->doRender(rs);
        r.end();
        r.drawBatch();

        setSize(30, 30);

        RectF itemRect = _videoCache._bounds;
        if (itemRect.isEmpty())
        {
            itemRect = item->getDestRect();
            if (itemRect.isEmpty())
                itemRect.setSize(Vector2(10, 4));
        }

        Vector2 ns = fitSize(Vector2(50.0f, 50.0f), itemRect.size);
        float scale = ns.x / itemRect.size.x;

        _cacheTransform.identity();

        _cacheTransform.scale(Vector2(scale, scale));
        _cacheTransform.translate(-itemRect.pos);



        AnimationFrame fr = _tree->_resSystem->getResAnim("checker")->getFrame(0, 0);
        //Point itemSize(30, 30);// = _getItemRect().size;

        RectF srcRect = fr.getSrcRect();
        const Diffuse& df = fr.getDiffuse();
        srcRect.size.x = ns.x / (float)df.base->getWidth();
        srcRect.size.y = ns.y / (float)df.base->getHeight();
        RectF destRect = fr.getDestRect();
        destRect.size = ns;

        AnimationFrame cfr;
        cfr.init(0, df, srcRect, destRect, ns);

        setAnimFrame(cfr);


        /*
        spEventHandler bh = new EventHandler();

        bh->setCallbackEnter(CLOSURE(this, &TreeInspectorPreview::_onEvent));
        bh->setCallbackExit(CLOSURE(this, &TreeInspectorPreview::_onEvent));
        bh->setCallbackPressDown(CLOSURE(this, &TreeInspectorPreview::_onEvent));
        bh->setCallbackPressUp(CLOSURE(this, &TreeInspectorPreview::_onEvent));
        addEventHandler(bh);
        */
    }
开发者ID:poplax,项目名称:oxygine-framework,代码行数:59,代码来源:TreeInspectorPreview.cpp


示例2: clickWait

			clickWait(spActor button, timeMS timeOut):_clicked(false), _timeOut(timeOut)
			{
				spClock clock = getStage()->getClock();
				timeMS start = clock->getTime();
				button->addEventListener(TouchEvent::CLICK, CLOSURE(this, &clickWait::click));
				do
				{
					yield();
					if (timeOut > 0 && (clock->getTime() - start > timeOut))					
						break;
				} while (!_clicked);

				button->removeEventListeners(this);
			}
开发者ID:gotonis,项目名称:danmake,代码行数:14,代码来源:blocking.cpp


示例3: 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


示例4: setContent

    void SlidingActor::setContent(spActor content)
    {
        if (_content)
        {
            _drag.destroy();
            _content->detach();
        }

        _downTime = 0;

        _current = 0;
        _lastIterTime = 0;
        _sliding = false;

        //_prev[0].pos = _content->getPosition();
        //_prev[0].tm = tm;

        for (int i = 0; i < NUM; ++i)
            _prev[i].tm = 0;

        _holded = 0; //event->target;
        //_downPos = te->localPosition;
        //_downTime = tm;
        _finger = 0;


        _speed = Vector2(0, 0);

        _content = content;
        _drag.init(content.get());

        _clip->addChild(_content);

        updateDragBounds();
    }
开发者ID:Yahor10,项目名称:oxygine-framework,代码行数:35,代码来源:SlidingActor.cpp


示例5: getDescendants

	void getDescendants(spActor actor, std::vector<spActor> &actors)
	{
		actors.push_back(actor);
		spActor child = actor->getFirstChild();
		while (child)
		{
			getDescendants(child, actors);
			child = child->getNextSibling();
		}
		//actor->removeChildren();
	}
开发者ID:gotonis,项目名称:danmake,代码行数:11,代码来源:TreeInspector.cpp


示例6: start

	void ThreadLoading::start(spActor parent)
	{
		{
			MutexAutoLock k(_m);
			_threadDone = false;
		}		

		parent->addChild(this);
		pthread_create(&_thread, 0, _staticThreadFunc, this);
		//_thread = s3eThreadCreate(_staticThreadFunc, this);
	}
开发者ID:huangyt,项目名称:oxygine-framework,代码行数:11,代码来源:Multithreading.cpp


示例7: init

    void TreeInspectorLine::init(TreeInspectorPage* page, spActor item)
    {
        setSize(Vector2(0, 0));
        setCull(true);

        _page = page;
        _item = new TreeInspectorPreview(page->getTreeInspector());
        _item->init(item);
        addChild(_item);


        spTextField tb = new TextField();
        tb->setTouchEnabled(false);
        tb->setColor(Color::Black);

        const float minWidth = 300.0f;

        TextStyle style;
        style.font = _page->getTreeInspector()->_resSystem->getResFont("system")->getFont();
        style.multiline = true;
        style.vAlign = TextStyle::VALIGN_TOP;
        tb->setStyle(style);
        tb->setSize(Vector2(minWidth, 0.0f));



        std::string desc = item->dump(0);

        tb->setHtmlText(desc);
        Vector2 ts = tb->getTextRect().size.cast<Vector2>();
        if (ts.x < minWidth)
            ts.x = minWidth;

        tb->setSize(ts);


        tb->setX(50.0f + 5);

        addChild(tb);

        setSize(0, 0);
        setSize(TreeInspector::calcBounds(this).size);
    }
开发者ID:HaoDongGuo,项目名称:oxygine-framework,代码行数:43,代码来源:TreeInspectorLine.cpp


示例8: _blockedTouchPosition

    namespace flow
    {
        spActor _touchBlocker;

        Vector2 _blockedTouchPosition(0, 0);
        bool _wasTouchBlocked = false;
        bool _wasBackBlocked = false;


        Flow Flow::instance;




        void init()
        {
            _touchBlocker = new Actor;
            _touchBlocker->setName("Scene::_touchBlocker");
            _touchBlocker->setPosition(-10000, -10000);
            _touchBlocker->setSize(20000, 20000);
            _touchBlocker->setPriority(10000);
            _touchBlocker->setName("touchBlocker");

            Flow::instance.init();
        }

        void free()
        {
            _touchBlocker = 0;
            Flow::instance.free();
        }


        Flow::Flow()
        {
            _transition = false;
            _back = false;
        }

        void Flow::init()
        {
            spScene first = new Scene;
            first->_holder->attachTo(getStage());
            scenes.push_back(first);
        }

        void Flow::free()
        {
            _trans = 0;
            _current = 0;
            _next = 0;
            scenes.clear();
            scenes2show.clear();
        }

        void Flow::show(spScene scene, const resultCallback& cb)
        {
            auto p = std::find(scenes.begin(), scenes.end(), scene);
            if (p != scenes.end())
                log::error("you can't show scene '%s', it is already in the list", scene->getName().c_str());

            OX_ASSERT(p == scenes.end());
            scene->_resultCB = cb;
            scenes2show.push_back(scene);

            checkShow();
        }

        void Flow::blockedTouch(Event* ev)
        {
            TouchEvent* event = safeCast<TouchEvent*>(ev);
            _blockedTouchPosition = event->getPointer()->getPosition();
            _wasTouchBlocked = true;
        }

        void Flow::phaseBegin(spScene current, spScene next, bool back)
        {
            _back = back;
            _current = current;
            _next = next;

            _transition = true;


            if (next && !_back)
                next->entering();

            if (!_back || !current->_dialog)
                next->preShowing();

            if ((next->_dialog && _back) || !next->_dialog)
                current->preHiding();

            if (!back)
                current->sceneShown(next);

            _trans = next->runTransition(this, current, back);

            getStage()->addChild(_touchBlocker);
            _wasTouchBlocked = false;
//.........这里部分代码省略.........
开发者ID:Aizter,项目名称:oxygine-flow,代码行数:101,代码来源:flow.cpp


示例9: 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


示例10: OX_ASSERT

	void TreeInspectorPage::init(spActor item)
	{
		OX_ASSERT(item);


		setSize(Vector2(0,0));
		_line = new TreeInspectorLine();
		_line->setPosition(Vector2(5, 5));
		_line->init(this, item);
		addChild(_line); 

		float y = _line->getHeight() + _line->getY() + 5.0f;

		if (item->getFirstChild())
		{
			spButton button;

			
			if (_parentPage)// && item->getFirstChild() != item->getLastChild())
			{
				button = new Button();
				button->setResAnim(_tree->_resSystem->getResAnim("checkbox"));
				button->setPosition(Vector2(15.0f, y));
				button->addEventListener(TouchEvent::CLICK, CLOSURE(this, &TreeInspectorPage::_onMinMaxClick));

				addChild(button);
			}

			_pages = new Actor();
			_pages->setInputEnabled(false);
			_pages->setX(-15);
			_pages->setY((float)y);


			spActor child = item->getFirstChild();
			while (child)
			{
				if (!child->isName("tree_inspector") && !child->isName("debug_actor"))
				{					
					spTreeInspectorPage page = new TreeInspectorPage(_tree, this);				
					page->init(child);
					_pages->addChild(page);
				}

				child = child->getNextSibling();
			}

			if (item->getVisible())
			{
				addChild(_pages);
				if (button)
					button->setRow(1);
			}
			else
			{
				if (button)
					button->setRow(0);
			}
		}

		updateInternalSize();
	}
开发者ID:cnsoft,项目名称:oxygine-framework,代码行数:62,代码来源:TreeInspectorPage.cpp


示例11: setActor

 void setActor(int n, spActor a)
 {
     _sprites[n] = a;
     a->setUserData((void*)n);
 }
开发者ID:Neo7k,项目名称:oxygine-framework,代码行数:5,代码来源:Counter.cpp


示例12: init

        void init()
        {
            _touchBlocker = new Actor;
            _touchBlocker->setName("Scene::_touchBlocker");
            _touchBlocker->setPosition(-10000, -10000);
            _touchBlocker->setSize(20000, 20000);
            _touchBlocker->setPriority(10000);
            _touchBlocker->setName("touchBlocker");

            Flow::instance.init();
        }
开发者ID:Aizter,项目名称:oxygine-flow,代码行数:11,代码来源:flow.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ spGframe_t类代码示例发布时间:2022-05-31
下一篇:
C++ sp类代码示例发布时间: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