Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#Actualfrankinshtein

Posted 20 October 2013 - 06:04 PM

Hi, I'm author of Oxygine.

Oxygine is 2D C++ Framework. It could be build on top of the SDL2.0 or Marmalade.

It is free and available under MIT license.

please check site: http://oxygine.org

You would find examples, demos and other helpful information

 

Key features:

  • Clear C++ API
  • OpenGLES rendering with batching. atlassing tools
  • SceneGraph similar to Flash
  • Tweens

 

 

 

here is small example of usage:

//create sprite and display it
spSprite sprite = new Sprite();
sprite->setResAnim(gameResources.getResAnim("anim"));
sprite->attachTo(getRoot());
sprite->setScale(0.5f);

//run animation tween
sprite->addTween(TweenAnim(gameResources.getResAnim("anim2")), duration, loops));

//run position tween
sprite->addTween(Sprite::TweenPosition(x, y), duration, loops));

//handle events
sprite->addEventListener(TouchEvent::CLICK, CLOSURE(this, &someClass::onClick));

//short syntax example
sprite = initActor(new Sprite,
arg_resAnim = gameResources.getResAnim("plus"),
arg_scale = 0.5f,
arg_onClick = CLOSURE(this, &HUD::clicked),
arg_pos = Vector2(70, 55),
arg_attachTo = getRoot());

debug_tools.giftext_align.gifmasking.gif


#3frankinshtein

Posted 29 September 2013 - 02:45 PM

Hi, I'm author of Oxygine.

Oxygine is 2D C++ Framework. It could be build on top of the SDL2.0 or Marmalade.

It is free and available under MIT license.

please check site: http://oxygine.org

You would find examples, demos and other helpful information

 

Key features:

  • Clear C++ API
  • OpenGLES rendering with batching. atlassing tools
  • SceneGraph similar to Flash
  • Tweens

 

 

 

here is small example of usage:

//create sprite and display it
spSprite sprite = new Sprite();
sprite->setResAnim(gameResources.getResAnim("anim"));
sprite->attachTo(getRoot());
sprite->setScale(0.5f);

//run animation tween
sprite->addTween(TweenAnim(gameResources.getResAnim("anim2")), duration, loops));

//run position tween
sprite->addTween(Sprite::TweenPosition(x, y), duration, loops));

//handle events
sprite->addEventListener(TouchEvent::CLICK, CLOSURE(this, &someClass::onClick));

//short syntax example
sprite = initActor(new Sprite,
arg_resAnim = gameResources.getResAnim("plus"),
arg_scale = 0.5f,
arg_onClick = CLOSURE(this, &HUD::clicked),
arg_pos = Vector2(70, 55),
arg_attachTo = getRoot());

#2frankinshtein

Posted 06 March 2013 - 04:59 AM

Hi, I'm author of Oxygine.

Oxygine is 2D C++ Framework. It could be build on top of the SDL2.0 or Marmalade.

It is free and available under MIT license.

please check site: http://oxygine.org

You would find examples, demos and other helpful information

 

Key features:

  • Clear C++ API
  • OpenGLES rendering with batching. atlassing tools
  • SceneGraph similar to Flash
  • Tweens

 

 

 

here is small example of usage:

//it is our resources
//in real project you would have more than one Resources declarations. It is important on mobile devices with limited memory and you would load/unload them
Resources gameResources;

//DECLARE_SMART is helper, it does forward declaration and declares intrusive_ptr typedef for your class
DECLARE_SMART(MainActor, spMainActor);

class MainActor: public Actor
{
public:
	spTextActor _text;

	MainActor()
	{	
		//create Button actor
		spButton button = new Button();
		//add it as child to current actor
		addChild(button);

		//you will find 'button' resource definition in res.xml
		//button has 3 columns for each state: Normal, Pressed, Overed
		button->setResAnim(gameResources.getResAnim("button"));
		//center button at screen		
		//button->setPosition(Vector2(480, 320)/2 - button->getSize()/2);		
		button->setPosition(Vector2(480, 320)/2);		
		button->setAnchor(Vector2(0.5,0.5));
		button->setInputChildrenEnabled(false);

		//how to handle click
		//find out more about CLOSUREs here: http://dobrokot.nm.ru/cpp/CppMethodsCallback.html
		EventCallback cb = CLOSURE(this, &MainActor::clicked);
		button->addEventListener(TouchEvent::CLICK, cb);

		//second part

		//create Actor with Text and it to button as child
		spTextActor text = new TextActor();
		button->addChild(text);

		//initialize text style
		//it would be centered and colored
		TextStyle style;
		style.font = gameResources.getResFont("main")->getFont();
		style.color = Color(72, 61, 139, 255);
		style.vAlign = TextStyle::VALIGN_MIDDLE;
		style.hAlign = TextStyle::HALIGN_CENTER;

		text->setStyle(style);;		
		text->setText("click\nme!");

		//default size is (0,0)
		//set button size to text
		//align would work properly now
		text->setSize(button->getSize());	

		//_text is MainActor member
		//we will use it later
		_text = text; 
	}

	void clicked(Event *event)
	{
		//user clicked to button
		_text->setText("clicked!");

		//lets create and run sprite with animation
		runSprite();
	}

	void runSprite()
	{
		spSprite sprite = new Sprite();		
		addChild(sprite);

		int duration = 500;//500 ms 
		int loops = -1;//infinity loops

		//animation has 7 cols, check res.xml
		ResAnim *animation = gameResources.getResAnim("anim");

		//create animation tween and add it to sprite
		//TweenAnim would change animation frames
		spTween tween = createTween(TweenAnim(animation), duration, loops);
		sprite->addTween(tween);

		Vector2 destPos = RootActor::instance->getSize() - sprite->getSize();
		Vector2 srcPos = Vector2(0, destPos.y);
		//set sprite initial position
		sprite->setPosition(srcPos);		

		//add another tween: TweenQueue
		//TweenQueue is a collection of tweens
		spTweenQueue tweenQueue = new TweenQueue();
		tweenQueue->setDelay(1500);
		//first, move sprite to dest position
		tweenQueue->add(Sprite::TweenPosition(destPos), 1500, 1);
		//then fade it out smoothly
		tweenQueue->add(Sprite::TweenAlpha(0), 1000, 1);



		sprite->addTween(tweenQueue);

		//and remove sprite from actor when tweenQueue is empty
		//sprite would be deleted automatically
		tweenQueue->setDetachActor(true);		
	}
};

#1frankinshtein

Posted 06 March 2013 - 04:54 AM

Hi, I'm author of Oxygine.

Oxygine is 2D C++ Framework. It could be build on top of the SDL2.0 or Marmalade.

It is free and available under MIT license.

please check site: http://oxygine.org

You would find examples, demos and other helpful information

 

here is small example of usage:

//it is our resources
//in real project you would have more than one Resources declarations. It is important on mobile devices with limited memory and you would load/unload them
Resources gameResources;

//DECLARE_SMART is helper, it does forward declaration and declares intrusive_ptr typedef for your class
DECLARE_SMART(MainActor, spMainActor);

class MainActor: public Actor
{
public:
	spTextActor _text;

	MainActor()
	{	
		//create Button actor
		spButton button = new Button();
		//add it as child to current actor
		addChild(button);

		//you will find 'button' resource definition in res.xml
		//button has 3 columns for each state: Normal, Pressed, Overed
		button->setResAnim(gameResources.getResAnim("button"));
		//center button at screen		
		//button->setPosition(Vector2(480, 320)/2 - button->getSize()/2);		
		button->setPosition(Vector2(480, 320)/2);		
		button->setAnchor(Vector2(0.5,0.5));
		button->setInputChildrenEnabled(false);

		//how to handle click
		//find out more about CLOSUREs here: http://dobrokot.nm.ru/cpp/CppMethodsCallback.html
		EventCallback cb = CLOSURE(this, &MainActor::clicked);
		button->addEventListener(TouchEvent::CLICK, cb);

		//second part

		//create Actor with Text and it to button as child
		spTextActor text = new TextActor();
		button->addChild(text);

		//initialize text style
		//it would be centered and colored
		TextStyle style;
		style.font = gameResources.getResFont("main")->getFont();
		style.color = Color(72, 61, 139, 255);
		style.vAlign = TextStyle::VALIGN_MIDDLE;
		style.hAlign = TextStyle::HALIGN_CENTER;

		text->setStyle(style);;		
		text->setText("click\nme!");

		//default size is (0,0)
		//set button size to text
		//align would work properly now
		text->setSize(button->getSize());	

		//_text is MainActor member
		//we will use it later
		_text = text; 
	}

	void clicked(Event *event)
	{
		//user clicked to button
		_text->setText("clicked!");

		//lets create and run sprite with animation
		runSprite();
	}

	void runSprite()
	{
		spSprite sprite = new Sprite();		
		addChild(sprite);

		int duration = 500;//500 ms 
		int loops = -1;//infinity loops

		//animation has 7 cols, check res.xml
		ResAnim *animation = gameResources.getResAnim("anim");

		//create animation tween and add it to sprite
		//TweenAnim would change animation frames
		spTween tween = createTween(TweenAnim(animation), duration, loops);
		sprite->addTween(tween);

		Vector2 destPos = RootActor::instance->getSize() - sprite->getSize();
		Vector2 srcPos = Vector2(0, destPos.y);
		//set sprite initial position
		sprite->setPosition(srcPos);		

		//add another tween: TweenQueue
		//TweenQueue is a collection of tweens
		spTweenQueue tweenQueue = new TweenQueue();
		tweenQueue->setDelay(1500);
		//first, move sprite to dest position
		tweenQueue->add(Sprite::TweenPosition(destPos), 1500, 1);
		//then fade it out smoothly
		tweenQueue->add(Sprite::TweenAlpha(0), 1000, 1);



		sprite->addTween(tweenQueue);

		//and remove sprite from actor when tweenQueue is empty
		//sprite would be deleted automatically
		tweenQueue->setDetachActor(true);		
	}
};

 

 


PARTNERS