当前位置: 首页>>代码示例>>C++>>正文


C++ CGameManager类代码示例

本文整理汇总了C++中CGameManager的典型用法代码示例。如果您正苦于以下问题:C++ CGameManager类的具体用法?C++ CGameManager怎么用?C++ CGameManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CGameManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WinMain

int APIENTRY WinMain(HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR lpszCmdParam,
	int nCmdShow)
{
#ifdef DEBUG
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
	//_CrtSetBreakAlloc(157);

	AllocConsole();
	FILE* console;
	freopen_s(&console, "CONOUT$", "wt", stdout);
#endif

	CGameManager *GameManager = CGameManager::GetInstance();
	GameManager->initialize(600, 600);
	GameManager->changeScene(new CStartScene());
	GameManager->run();

#ifdef DEBUG
	FreeConsole();
#endif

	return 0;
}
开发者ID:mastrayer,项目名称:3D_Arkanoid,代码行数:25,代码来源:3D_Arkanoid.cpp

示例2: getGameManager

bool CPetControl::checkNode(const CString &name) {
	CGameManager *gameManager = getGameManager();
	if (!gameManager)
		return true;
	if (name == "NULL")
		return false;

	CViewItem *view = gameManager->getView();
	if (!view)
		return true;

	CNodeItem *node = view->findNode();
	if (!node)
		return true;

	CString viewName = view->getName();
	CString nodeName = node->getName();
	CRoomItem *room = getGameManager()->getRoom();

	if (room) {
		CString roomName = room->getName();
		CString newNode;

		if (roomName == "1stClassRestaurant") {
		} else if (nodeName == "Lobby Node") {
			nodeName = "Node 1";
		} else if (nodeName == "Entrance Node") {
			nodeName = "Node 2";
		} else if (nodeName == "MaitreD Node") {
			nodeName = "Node 3";
		} else if (nodeName == "Scraliontis Table Standing Node") {
			nodeName = "Node 4";
		} else if (nodeName == "Pellerator Node") {
			nodeName = "Node 5";
		} else if (nodeName == "SUB Node") {
			nodeName = "Node 6";
		} else if (nodeName == "Phonograph Node") {
			nodeName = "Node 7";
		} else if (nodeName == "Scraliontis Table Seated Node") {
			nodeName = "Node 8";
		}

		if (roomName == "MusicRoom") {
			if (nodeName == "Musical Instruments")
				nodeName = "Node 1";
			if (nodeName == "Phonograph Node")
				nodeName = "Node 2";
		}
	}

	CString str = CString::format("%s.%s", nodeName.c_str(), viewName.c_str());
	str = str.right(5);
	str.toLowercase();

	CString nameLower = name;
	nameLower.toLowercase();

	return nameLower.contains(str);
}
开发者ID:86400,项目名称:scummvm,代码行数:59,代码来源:pet_control.cpp

示例3:

CRoomItem *CPetRemote::getRoom() const {
	if (_petControl) {
		CGameManager *gameManager = _petControl->getGameManager();
		if (gameManager)
			return gameManager->getRoom();
	}

	return nullptr;
}
开发者ID:Tkachov,项目名称:scummvm,代码行数:9,代码来源:pet_remote.cpp

示例4: getGameManager

void CProjectItem::postLoad() {
    CGameManager *gameManager = getGameManager();
    if (gameManager)
        gameManager->postLoad(this);

    CPetControl *petControl = getPetControl();
    if (petControl)
        petControl->postLoad();
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:9,代码来源:project_item.cpp

示例5: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	CGameManager gameManager;

	gameManager.Init();
	gameManager.Run();
	gameManager.Release();

	getchar();
	return 0;
}
开发者ID:Woonohyo,项目名称:NEXT_CPP_Learning-1,代码行数:11,代码来源:SUD.cpp

示例6:

TTnpcScript *CPetConversations::getNPCScript(const CString &name) const {
	if (name.empty() || !_petControl)
		return nullptr;
	CGameManager *gameManager = _petControl->getGameManager();
	if (!gameManager)
		return nullptr;
	CTrueTalkManager *trueTalk = gameManager->getTalkManager();
	if (!trueTalk)
		return nullptr;

	return trueTalk->getTalker(name);
}
开发者ID:OmerMor,项目名称:scummvm,代码行数:12,代码来源:pet_conversations.cpp

示例7: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	argc;
	argv;

	CGameManager gameManeger;

	gameManeger.Init();
	gameManeger.Run();
	gameManeger.Release();

	system("pause");

	return 0;
}
开发者ID:happyhj,项目名称:flagueInc_cpp,代码行数:15,代码来源:flague.cpp

示例8: onIdle

void CMainGameWindow::onIdle() {
	if (!_inputAllowed)
		return;
	CGameManager *gameManager = _gameManager;
	if (!gameManager)
		return;

	// Let the game manager perform any game updates
	gameManager->update();

	if (gameManager->_gameState._quitGame) {
		// Game needs to shut down
		_vm->quitGame();
	}
}
开发者ID:Tkachov,项目名称:scummvm,代码行数:15,代码来源:main_game_window.cpp

示例9: getPetControl

bool CRemoteGotoGlyph::MouseButtonUpMsg(const Point &pt) {
	if (!_gfxElement || !_gfxElement->MouseButtonUpMsg(pt))
		return false;

	CPetControl *petControl = getPetControl();
	if (petControl) {
		CGameManager *gameManager = petControl->getGameManager();

		if (gameManager) {
			CRoomItem *room = gameManager->getRoom();

			if (room) {
				CTransportMsg msg(g_vm->_roomNames[_roomIndex], 1, 0);
				msg.execute(room);
			}
		}
	}

	return true;
}
开发者ID:Tkachov,项目名称:scummvm,代码行数:20,代码来源:pet_remote_glyphs.cpp

示例10: main

int main()
{
    srand((unsigned int)time(NULL));

	CGameManager *GameMng = new CGameManager();

	sf::RenderWindow App(sf::VideoMode(800,600,32), "PycMan", sf::Style::Close);
	App.setVerticalSyncEnabled(true);


	GameMng->Run(App);


	App.clear();
	App.close();

	delete GameMng;

	return 0;
}
开发者ID:urbanek32,项目名称:PycMan,代码行数:20,代码来源:main.cpp

示例11: _tmain

int _tmain(int argc, _TCHAR* argv[])
{

	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);


	argc;
	argv;


	std::string helloWorld = "Hello World";
	std::cout<<helloWorld << std::endl;

	CGameManager gameManager;

	gameManager.Init();
	gameManager.Run();
	gameManager.Release();


	//getchar();
	return 0;
}
开发者ID:itoolsg,项目名称:CPP,代码行数:23,代码来源:SUD.cpp

示例12: main

int main ( int argc, char** argv )
{

    if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        printf( "Unable to init SDL: %s\n", SDL_GetError() );
        return 1;
    }

     atexit(SDL_Quit);

     screen = SDL_SetVideoMode(SCREENW, SCREENH, 32,
                                           SDL_HWSURFACE|SDL_DOUBLEBUF);
    if ( !screen )
    {
        printf("Unable to set 800x600 video: %s\n", SDL_GetError());
        return 1;
    }
	SDL_WM_SetCaption("Szit the Game", NULL);
	if( TTF_Init() == -1 )
    {
		printf("Unable to initialize font");
        return 1;
    }

    font=TTF_OpenFont("tahoma.ttf", 28);
    if(font){printf("Success");}

    // centre the bitmap on screen

	CGameManager manager;

    bool done = false;
    CBlock blockT(0, -1, 0, 0, 0, 1, 0, 0, -1, 100, 100, 100); //t
    blockT.TryTurn();
    blockT.Turn();
    blockT.TryTurn();
    blockT.Turn();

    CBlock blockZ(0, -1,-1,0,-1,0,0,1,0, 198,255,126); //z
    CBlock blockS(0, -1,0,0,0,0,-1,1,-1, 126,196,255); //s
    CBlock blockO(1, 0,0,1,0,0,1,1,1, 100, 100, 0); //o
    CBlock blockI(0, 0,-1,0,0,0,1,0,2, 255,159,126); //i
    CBlock blockJ(0, -1,1,0,1,0,0,0,-1, 139,77,156); //j
    CBlock blockL(0, 0,-1,0,0,0,1,1,1, 255,229,126); //l

    CBlock GameBlock(0, -1, 0, 0, 0, 1, 0, 0, -1, 179,206,221); //creating t
    CBlock NextBlock(0, -1, 0, 0, 0, 1, 0, 0, -1, 179,206,221); //t
    //CBlock GameBlock(0, -1,0,0,0,0,-1,1,-1); //s
    //CBlock GameBlock(0, 0,-1,0,0,0,1,0,2); //i


	CButton start(300, 350, 200, 50, 100, 100, 100, 150, 150, 150, 1, "Start");
	CButton help(300, 425, 200, 50, 100, 100, 100, 150, 150, 150, 0, "Help");
	CButton exit(300, 500, 200, 50, 100, 100, 100, 150, 150, 150, 0, "Exit");
	CButton easy(100, 350, 200, 50, 200, 200, 200, 255, 255, 255, 0, "Easy");
	CButton medium(300, 350, 200, 50, 200, 200, 200, 255, 255, 255, 1, "Medium");
	CButton hard(500, 350, 200, 50, 200, 200, 200, 255, 255, 255, 0, "Hard");
	manager.Refresh(&GameBlock, &NextBlock);
	manager.Refresh(&GameBlock, &NextBlock);


	srand(time(NULL));
			switch(rand()%7){
					case 0: GameBlock.Set(0, -1, 0, 0, 0, 1, 0, 0, -1,179,206,221);break; //t
					case 1: GameBlock.Set(0, -1,-1,0,-1,0,0,1,0, 198,255,126);break; //z
					case 2: GameBlock.Set(0, -1,0,0,0,0,-1,1,-1, 126,196,255);break; //s
					case 3: GameBlock.Set(1, 0,0,1,0,0,1,1,1, 100, 100, 0);break; //o
					case 4: GameBlock.Set(0, 0,-1,0,0,0,1,0,2, 255,159,126);break; //i
					case 5: GameBlock.Set(0, -1,1,0,1,0,0,0,-1, 139,77,156);break; //j
					case 6: GameBlock.Set(0, 0,-1,0,0,0,1,1,1, 255,229,126);break; //l
			}

	srand(time(NULL)+SDL_GetTicks());
			switch(rand()%7){
					case 0: NextBlock.Set(0, -1, 0, 0, 0, 1, 0, 0, -1,179,206,221);break; //t
					case 1: NextBlock.Set(0, -1,-1,0,-1,0,0,1,0, 198,255,126);break; //z
					case 2: NextBlock.Set(0, -1,0,0,0,0,-1,1,-1, 126,196,255);break; //s
					case 3: NextBlock.Set(1, 0,0,1,0,0,1,1,1, 100, 100, 0);break; //o
					case 4: NextBlock.Set(0, 0,-1,0,0,0,1,0,2, 255,159,126);break; //i
					case 5: NextBlock.Set(0, -1,1,0,1,0,0,0,-1, 139,77,156);break; //j
					case 6: NextBlock.Set(0, 0,-1,0,0,0,1,1,1, 255,229,126);break; //l
			}

    // program main loop
    while (!done)
    {
        // message processing loop
        SDL_Event event;
        ++frame;
		SetFPS();
		LastFrame=SDL_GetTicks();

		if(gamestatus==1){manager.Refresh(&GameBlock, &NextBlock);
		}

        while (SDL_PollEvent(&event))
        {
            // check for messages
            switch (event.type)
//.........这里部分代码省略.........
开发者ID:rybycy,项目名称:SzitTetris,代码行数:101,代码来源:Szit.cpp

示例13: lua_getglobal

void CScriptManager::Execute( CAbility* pAbility, CTile* pTile, CUnit* pCaster, CTile* TileCharged )
{
		// Finds the facing for the specified unit
		int face = pCaster->GetFacing();
		std::vector< Vec2D > TilePos;
		
		std::vector< Vec2D > pat;
		if( pAbility->GetIfFacing() )
			pat = CAbilityManager::GetInstance()->GetProperFacing(pCaster->GetFacing(), pAbility, pTile);
		else
			pat = pAbility->GetPattern();
		
		for( unsigned int i = 0; i < pAbility->GetPattern().size(); i++ )
		{
			pat[i].nPosX += pTile->GetPosition().nPosX;
			pat[i].nPosY += pTile->GetPosition().nPosY;

			TilePos.push_back(pat[i]);
		}

		lua_getglobal(L, "OnUse");

		lua_newtable(L);
		CGameManager* pGM = CGameManager::GetInstance();
		vector< CUnit* > affected;
		int nCount = 0;
		int z = (int)TilePos.size()-1;
		for( int i = 0; i <= z; i++ )
		{
			CUnit* tmp = pGM->FindUnit(TilePos[i].nPosX, TilePos[i].nPosY);
		
			if( pAbility->GetType() == SP_CHARGE || pAbility->GetType() == SP_RUSH )
			{
				if( TilePos[i] == TileCharged->GetPosition() )
					break;
			}

			if( tmp == nullptr )
				continue;

			affected.push_back( tmp );

			lua_newtable(L);
			lua_pushstring(L, "posX");
			lua_pushnumber(L, tmp->GetPos().nPosX);
			lua_settable(L, -3);
			lua_pushstring(L, "posY");
			lua_pushnumber(L, tmp->GetPos().nPosY);
			lua_settable(L, -3);
			lua_pushstring(L, "health");
			lua_pushnumber(L, tmp->GetHP());
			lua_settable(L, -3);
			lua_pushstring(L, "speed");
			lua_pushnumber(L, tmp->GetSpeed());
			lua_settable(L, -3);
			lua_pushstring(L, "shielded");
			lua_pushnumber(L, tmp->GetShielded());
			lua_settable(L, -3);
			lua_pushstring(L, "uniqueID");
			lua_pushnumber(L, tmp->GetUniqueID());
			lua_settable(L, -3);
			lua_pushnumber(L, nCount+1);
			nCount++;
			lua_insert(L, -2);
			lua_settable(L, -3);
		}

		lua_setglobal(L, "tUnitData");

		std::string path = "Assets/Ability/" + pAbility->GetLua();
		luaL_dofile(L, path.c_str());
		lua_getglobal(L, "OnUse");
		
		lua_pcall(L, 0, 0, 0);

		lua_getglobal(L, "tUnitData");
		lua_pushnil(L);
	
		vector<std::pair<std::string, int>> tData;
	//	std::pair<std::string, int> tmp;

		tData.clear();

		while(lua_next(L, -2) != 0) 
		{
			if( lua_istable(L, -1) )
			{
				lua_pushnil(L);
				while( lua_next(L, -2) )
				{
					if(lua_isnumber(L, -1))
					{
						std::pair<std::string, int> tmp;
						tmp.first = lua_tostring(L, -2);
						tmp.second = (int)lua_tonumber(L, -1);
						tData.push_back(tmp);
					}
					lua_pop(L, 1);
				}
			}
//.........这里部分代码省略.........
开发者ID:Jon-Stumpfel,项目名称:league-of-champion-craft,代码行数:101,代码来源:ScriptManager.cpp

示例14: getGameManager

void CTrueTalkNPC::startTalker(CViewItem *view) {
	CGameManager *gameManager = getGameManager();
	if (gameManager)
		gameManager->getTalkManager()->start4(this, view);
}
开发者ID:Tkachov,项目名称:scummvm,代码行数:5,代码来源:true_talk_npc.cpp

示例15: switch

// This is the MessageSystem MessageProc. Message handling is done here
void CGameManager::MessageProc(IMessage* pMsg)
{
	CGameManager* pThis = CGameManager::GetInstance();
	// MESSAGE HANDLING
	switch (pMsg->GetMessageID())
	{
	case MSG_SPAWNUNIT:
		{
			CSpawnUnitMessage* pSMSG = dynamic_cast<CSpawnUnitMessage*>(pMsg);
			CUnit* pUnit = (CUnit*)CObjectManager::GetInstance()->CreateObject(pSMSG->GetUnitType(), pSMSG->GetPlayerID() );
			pUnit->SetPos(pSMSG->GetPos());

			if (CTileManager::GetInstance()->GetTile(pSMSG->GetPos().nPosX, pSMSG->GetPos().nPosY)->GetIfOccupied())
			{
				CUnit* pOccupyingUnit = CGameManager::GetInstance()->FindUnit(pSMSG->GetPos());
				if (pOccupyingUnit != pUnit)
				{
					Vec2D newpos = CAIManager::GetInstance()->NearestOpen(pOccupyingUnit->GetPos(), pSMSG->GetPos());
					pUnit->SetPos(pSMSG->GetPos());
					pUnit->AddWaypoint(CTileManager::GetInstance()->GetTile(newpos.nPosX, newpos.nPosY));
				}
			}
			if (CTileManager::GetInstance()->GetTile(pUnit->GetPos().nPosX, pUnit->GetPos().nPosY)->GetIfResourceTile()==true)
			{
				if (CTileManager::GetInstance()->GetTile(pUnit->GetPos().nPosX, pUnit->GetPos().nPosY)->GetIfCaptured())
				{
					if (CTileManager::GetInstance()->GetTile(pUnit->GetPos().nPosX, pUnit->GetPos().nPosY)->GetPlayerID() != pUnit->GetPlayerID())
					{
						CTileManager::GetInstance()->GetTile(pUnit->GetPos().nPosX, pUnit->GetPos().nPosY)->SetStatus(TS_CAPTURING,true);
				CTileManager::GetInstance()->GetTile(pUnit->GetPos().nPosX, pUnit->GetPos().nPosY)->SetPlayerID(pUnit->GetPlayerID());
					}
				}
				else
				{
				CTileManager::GetInstance()->GetTile(pUnit->GetPos().nPosX, pUnit->GetPos().nPosY)->SetStatus(TS_CAPTURING,true);
				CTileManager::GetInstance()->GetTile(pUnit->GetPos().nPosX, pUnit->GetPos().nPosY)->SetPlayerID(pUnit->GetPlayerID());
				}
			}
			pUnit->SetFacing(pSMSG->GetFacing());
			pUnit->SetPlayerID(pSMSG->GetPlayerID());

			CPlayer* pPlayer = CGameManager::GetInstance()->GetPlayer(pSMSG->GetPlayerID());
			switch (pSMSG->GetUnitType())
			{
			case UT_SWORDSMAN:
				pPlayer->GetStats()->nSwordsmanCreated++;
				break;
			case UT_ARCHER:
				pPlayer->GetStats()->nArcherCreated++;
				break;
			case UT_CAVALRY:
				pPlayer->GetStats()->nCalvaryCreated++;
				break;
			}

			if (pSMSG->GetLoaded())
			{
				pUnit->SetHP(pSMSG->GetHealth());
				pUnit->SetTilesMoved(pSMSG->GetTilesMoved());
				pUnit->SetHasAttacked(pSMSG->GetHasAttacked());
				if (pSMSG->GetSpellSize() != 0)
				{
					for (int i = 0; i < pSMSG->GetSpellSize(); ++i)
					{
						((CHero*)pUnit)->SwapSpell(CAbilityManager::GetInstance()->GetAbility(pSMSG->GetSpells(i)), i);
						((CHero*)pUnit)->SetCooldown(i, pSMSG->GetCooldown(i) );
					}

					for (unsigned int i = 0; i < pSMSG->GetBought().size(); ++i)
					{
						((CHero*)pUnit)->SpellBought(CAbilityManager::GetInstance()->GetAbility(pSMSG->GetBought()[i]));
					}
				}
				if (pSMSG->GetEffects().size() != 0)
				{
					for (unsigned int i = 0; i < pSMSG->GetEffects().size(); ++i)
					{
						pUnit->PushEffect(CAbilityManager::GetInstance()->GetAbility(pSMSG->GetEffects()[i]),1);
					}

				}
			}
		}
		break;
	case MSG_DESPAWNUNIT:
		{
			CDespawnUnitMessage* pSMSG = dynamic_cast<CDespawnUnitMessage*>(pMsg);
			if (CGameplayState::GetInstance()->GetSelectedUnit() == pSMSG->GetUnit())
			{
				CGameplayState::GetInstance()->ClearSelections();
			}
			CTile* tile = CTileManager::GetInstance()->GetTile(pSMSG->GetUnit()->GetPos().nPosX, pSMSG->GetUnit()->GetPos().nPosY);

			int nUnitID = pSMSG->GetUnit()->GetUniqueID();
			if (tile != nullptr)
			{
				tile->SetIfOccupied(false);
				if (pSMSG->GetUnit()->GetType() != UT_SKELETON)
					tile->SetIfDeadTile(true);
//.........这里部分代码省略.........
开发者ID:Jon-Stumpfel,项目名称:league-of-champion-craft,代码行数:101,代码来源:GameManager.cpp


注:本文中的CGameManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。