Exemple #1
0
/*
==================
Main
==================
*/
int IndieLib()
{
    //Sets the working path as the 'exe' directory. All resource paths are relative to this directory
	if (!WorkingPathSetup::setWorkingPathFromExe(NULL)) {
		std::cout<<"\nUnable to Set the working path !";
	}
	
	// ----- IndieLib intialization -----

	CIndieLib *mI = CIndieLib::instance();
	if (!mI->init()) return 0;		

	// ----- Surface loading -----

	// Loading draco
	IND_Surface *mSurfaceDraco = IND_Surface::newSurface();
	if (!mI->_surfaceManager->add(mSurfaceDraco, "../../resources/draco.png", IND_ALPHA, IND_32)) return 0;

	// Loading gem (this image has a blue rectangle surronding it)
	IND_Surface *mSurfaceGem = IND_Surface::newSurface();
	if (!mI->_surfaceManager->add(mSurfaceGem, "../../resources/gem_squared.png", IND_ALPHA, IND_32)) return 0;

	// Loading bug
	IND_Surface *mSurfaceBug = IND_Surface::newSurface();
	if (!mI->_surfaceManager->add(mSurfaceBug, "../../resources/Enemy Bug.png", IND_ALPHA, IND_32)) return 0;

	// ----- Animation loading -----

	IND_Animation *mAnimationUfo = IND_Animation::newAnimation();
	if (!mI->_animationManager->addToSurface(mAnimationUfo, "../../resources/animations/ufo.xml", IND_ALPHA, IND_32)) return 0;

	// ----- Main Loop -----

	int mWidth, mHeight;
	float mAngle = 0.0f;
	float mHotSpotX, mHotSpotY;
	int mAxisCalX, mAxisCalY;
	IND_Matrix *mMatrix = new IND_Matrix();
	float mSpeed = 50;
	float mDelta;

	while (!mI->_input->onKeyPress(IND_ESCAPE) && !mI->_input->quit())
	{
		// ----- Input update ----

		mI->_input->update();

		// ----- Delta -----

		mDelta = mI->_render->getFrameTime() / 1000.0f;

		// ----- Render  -----

		mI->_render->beginScene();
		mI->_render->clearViewPort(60, 60, 60);


		// --------------------------------------------------------------------------------
		//					Blitting Draco directly (IND_Surface object) 
		// --------------------------------------------------------------------------------

		// 1) We apply the world space transformation (translation, rotation, scaling).
		// If you want to recieve the transformation in a single matrix you can pass
		// and IND_Matrix object by reference.

		mWidth = mSurfaceDraco->getWidth();
		mHeight = mSurfaceDraco->getHeight();
		mI->_render->setTransform2d(50,					// x pos
									70,					// y pos
									0,					// Angle x	
									0,					// Angle y
									0,					// Angle z
									1,					// Scale x
									1,					// Scale y
									0,					// Axis cal x
									0,					// Axis cal y
									0,					// Mirror x
									0,					// Mirror y
									mWidth,				// Width
									mHeight,			// Height
									mMatrix);			// Matrix in wich the transformation will be applied (optional)			
 
		// 2) We apply the color, blending and culling transformations.
		mI->_render->setRainbow2d(IND_ALPHA,								// IND_Type
									1,					// Back face culling 0/1 => off / on
									0,					// Mirror x
									0,					// Mirror y
									IND_FILTER_LINEAR,	// IND_Filter
									255,				// R Component	for tinting
									255,				// G Component	for tinting
									255,				// B Component	for tinting			
									255,				// A Component	for tinting
									0,					// R Component	for fading to a color		
									0,					// G Component	for fading to a color		
									0,					// B Component	for fading to a color			
									255,				// Amount of fading	
									IND_SRCALPHA,		// IND_BlendingType (source)
									IND_INVSRCALPHA);	// IND_BlendingType (destination)


		// 3) Blit the IND_Surface
		mI->_render->blitSurface(mSurfaceDraco);


		// --------------------------------------------------------------------------------
		//		Blitting Bug directly (IND_Surface object with a HotSpot and rotating)
		// --------------------------------------------------------------------------------

		// 1) We apply the world space transformation (translation, rotation, scaling).
		// If you want to recieve the transformation in a single matrix you can pass
		// and IND_Matrix object by reference.

		mAngle += mSpeed *mDelta;
		mHotSpotX = 0.5f;
		mHotSpotY = 0.5f;
		mWidth = mSurfaceBug->getWidth();
		mHeight = mSurfaceBug->getHeight();
		mAxisCalX = (int) (mHotSpotX * mWidth * -1);
		mAxisCalY = (int) (mHotSpotY * mHeight * -1);

		mI->_render->setTransform2d(500,				// x pos
									100,				// y pos
									0,					// Angle x	
									0,					// Angle y
									mAngle,				// Angle z
									1,					// Scale x
									1,					// Scale y
									mAxisCalX,			// Axis cal x
									mAxisCalY,			// Axis cal y
									0,					// Mirror x
									0,					// Mirror y
									mWidth,				// Width
									mHeight,			// Height
									mMatrix);			// Matrix in wich the transformation will be applied (optional)			
 
		// 2) We apply the color, blending and culling transformations.
		mI->_render->setRainbow2d(IND_ALPHA,			// IND_Type
									1,					// Back face culling 0/1 => off / on
									0,					// Mirror x
									0,					// Mirror y
									IND_FILTER_LINEAR,	// IND_Filter
									255,				// R Component	for tinting
									255,				// G Component	for tinting
									255,				// B Component	for tinting			
									255,				// A Component	for tinting
									0,					// R Component	for fading to a color		
									0,					// G Component	for fading to a color		
									0,					// B Component	for fading to a color			
									255,				// Amount of fading	
									IND_SRCALPHA,		// IND_BlendingType (source)
									IND_INVSRCALPHA);	// IND_BlendingType (destination)


		// 3) Blit the IND_Surface
		mI->_render->blitSurface(mSurfaceBug);


		// --------------------------------------------------------------------------------
		//				Blitting a region of Gem directly (IND_Surface region)
		// --------------------------------------------------------------------------------

		// 1) We apply the world space transformation (translation, rotation, scaling).
		// If you want to recieve the transformation in a single matrix you can pass
		// and IND_Matrix object by reference.

		mWidth = mSurfaceGem->getWidth();
		mHeight = mSurfaceGem->getHeight();
		mI->_render->setTransform2d(600,				// x pos
									200,				// y pos
									0,					// Angle x	
									0,					// Angle y
									0,					// Angle z
									1,					// Scale x
									1,					// Scale y
									0,					// Axis cal x
									0,					// Axis cal y
									0,					// Mirror x
									0,					// Mirror y
									mWidth,				// Width
									mHeight,			// Height
									mMatrix);			// Matrix in wich the transformation will be applied (optional)			
 
		// 2) We apply the color, blending and culling transformations.
		mI->_render->setRainbow2d(IND_ALPHA,								// IND_Type
									1,					// Back face culling 0/1 => off / on
									0,					// Mirror x
									0,					// Mirror y
									IND_FILTER_LINEAR,	// IND_Filter
									255,				// R Component	for tinting
									255,				// G Component	for tinting
									255,				// B Component	for tinting			
									255,				// A Component	for tinting
									0,					// R Component	for fading to a color		
									0,					// G Component	for fading to a color		
									0,					// B Component	for fading to a color			
									255,				// Amount of fading	
									IND_SRCALPHA,		// IND_BlendingType (source)
									IND_INVSRCALPHA);	// IND_BlendingType (destination)


		// 3) Blit the IND_Surface
		mI->_render->blitRegionSurface(mSurfaceGem, 10, 10, 70, 70);


		// --------------------------------------------------------------------------------
		//				Blitting a tiled region of Gem directly (IND_Surface wrap)
		// --------------------------------------------------------------------------------

		// 1) We apply the world space transformation (translation, rotation, scaling).
		// If you want to recieve the transformation in a single matrix you can pass
		// and IND_Matrix object by reference.

		mWidth = mSurfaceGem->getWidth();
		mHeight = mSurfaceGem->getHeight();
		mI->_render->setTransform2d(500,							// x pos
									350,				// y pos
									0,					// Angle x	
									0,					// Angle y
									0,					// Angle z
									1,					// Scale x
									1,					// Scale y
									0,					// Axis cal x
									0,					// Axis cal y
									0,					// Mirror x
									0,					// Mirror y
									mWidth,				// Width
									mHeight,			// Height
									mMatrix);			// Matrix in wich the transformation will be applied (optional)			
 
		// 2) We apply the color, blending and culling transformations.
		mI->_render->setRainbow2d(IND_ALPHA,								// IND_Type
									1,					// Back face culling 0/1 => off / on
									0,					// Mirror x
									0,					// Mirror y
									IND_FILTER_LINEAR,	// IND_Filter
									255,				// R Component	for tinting
									255,				// G Component	for tinting
									255,				// B Component	for tinting			
									255,				// A Component	for tinting
									0,					// R Component	for fading to a color		
									0,					// G Component	for fading to a color		
									0,					// B Component	for fading to a color			
									255,				// Amount of fading	
									IND_SRCALPHA,		// IND_BlendingType (source)
									IND_INVSRCALPHA);	// IND_BlendingType (destination)


		// 3) Blit the IND_Surface
		mI->_render->blitWrapSurface(mSurfaceGem, 200, 200, 0, 0);


		// --------------------------------------------------------------------------------
		//				Blitting a ufo animation directly (IND_Animation object)
		// --------------------------------------------------------------------------------

		// 1) We apply the world space transformation (translation, rotation, scaling).
		// If you want to recieve the transformation in a single matrix you can pass
		// and IND_Matrix object by reference.

		mWidth = mAnimationUfo->getActualSurface(0)->getWidth();
		mHeight= mAnimationUfo->getActualSurface(0)->getHeight();
		mI->_render->setTransform2d(650,								// x pos
									70,					// y pos
									0,					// Angle x	
									0,					// Angle y
									0,					// Angle z
									1,					// Scale x
									1,					// Scale y
									0,					// Axis cal x
									0,					// Axis cal y
									0,					// Mirror x
									0,					// Mirror y
									mWidth,				// Width
									mHeight,			// Height
									mMatrix);			// Matrix in wich the transformation will be applied (optional)			
 
		// 2) We apply the color, blending and culling transformations.
		mI->_render->setRainbow2d(IND_ALPHA,								// IND_Type
									1,					// Back face culling 0/1 => off / on
									0,					// Mirror x
									0,					// Mirror y
									IND_FILTER_LINEAR,	// IND_Filter
									255,				// R Component	for tinting
									255,				// G Component	for tinting
									255,				// B Component	for tinting			
									255,				// A Component	for tinting
									0,					// R Component	for fading to a color		
									0,					// G Component	for fading to a color		
									0,					// B Component	for fading to a color			
									255,				// Amount of fading	
									IND_SRCALPHA,		// IND_BlendingType (source)
									IND_INVSRCALPHA);	// IND_BlendingType (destination)


		// 3) Blit the IND_Animation looping
		if (mI->_render->blitAnimation(mAnimationUfo, 0, 0, 0, 0, 0, 0, 0, 0) == -1)
			mAnimationUfo->setActualFramePos (0, 0);

		mI->_render->endScene();	
	}

	// ----- Free -----

	mI->end();

	delete mMatrix;

	return 0;
}
Exemple #2
0
/*
==================
Main
==================
*/
int IndieLib()			
{
    //Sets the working path as the 'exe' directory. All resource paths are relative to this directory
	if (!WorkingPathSetup::setWorkingPathFromExe(NULL)) {
		std::cout<<"\nUnable to Set the working path !";
	}
	
	// ----- IndieLib intialization -----

	CIndieLib *mI = CIndieLib::instance();
	if (!mI->init()) return 0;			

	// ----- Surface loading -----

	// Loading cave
	IND_Surface *mSurfaceCave = IND_Surface::newSurface();
	if (!mI->_surfaceManager->add(mSurfaceCave, "../../resources/cave.png", IND_ALPHA, IND_32)) return 0;

	// Loading cave (first plane)
	IND_Surface *mSurfaceCaveFirstPlane = IND_Surface::newSurface();
	if (!mI->_surfaceManager->add(mSurfaceCaveFirstPlane, "../../resources/cave_near.png", IND_ALPHA, IND_32)) return 0;

	// Loading sky
	IND_Surface *mSurfaceSky = IND_Surface::newSurface();
	if (!mI->_surfaceManager->add(mSurfaceSky, "../../resources/sky.jpg", IND_OPAQUE, IND_32)) return 0;

	// Font
	IND_Font *mFontSmall = IND_Font::newFont();
	if (!mI->_fontManager->add(mFontSmall, "../../resources/font_small.png", "../../resources/font_small.xml", IND_ALPHA, IND_32)) return 0;

	// ----- Font creation -----

	IND_Entity2d *mTextSmallWhite = IND_Entity2d::newEntity2d();					
	mI->_entity2dManager->add(3, mTextSmallWhite);				// Entity adding (Layer 3)
	mTextSmallWhite->setFont(mFontSmall);					// Set the font into the entity
	mTextSmallWhite->setLineSpacing(18);
	mTextSmallWhite->setCharSpacing	(-8);
	mTextSmallWhite->setPosition(5, 5, 1);
	mTextSmallWhite->setAlign(IND_LEFT);

	// ----- Entities -----

	// Creating 2d entity for the sky
	IND_Entity2d *mSky = IND_Entity2d::newEntity2d();					
	mI->_entity2dManager->add(0, mSky);					// Entity adding (Layer 0)
	mSky->setSurface(mSurfaceSky);
	mSky->setPosition(600, 0, 0);

	// Creating 2d entity for the cave
	IND_Entity2d *mCave = IND_Entity2d::newEntity2d();					
	mI->_entity2dManager->add(1, mCave);					// Entity adding (Layer 1)
	mCave->setSurface(mSurfaceCave);

	// Creating 2d entity for the cave (first plane)
	IND_Entity2d *mCaveFirstPlane = IND_Entity2d::newEntity2d();					
	mI->_entity2dManager->add(2, mCaveFirstPlane);				// Entity adding (Layer 2)
	mCaveFirstPlane->setSurface(mSurfaceCaveFirstPlane);

	// ----- Cameras -----

	// --- Cameras for the parallax layers --- 

	int mMiddleScreenX = mI->_window->getWidth() / 2;
	int mMiddleScreenY = mI->_window->getHeight() / 2;

	float mPosXCamera0 = (float) mMiddleScreenX;
	float mPosXCamera1 = (float) mMiddleScreenX;
	float mPosXCamera2 = (float) mMiddleScreenX;

	IND_Camera2d *mCamera0 = new IND_Camera2d((int) mPosXCamera0, mMiddleScreenY);
	IND_Camera2d *mCamera1 = new IND_Camera2d((int) mPosXCamera1, mMiddleScreenY);
	IND_Camera2d *mCamera2 = new IND_Camera2d((int) mPosXCamera2, mMiddleScreenY);

	int mSpeedLayer0 = 50;
	int mSpeedLayer1 = 162;
	int mSpeedLayer2 = 250;

	// --- Camera for showing the text that explain the input controls --- 

	IND_Camera2d *mCameraText = new IND_Camera2d((int) mI->_window->getWidth() / 2, mI->_window->getHeight() / 2);

	// --- Some variables ---

	char mText [2048];
	mText [0] = 0;
	float mDelta;

	while (!mI->_input->onKeyPress(IND_ESCAPE) && !mI->_input->quit())
	{
		// ----- Input update ----

		mI->_input->update();

		// ----- Text -----

		strcpy (mText, "Use right and left arrow keys for moving the camera\n");
		mTextSmallWhite->setText(mText);

		// ----- Input ----

		mDelta = mI->_render->getFrameTime() / 1000.0f;

		// Move cameras when pressing right key
		if (mI->_input->isKeyPressed(IND_KEYRIGHT))	
		{
			// Check limits
			if (mPosXCamera2 < mSurfaceCaveFirstPlane->getWidth() - mMiddleScreenX)
			{
				mPosXCamera0 += mSpeedLayer0 * mDelta;
				mPosXCamera1 += mSpeedLayer1 * mDelta;
				mPosXCamera2 += mSpeedLayer2 * mDelta;
			}
		}

		// Move cameras when pressing left key
		if (mI->_input->isKeyPressed(IND_KEYLEFT))	
		{
			// Check limits
			if (mPosXCamera2 > mMiddleScreenX)
			{
				mPosXCamera0 -= mSpeedLayer0 * mDelta;
				mPosXCamera1 -= mSpeedLayer1 * mDelta;
				mPosXCamera2 -= mSpeedLayer2 * mDelta;
			}
		}

		// ----- Updating cameras-----

		mCamera0->setPosition((int) mPosXCamera0, mMiddleScreenY);
		mCamera1->setPosition((int) mPosXCamera1, mMiddleScreenY);
		mCamera2->setPosition((int) mPosXCamera2, mMiddleScreenY);

		// ----- Render  -----

		mI->_render->clearViewPort(60, 60, 60);
		mI->_render->beginScene();

		// Render sky (Layer 0)
		mI->_render->setCamera2d(mCamera0);
		mI->_entity2dManager->renderEntities2d(0);

		// Render cave (Layer 1)
		mI->_render->setCamera2d(mCamera1);
		mI->_entity2dManager->renderEntities2d(1);

		// Render the first plane cave (Layer 2)
		mI->_render->setCamera2d(mCamera2);
		mI->_entity2dManager->renderEntities2d(2);

		// Render the text explaining the controls plane cave (Layer 3)
		mI->_render->setCamera2d(mCameraText);
		mI->_entity2dManager->renderEntities2d(3);

		mI->_render->endScene();	
	}

	// ----- Free -----

	mI->end();

	return 0;
}
int IndieLib()
{
    // ----- IndieLib intialization -----

    CIndieLib *mI = CIndieLib::instance();
    if (!mI->init()) return 0;

    // ----- Get Window Dimensions

    int winWidth = mI->_window->getWidth();
    int winHeight = mI->_window->getHeight();

    srand(static_cast<unsigned int>(time(0)));

    // ----- Surface loading -----

    IND_Surface *mSurfaceBack = IND_Surface::newSurface();
    if (!mI->_surfaceManager->add(mSurfaceBack, "../SpaceGame/resources/Backgrounds/18.jpg", IND_OPAQUE, IND_32)) return 0;

    /*IND_Animation* mTestA = IND_Animation::newAnimation();
    if (!mI->_animationManager->addToSurface(mTestA, "resources/animations/dust.xml", IND_ALPHA, IND_32, 255, 0, 255)) return 0;
    mTestA->getActualFramePos(0);*/

    // Loading 2D Entities

    // Background
    IND_Entity2d* mBack = IND_Entity2d::newEntity2d();
    mI->_entity2dManager->add(mBack);
    mBack->setSurface(mSurfaceBack);
    mBack->setScale((float)winWidth / mSurfaceBack->getWidth(), (float)winHeight / mSurfaceBack->getHeight());

    Controls* controls = new Controls();
    controls->loadSettings();

    ErrorHandler* error = new ErrorHandler();
    error->initialize(mI);

    Hud* mHud = new Hud();
    mHud->createHud(mI);

    Menu* mMenu = new Menu();
    mMenu->createMenu(mI);

    Save* quickSave = new Save();

    if (!SoundEngine::initialize())
    {
        error->writeError(200, 100, "Error", "SoundEngine");
    }

    vector<Planet*> mPlanets;
    Ship* mShip = NULL;

    bool loadSave = false;
    float mDelta = 0.0f;

    IND_Timer* mTimer = new IND_Timer;
    mTimer->start();

    while (!mI->_input->onKeyPress(IND_ESCAPE) && !mI->_input->quit() && !mMenu->isExit())
    {
        // get delta time
        mDelta = mI->_render->getFrameTime() / 1000.0f;

        if (mI->_input->isKeyPressed(controls->getMenu()))
        {
            mMenu->show();
            SoundEngine::getSoundEngine()->setAllSoundsPaused(true);
        }
        if (!mMenu->isHidden())
        {
            mMenu->updateMenu(mHud, quickSave, mPlanets, mShip);
            loadSave = mHud->getLoadingText()->isShow();
        }
        else
        {
            if (loadSave)
            {
                mDelta = 0.0;
                loadSave = false;
                SoundEngine::getSoundEngine()->setAllSoundsPaused(true);
                mHud->getLoadingText()->setShow(false);
                quickSave->loadSave(mI, mShip, mPlanets);
                mHud->showHud();
            }

            if (mShip != NULL)
            {
                if (mI->_input->onKeyPress(controls->getQuickSave()))
                {
                    quickSave->makeSave(mI, mShip, mPlanets);
                }

                mHud->updateHud(mShip);

                if (mI->_input->onKeyPress(controls->getQuickLoad()))
                {
                    deleteObjects(mHud, mShip, mPlanets);
                    loadSave = true;
                }
                if (mShip->isDestroyed())
                {
                    SoundEngine::getSoundEngine()->setAllSoundsPaused(true);
                    mHud->updateGameOverText(mShip->getScore());
                    deleteObjects(mHud, mShip, mPlanets);
                    mHud->getLoadingText()->setShow(false);
                    mHud->getGameOverText()->setShow(true);
                    mMenu->show();
                }
                if(mShip!=NULL)
                {
                    //----- Collisions -----
                    checkShipPlanetsCollisions(mI, mPlanets, mShip);
                    checkBulletsPlanetsCollisions(mI, mPlanets, mShip);
                    checkBulletsShipCollisions(mI, mPlanets, mShip);

                    //----- Movement update -----
                    mShip->updateShip(controls, mDelta);
                    if ((mTimer->getTicks() / 1000.0f) >= 3.0f)
                    {
                        mTimer->start();
                        mPlanets.at(rand() % mPlanets.size())->addSatellite();
                    }
                    for (vector<Planet*>::iterator it = mPlanets.begin(); it != mPlanets.end(); ++it)
                    {
                        (*it)->updatePlanet(mDelta, (mShip->getPosX() + 0.25f * mShip->getHeight() * cos(mShip->getAngleZRadian())), (mShip->getPosY() - 0.25f * mShip->getHeight() * sin(mShip->getAngleZRadian())));
                    }
                }
            }
        }

        //mI->_render->showFpsInWindowTitle();
        mI->_input->update();
        mI->_render->beginScene();
        mI->_entity2dManager->renderEntities2d();
        mI->_render->endScene();
    }

    // ----- Free -----
    delete controls;
    delete error;
    delete mHud;
    delete mMenu;
    delete quickSave;
    mI->_surfaceManager->remove(mSurfaceBack);
    mI->_entity2dManager->remove(mBack);
    deleteObjects(mHud, mShip, mPlanets);
    mI->end();
    return 0;
}
Exemple #4
0
/*
==================
Main
==================
*/
int IndieLib()
{
	
	// ----- IndieLib intialization -----

	CIndieLib *mI = CIndieLib::instance();
	if (!mI->init()) return 0;

	
	// ----- Surface loading -----

	// Loading Background
	IND_Surface *mSurfaceBack = IND_Surface::newSurface();
	if (!mI->_surfaceManager->add(mSurfaceBack, "../SpaceGame/resources/blue_background.jpg", IND_OPAQUE, IND_32)) return 0;

	// Loading sprite of a star
	IND_Surface *mSurfaceStar = IND_Surface::newSurface();
	if (!mI->_surfaceManager->add(mSurfaceStar, "../SpaceGame/resources/star.png", IND_ALPHA, IND_32)) return 0;

	// ----- Animations loading -----

	// Characters animations, we apply a color key of (0, 48, 152)
	IND_Animation *mAnimationCharacter1 = IND_Animation::newAnimation();
	if (!mI->_animationManager->addToSurface(mAnimationCharacter1, "../SpaceGame/resources/animations/character1.xml", IND_ALPHA, IND_32, 0, 48, 152)) return 0;

	// Characters animations, we apply a color key of (0, 48, 152)
	IND_Animation *mAnimationCharacter2 = IND_Animation::newAnimation();
	if (!mI->_animationManager->addToSurface(mAnimationCharacter2, "../SpaceGame/resources/animations/character2.xml", IND_ALPHA, IND_32, 0, 48, 152)) return 0;

	// Dust animation, we apply a color key of (255, 0, 255)
	IND_Animation *mAnimationDust = IND_Animation::newAnimation();
	if (!mI->_animationManager->addToSurface(mAnimationDust, "../SpaceGame/resources/animations/dust.xml", IND_ALPHA, IND_16, 255, 0, 255)) return 0;

	// ----- Set the surface and animations into 2d entities -----

	// Creating 2d entity for the background
	IND_Entity2d *mBack = IND_Entity2d::newEntity2d();
	mI->_entity2dManager->add(mBack);					// Entity adding
	mBack->setSurface(mSurfaceBack);					// Set the surface into the entity

	//star
	IND_Entity2d *star = IND_Entity2d::newEntity2d();
	mI->_entity2dManager->add(star);
	star->setSurface(mSurfaceStar);

	// Character 1
	IND_Entity2d *mPlayer1 = IND_Entity2d::newEntity2d();
	mI->_entity2dManager->add(mPlayer1);					// Entity adding
	mPlayer1->setAnimation(mAnimationCharacter1);				// Set the animation into the entity

	// Character 2
	IND_Entity2d *mPlayer2 = IND_Entity2d::newEntity2d();
	mI->_entity2dManager->add(mPlayer2);					// Entity adding
	mPlayer2->setAnimation(mAnimationCharacter2);				// Set the animation into the entity

	// Dust explosion
	IND_Entity2d *mDust = IND_Entity2d::newEntity2d();
	mI->_entity2dManager->add(mDust);					// Entity adding
	mDust->setAnimation(mAnimationDust);					// Set the animation into the entity

	// ----- Changing the attributes of the 2d entities -----

	// Player 1
	mPlayer1->setSequence(0);						// Choose sequence
	mPlayer1->setPosition(140, 200, 0);
	mPlayer1->setMirrorX(1);						// Horizontal mirroring

	// Dust explosion
	mDust->setPosition(360, 250, 0);

	// Player 2
	mPlayer2->setSequence(0);						// Choose sequence
	mPlayer2->setPosition(550, 200, 0);
	mPlayer2->setNumReplays(3);						// The animation will be displayed 3 times


	//star
	star->setPosition(mI->_window->getWidth() - mSurfaceStar->getWidth(), 0, 100);
	// ----- Main Loop -----

	while (!mI->_input->onKeyPress(IND_ESCAPE) && !mI->_input->quit())
	{
		mI->_input->update();
		// Toogle full screen when pressing "space"
		//if (mI->_input->onKeyPress(IND_SPACE)) mI->_render->toggleFullScreen();
		mI->_render->beginScene();
		mI->_entity2dManager->renderEntities2d();
		mI->_render->endScene();
	}

	// ----- Free -----

	mI->end();

	return 0;
}