Example #1
0
static void demo1( Demo_Base* container )
{
	container->releaseAllChildren();
	// target_ = nullptr;

	DisplayObjectContainer* parent = new DisplayObjectContainer();
	container->addChild( parent );
	// container->drawFrame( parent );
	
	{
		// draw shape to display object
		DisplayObject* obj = new DisplayObject();
		Texture* texture = textureMgr.createImageTexture( "assets/boy_bg.png" );
		obj->setTexture( texture );
		parent->addChild( obj );
	}

	{
		// draw shape to display object
		DisplayObject* obj = new DisplayObject();
		Texture* texture = textureMgr.createImageTexture( "assets/boy.png" );
		obj->setTexture( texture );
		obj->transform().setPos( 0.0f, 320.0f );
		obj->tweener().moveTo( 3.0f, kernel.getScreenWidth() - obj->transform().getX() - obj->getWidth(), obj->transform().getY(), boost::bind( &Demo_Tween::onTweenFinished, s_instance ) );		
		parent->addChild( obj );
	}

	{
		GUI_Label* label = new GUI_Label( 0, 0, "translation", 16 );
		label->transform().setPos( 30, 30 );
		container->addChild( label );
	}
}
Example #2
0
static void demo2( Demo_Base* container )
{
	container->releaseAllChildren();
	// target_ = nullptr;

	DisplayObjectContainer* parent = new DisplayObjectContainer();
	container->addChild( parent );
	// container->drawFrame( parent );

	{
		// draw shape to display object
		DisplayObject* obj = new DisplayObject();
		Texture* texture = textureMgr.createImageTexture( "assets/boy.png" );
		obj->setTexture( texture );
		obj->transform().setPos( ( kernel.getScreenWidth() - obj->getWidth() ) / 2.0f, ( kernel.getScreenHeight() - obj->getHeight() ) / 2.0f );
		obj->tweener().rotateTo( 3.0f, 360, claw::tween::easing_bounce::ease_in, boost::bind( &Demo_Tween::onTweenFinished, s_instance ) );		
		parent->addChild( obj );
	}

	{
		GUI_Label* label = new GUI_Label( 0, 0, "rotation", 16 );
		label->transform().setPos( 30, 30 );
		container->addChild( label );
	}
}