コード例 #1
0
ファイル: cButton.cpp プロジェクト: corbinat/NativeBlocks
void cButton::SetPressedImage(std::string a_AniFile, std::string a_Sprite)
{
   m_SpritePressedImage.first = a_AniFile;
   m_SpritePressedImage.second = a_Sprite;

   LoadAnimations(m_SpritePressedImage.first);
}
コード例 #2
0
ファイル: Mario.cpp プロジェクト: loctho1995/DemoDirectX
Mario::Mario(GameMap *gameMap)
{
    mCurrentAnimation = nullptr; //  new Animation();
    //mCurrentAnimation->SetFlipVertical(true);
    mIsFlipHorizontal = mIsFlipVertical = false;
    mPosition = D3DXVECTOR3(0, 0, 0); //mCurrentAnimation->GetPosition();


    //khoi tao dung ham initwithanimation
    this->mMap = gameMap;

    mCurrentVelocity = D3DXVECTOR3(0, 0, 0);
    mGravity = D3DXVECTOR3(0, 5, 0);
    mSpeedX = RUN_VELOCITY_KEY_PRESS; //RUN_VELOCITY_KEY_HOLDING;
    mCurrentJumpVelocity = JUMP_VELOCITY;
    mJumpHigh = 350; //cho phep nhay cao them 80 pixel
    mJumpVelocity = 8;
    mState = Mario::MarioStates::Standing;
    mSide = Mario::MarioSides::Right;

    LoadAnimations();

    IsCollideTop = IsCollideBottom = IsCollideLeft = IsCollideRight = false;
    this->Bound.left = (mCurrentAnimation)->GetPosition().x - (mCurrentAnimation)->getWidth() / 2;
    this->Bound.right = this->Bound.left + (mCurrentAnimation)->getWidth();
    this->Bound.top = (mCurrentAnimation)->GetPosition().y - (mCurrentAnimation)->getHeight() / 2;
    this->Bound.bottom = this->Bound.top + (mCurrentAnimation)->getHeight();
}
コード例 #3
0
AnimSprite::AnimSprite(const char* a_cpTexture, GLFWwindow* window)
{
	GameWindow = window;
	m_dElapsedTime = 0;
	
	m_v3Position = Vector3(g_gl_width/2, g_gl_height/2, 0);

	LoadVertShader("./resources/VertexShader.glsl");
	LoadFragShader("./resources/FragmentShader.glsl");
	LinkShaders();
	GLint uvAttrib = glGetAttribLocation(m_ShaderProgram, "texcoord");
	glEnableVertexAttribArray(uvAttrib);
	matrix_location = glGetUniformLocation(m_ShaderProgram, "matrix");

	LoadSlices(a_cpTexture);
	LoadAnimations(m_atlas.sAnimations.c_str());
	LoadTexture(m_atlas.sSheet.c_str());

	m_dFrameDuration = (1.0/5.0);
	m_sCurrentAnimation = "move N";
	m_sCurrentSlice = "move N 0";
	iCurrentFrame = 0;
	iLoopMarker = 0;
	currentCycle = LOOP;
	m_texSize = m_atlas.v2Size;

	SetSlice();
	UVSetup();

}
コード例 #4
0
GameEntity::GameEntity( const char* a_pSpriteSheet, GLFWwindow * window)
{
	GameWindow = window;
	elapsedTime = 0;
	LoadVertShader("./Resources/LoadVertexShader.glsl");
	LoadFragShader("./Resources/LoadFragmentShader.glsl");
	LinkShaders();
	GLint uvAttrib = glGetAttribLocation(m_ShaderProgram,"texcoord");
	glEnableVertexAttribArray(uvAttrib);
	matrix_location = glGetUniformLocation (m_ShaderProgram, "matrix");
	LoadSprites(a_pSpriteSheet);
	LoadAnimations(atlas.sAnimations.c_str());
	LoadTexture(atlas.sSheet.c_str());


	m_dFrames = (1.0/15.0);
	currentAnimation = "Idle";
	currentSprite = "Idle_01";
	currentFrame = 0;
	currentPlayType = SINGLE;
	m_uvScale.m_fX = atlas.v2Size.m_fY;
	m_uvScale.m_fY	= atlas.v2Size.m_fX;
	SetSprite();
	SetUVData();
	iFacing = "Right"; //flag for facing


}
コード例 #5
0
ファイル: cGameOver.cpp プロジェクト: corbinat/NativeBlocks
cGameOver::cGameOver(cResources* a_pResources)
   : cObject(a_pResources)
{
   SetType("GameOver");
   SetSolid(true);
   LoadAnimations("Media/Final.ani");
   PlayAnimationLoop("GameOver");
}
コード例 #6
0
ファイル: cPause.cpp プロジェクト: corbinat/NativeBlocks
cPause::cPause(cResources* a_pResources)
   : cObject(a_pResources)
{
   SetType("Pause");
   SetSolid(false);
   LoadAnimations("Media/Floor.ani");
   PlayAnimationLoop("Pause");
}
コード例 #7
0
ファイル: cWall.cpp プロジェクト: corbinat/NativeBlocks
cWall::cWall(cResources* a_pResources)
   : cObject(a_pResources)
{
   SetType("Wall");
   SetSolid(true);
   SetCollidable(true);
   LoadAnimations("Media/Floor.ani");
   PlayAnimationLoop("Wall");
}
コード例 #8
0
ファイル: cBonusShot.cpp プロジェクト: corbinat/NativeBlocks
cBonusShot::cBonusShot(sf::Vector3<double> a_Destination, cResources* a_pResources)
   : cObject(a_pResources),
     m_Destination(a_Destination),
     m_AngleInRadians(0),
     m_Speed(g_kInitialSpeed)
{
   SetType("BonusShot");
   SetSolid(false);
   LoadAnimations("Media/BonusShot.ani");
   PlayAnimationLoop("BonusShot");
}
コード例 #9
0
ファイル: cBoss.cpp プロジェクト: afj176/zelda
void cBoss::Init() {
	animations = LoadAnimations("res/boss.anim");
	currentAnimation = "all";
    SetHitpoints(5);
    SetMaxHitpoints(5);
	w = width;
	h = height;
	stepLength = step;
	attack = 2;
    EnableDyingAnimation(false);
}
コード例 #10
0
ファイル: cCloud.cpp プロジェクト: corbinat/NativeBlocks
cCloud::cCloud(cResources* a_pResources)
   : cObject(a_pResources),
     m_Speed(5)
{
   SetType("Cloud");
   SetSolid(true);
   LoadAnimations("Media/Title.ani");
   PlayAnimationLoop("Cloud1");
   SetDepth(1, kNormal);
   SetCollidable(false);
}
コード例 #11
0
ファイル: Animator.cpp プロジェクト: MattBeaud/Engine
void Animator::ImportSheet(const char* a_pSpriteSheet)
{
	LoadSprite(a_pSpriteSheet);
	LoadAnimations(atlas.sAnimations.c_str());

	m_dFrames = (1.0 / 15.0);
	currentAnimation = "";
	currentSprite = "idle";
	currentFrame = 0;
	currentPlayType = SINGLE;
	SetSprite();
}
コード例 #12
0
ファイル: cButton.cpp プロジェクト: corbinat/NativeBlocks
cButton::cButton(cResources* a_pResources)
   : cObject(a_pResources),
     m_SpriteImage("Media/Title.ani", "ButtonLeft"),
     m_SpritePressedImage("Media/Title.ani", "ButtonLeftPressed"),
     m_Label()
{
   SetType("Button");
   SetSolid(true);

   // Set default animations
   LoadAnimations(m_SpriteImage.first);
   PlayAnimationLoop(m_SpriteImage.second);
}
コード例 #13
0
ファイル: cArrow.cpp プロジェクト: corbinat/NativeBlocks
cArrow::cArrow(cResources* a_pResources)
   : cObject(a_pResources),
     m_BounceEnabled(false),
     m_BouncingLeft(true),
     m_Offset(0)
{
   SetType("cArrow");
   SetSolid(false);
   SetCollidable(false);

   LoadAnimations("Media/Challenge.ani");
   PlayAnimationLoop("StaticArrow");
}
コード例 #14
0
ファイル: anim_table.cpp プロジェクト: Sciumo/motive
bool AnimTable::InitFromFlatBuffers(const AnimTableFb& params,
                                    LoadRigAnimFn* load_fn) {
  // Deserialize `params` into the vector-of-vectors of animations.
  InitNameMapFromFlatBuffers(params);

  // Load each FlatBuffer animation file in turn using the callback `load_fn`.
  const bool load_ok = LoadAnimations(load_fn);
  if (!load_ok) return false;

  // Now that all animations have been loaded, calculate defining animation,
  // which is the union of all the animations on an object.
  CalculateDefinineAnims();
  return true;
}
コード例 #15
0
void GameGlobals::LoadData()
{
	// add Resources folder to search path. This is necessary when releasing for win32
	CCFileUtils::sharedFileUtils()->addSearchPath("Resources");

	// load sound effects & background music

	// create and add animations
	LoadAnimations();

	// load game data
	LoadTowerData();
	LoadEnemyData();
}
コード例 #16
0
ファイル: cTextBox.cpp プロジェクト: corbinat/NativeBlocks
cTextBox::cTextBox(cResources* a_pResources)
   : cObject(a_pResources),
     m_String("Test"),
     m_Data()
{
   SetType("TextBox");

   SetSolid(false);

   std::shared_ptr<sf::Font> l_Font
      = GetResources()->LoadFont("Media/junegull.ttf");
   m_Data.setFont(*(l_Font.get()));
   m_Data.setString(m_String);
   m_Data.setCharacterSize(20);
   m_Data.setColor(sf::Color::Black);

   LoadAnimations("Media/Title.ani");
   PlayAnimationLoop("TextBox");
}
コード例 #17
0
ファイル: cAiBlock.cpp プロジェクト: corbinat/NativeBlocks
cAiBlock::cAiBlock(cResources* a_pResources)
   : cObject(a_pResources),
     m_AiLabel(),
     m_Falling(false)
{
   SetType("cAiBlock");

   SetSolid(true);
   SetCollidable(true);

   std::shared_ptr<sf::Font> l_Font
      = GetResources()->LoadFont("Media/junegull.ttf");
   m_AiLabel.setFont(*(l_Font.get()));
   m_AiLabel.setCharacterSize(40);
   m_AiLabel.setColor(sf::Color::Black);

   LoadAnimations("Media/Challenge.ani");
   PlayAnimationLoop("AiBlock");
}
コード例 #18
0
void ColladaDoc::Load(
	lpxmlnode						 pNode)
{
	lpxmlnode pCurrNode = pNode;
	std::string Name = pCurrNode->name();	
	if(Name == "COLLADA") {

		//	COLLADA header found
		pCurrNode = pCurrNode->first_node();
		while(pCurrNode != NULL) {

			Name = pCurrNode->name();

			if(Name == "library_images")
				LoadImages(pCurrNode->first_node());

			else if(Name ==  "library_effects")
				LoadEffects(pCurrNode->first_node());

			else if(Name == "library_materials")
				LoadMaterials(pCurrNode->first_node());

			else if(Name == "library_geometries")
				LoadGeometries(pCurrNode->first_node());

			else if(Name == "library_animations")
				LoadAnimations(pCurrNode->first_node());

			else if(Name =="library_controllers")
				LoadControllers(pCurrNode->first_node());

			else if(Name == "library_visual_scenes")
				LoadVisualScenes(pCurrNode->first_node());

			else if(Name == "asset")
				LoadAssets(pCurrNode->first_node());

			pCurrNode = pCurrNode->next_sibling();
		};
	}
}
コード例 #19
0
AnimatedSprite::AnimatedSprite(const char* a_pSpriteSheet, GLFWwindow * window) {
	GameWindow = window;
	m_dElapsedTime = 0;
	LoadVertShader("../resources/VertexShader.glsl");
	LoadFragShader("../resources/FragShader.glsl");
	LinkShaders();

	GLint uvAttrib = glGetAttribLocation(m_ShaderProgram, "texcoord");
	glEnableVertexAttribArray(uvAttrib);
	matrix_location = glGetUniformLocation(m_ShaderProgram, "matrix");
	LoadSprites(a_pSpriteSheet);
	LoadAnimations(atlas.sAnimations.c_str());

	m_dFrames = (1.0 / 15.0);
	sCurrentAnimation = "";
	sCurrentSprite ="idle 0";
	CurrentPlayType = SINGLE;
	m_uvScale.m_fX = atlas.v2Size.m_fY;
	m_uvScale.m_fY = atlas.v2Size.m_fX;
	SetSprite();
	SetUVData();
}
コード例 #20
0
ファイル: EET.CPP プロジェクト: Comanche93/eech
void EET::LoadAnimations(FILE* file)
{
 LoadAnimations(file, animations);
 LoadAnimations(file, displacement_animations);
}
コード例 #21
0
void cCountdownStart::Step (uint32_t a_ElapsedMiliSec)
{
   m_TimeAlive += a_ElapsedMiliSec;

   if (m_TimeAlive > 1300 && m_State == kThreeState)
   {
      LoadAnimations("Media/Countdown.ani");
      PlayAnimationLoop("Three");
      PlaySound("Media/Sounds/BlockMove.wav");
      m_State = kTwoState;
   }
   else if (m_TimeAlive > 1900 && m_State == kTwoState)
   {
      PlayAnimationLoop("Two");
      PlaySound("Media/Sounds/BlockMove.wav");
      m_State = kOneState;
   }
   else if (m_TimeAlive > 2500 && m_State == kOneState)
   {
      PlayAnimationLoop("One");
      PlaySound("Media/Sounds/BlockMove.wav");
      m_State = kGoState;
   }
   else if (m_TimeAlive > 3100 && m_State == kGoState)
   {
      PlayAnimationLoop("Go");
      PlaySound("Media/Sounds/BlockMove.wav");
      GetResources()->GetBackGroundMusic()->play();
      m_State = kWaitState;
   }
   else if (m_TimeAlive > 3700)
   {
      if (GetResources()->GetGameConfigData()->GetProperty("GameType") == "Challenge")
      {
         // Anti-cheating measure. If this is a challenge game then mark the game
         // in progress. If the player quits out then we can use this to increase
         // the retry count
         std::string l_GameStarted =
            (*(GetResources()->GetGameConfigData()))["Challenge"]["GameStarted"];
         if (l_GameStarted == "1")
         {
            std::string l_RetryString =
               (*(GetResources()->GetGameConfigData()))["Challenge"]["Retries"];
            if (l_RetryString.empty())
            {
               l_RetryString = "0";
            }
            uint32_t l_RetryCount = std::stoi(l_RetryString);
            ++l_RetryCount;
            (*(GetResources()->GetGameConfigData()))["Challenge"]["Retries"]
               = std::to_string(l_RetryCount);
            }

         (*(GetResources()->GetGameConfigData()))["Challenge"]["GameStarted"] = "1";

         // Save progress for testing
         // (*(GetResources()->GetGameConfigData()))["Challenge"].ExportToFile("Config/SaveGame.SG");
      }

      // Tell the players they can begin.
      sMessage l_Message;
      l_Message.m_From = GetUniqueId();
      l_Message.m_Category = "StartGame";
      l_Message.m_Key = "StartGame";
      l_Message.m_Value = "StartGame";
      GetResources()->GetMessageDispatcher()->PostMessage(l_Message);

      UnregisterObject(true);
   }

}
コード例 #22
0
ファイル: Md3.cpp プロジェクト: MohamadIsmail/The_Invaders
bool CModelMD3::LoadModel(LPSTR strPath)
{
	char strLowerModel[255] = {0};
	char strUpperModel[255] = {0};
	char strHeadModel[255]  = {0};
	char strLowerSkin[255]  = {0};
	char strUpperSkin[255]  = {0};	
	char strHeadSkin[255]   = {0};	
	CLoadMD3 loadMd3;				
	if(!strPath) return false;
	sprintf(strLowerModel, "%s\\lower.md3", strPath);
	sprintf(strUpperModel, "%s\\upper.md3", strPath);
	sprintf(strHeadModel,  "%s\\head.md3",  strPath);
	sprintf(strLowerSkin, "%s\\lower.skin", strPath);
	sprintf(strUpperSkin, "%s\\upper.skin", strPath);
	sprintf(strHeadSkin,  "%s\\head.skin",  strPath);
	if(!loadMd3.ImportMD3(&m_Head,  strHeadModel))
	{
		MessageBox(NULL, "Unable to load the HEAD model!", "Error", MB_OK);
		return false;
	}

	if(!loadMd3.ImportMD3(&m_Upper, strUpperModel))		
	{
		MessageBox(NULL, "Unable to load the UPPER model!", "Error", MB_OK);
		return false;
	}

	if(!loadMd3.ImportMD3(&m_Lower, strLowerModel))
	{
		MessageBox(NULL, "Unable to load the LOWER model!", "Error", MB_OK);
		return false;
	}

	if(!loadMd3.LoadSkin(&m_Lower, strLowerSkin))
	{
		MessageBox(NULL, "Unable to load the LOWER skin!", "Error", MB_OK);
		return false;
	}

	if(!loadMd3.LoadSkin(&m_Upper, strUpperSkin))
	{
		MessageBox(NULL, "Unable to load the UPPER skin!", "Error", MB_OK);
		return false;
	}

	if(!loadMd3.LoadSkin(&m_Head,  strHeadSkin))
	{
		MessageBox(NULL, "Unable to load the HEAD skin!", "Error", MB_OK);
		return false;
	}

	LoadModelTextures(&m_Lower, strPath);
	LoadModelTextures(&m_Upper, strPath);
	LoadModelTextures(&m_Head,  strPath);
	char strConfigFile[255] = {0};	
	sprintf(strConfigFile,  "%s\\animation.cfg",  strPath);
	if(!LoadAnimations(strConfigFile))
	{
		MessageBox(NULL, "Unable to load the Animation Config File!", "Error", MB_OK);
		return false;
	}
	LinkModel(&m_Lower, &m_Upper, "tag_torso");
	LinkModel(&m_Upper, &m_Head, "tag_head");
	return true;
}
コード例 #23
0
ファイル: chest.cpp プロジェクト: uorbe001/necdromidas-dream
Chest::Chest(unsigned int posX, unsigned int posY, std::string nam, TextBubble *bub)
	:PhysicObject(posX, posY, 0,0,0)
{
  //Initialize  NPC
  bubble = bub;
  name = nam;
  talking = false;
  //Reacts to colitions.
  reactToColition = true;

	std::string fileName ("resources/config/scenery/");
	fileName += nam;
	fileName += ".cfg";

  std::fstream loadFile;
  std::string line;
	std::string text;
  loadFile.open(fileName.c_str());

  const char *temp;

  //Set the animations.
  getline(loadFile, line);
  temp = line.data();
  int numImgs = atoi(temp);

	animationVector.resize(2);

	for (;numImgs; numImgs--)
	{
    getline(loadFile, line);
    temp = line.data();
	  animationVector[0].imageList.push_back(temp);
	}

  //Set the animations.
  getline(loadFile, line);
  temp = line.data();
  numImgs = atoi(temp);

	for (;numImgs; numImgs--)
	{
    getline(loadFile, line);
    temp = line.data();
	  animationVector[1].imageList.push_back(temp);
	}

  //Set the text it says.
  getline(loadFile, line);
  temp = line.data();
  int numMsg = atoi(temp);

	for (;numMsg; numMsg--)
	{
    getline(loadFile, line);
    text = line.data();
	  speakList.push_back(text);
	}

  getline(loadFile, line);
  temp = line.data();
  unsigned int x = atoi(temp);

  getline(loadFile, line);
  temp = line.data();
  unsigned int y = atoi(temp);

  getline(loadFile, line);
  temp = line.data();
  unsigned int w = atoi(temp);
  oWidth = w;

  getline(loadFile, line);
  temp = line.data();
  unsigned int h = atoi(temp);
  oHeight = h;

	animationVector[0].horizontalFlip = false;
	animationVector[0].verticalFlip = false;
	animationVector[1].verticalFlip = false;
	animationVector[1].horizontalFlip = false;

  //create character colition box.

	colitionBoxes.resize(1);
  colitionBoxes[0].x = x;
  colitionBoxes[0].y = y;
  colitionBoxes[0].w = w;
  colitionBoxes[0].h = h;

  LoadAnimations();

  ResetBoxes();
}