示例#1
0
  // ******************************************************** Engine::creation
  Engine( bool use_gravity = false ) :
	_use_gravity(use_gravity), _gravity( TVec3(0,0,-9.81))
  {
  }
示例#2
0
//////////////////////////////////////////////////
//Overloaded constructor
//////////////////////////////////////////////////
TTile::TTile(TColor ttileTint, TPoint coOrds, int texture, TReal scale, int startValue, TBoard* parent, int tileNum, TAssetMap* gameMap)
{
	tileMap = gameMap;
	parentBoard = parent;
    //load the texture and create the sprite
    if (texture<0 || texture >15) texture=0; //Sanity Check

    tileTexture = tileMap->GetTexture(str::getFormatted("tiles/%s/tile%d",parent->getTextureSize().c_str(),texture));
    tileSprite = TSprite::Create(0,tileTexture);
    //set the drawspec of the tile to that of the sprite
    tileSpec = tileSprite->GetDrawSpec();
    //set the number of notes for the tile
    numberNotes = 0;
    notes = 0;

    alpha = 1.0;

    mistake = false;
    mistakeTile = NULL;

    //load the mistake texture
    mistakeTexture = gameMap->GetTexture(str::getFormatted("tiles/%s/wrong_marker",parent->getTextureSize().c_str()));

    //scale the tileCount according to the amount of tileCount on the screen
    tileSpec.mMatrix.Scale(scale);
    tileSpec.mAlpha = 0.75;
    tileSize = tileSpec.mMatrix[0].x;
    noteSize = scale/2;
    
    maxSize = tileSpec.mMatrix[0].x;
    timer = NULL;

    //set the coral as false
    hasCoral = false;

    //set the size of the notes and the value
    notex = (uint16_t)(NOTESIZEX*tileSpec.mMatrix[0].x);
    notey = (uint16_t)(NOTESIZEY*tileSpec.mMatrix[0].x);
    valueSize=(uint16_t)(VALUESIZE*tileSpec.mMatrix[0].x);

    //set the tint of the tile to shows its minigrid
    tileSpec.mTint = ttileTint;
    backupColour = ttileTint;
    originalColour = ttileTint;

    //If the tile has a loadedvalue then it isnt changeable.
    if(startValue!=0)
    {
        tileValue = startValue;
        tileIsChangeable = false;
        parent->tileFilled(true);
        valueSpec.mAlpha=.5;
        valueSpec.mTint=white;
    }
    //any tile that is changeable, add notes to it
    else
    {
        tileValue = 0;
        tileIsChangeable = true;
        valueSpec.mAlpha=1;
        valueSpec.mTint=white;
    }

    //set the draw postion of the tile graphic and the number
    tileSpec.mMatrix[2] = TVec3((TReal)coOrds.x,(TReal)coOrds.y,30.0);

    valueTexture = tileMap->GetTexture(str::getFormatted("tilesets/%s/%dtile%d",parent->getTextureSize().c_str(),TSettings::GetInstance()->getUserTileMode(),tileValue));
    valueSprite = TSprite::Create(0,valueTexture);
    valueSpec.mMatrix=tileSpec.mMatrix;

    //set the rotation to zero
    valueSpec.mMatrix[1].x = 0;
    valueSpec.mMatrix[0].y = 0;
    valueSpec.mAlpha = 1;

    tileNumber = (uint16_t)tileNum;
    initCoOrds.x = (int32_t) tileSpec.mMatrix[2].x;
    initCoOrds.y = (int32_t) tileSpec.mMatrix[2].y;

	str textureSize = parentBoard->getTextureSize();
	coralSpec.mMatrix = tileSpec.mMatrix;

	if (textureSize == "medium")
	{
		coralSpec.mMatrix.Scale(.5);
	}
	else if (textureSize == "small")
	{
		coralSpec.mMatrix.Scale(.25);
	}		
}