Example #1
0
void Ending::InputProcess()
{
    if (CurrentNum < EndingSceneNum-1)
    {
        if (InputManager()->KeyDown(VK_RETURN))
        {
            CurrentBit = &hbit[++CurrentNum];

        }
    }

    if (CurrentNum == EndingSceneNum-1)
    {
        if (InputManager()->KeyDown(VK_LBUTTON) &&
                PtInRect(&CommonPtr()->GetMain(), InputManager()->GetMousePos()))
            SceneManager()->ChangeScene(new Main);

    }
}
Example #2
0
void Scene1::Update(const float deltaTime){
	InputManager();
	/*if (canJump){
		if (player->position.y < 2.0f && !hitPeak)
			player->velocity.y = player->jumpVel;
		else if (moveY > 2.0f){
			hitPeak = true;
			player->velocity.y = physicsGravity.y;
		}
		else if (hitPeak){
			speedY = -0.5f;
			if (moveY <= 1.5f){
				canJump = false;
				speedY = 0;
			}
		}
	}*/

	if (player->pos.x > window->GetWidth() / 2){
		scroll = true;
		if (player->velocity.x > 0.0f)
			player->velocity.x = 0.0f;
		else
			scroll = false;
	}
	else{
			scroll = false;
	}
	
	player->position.x += player->velocity.x;
	player->position += (player->velocity * deltaTime) + 0.5f * physicsGravity * (deltaTime * deltaTime);
	player->velocity += physicsGravity * deltaTime;

	if (player->position.y <= 1.5f){
		isGrounded = true;
		canJump = true;
		physicsGravity = Vec3(0, 0, 0);
		player->velocity.y = 0.0f;
		player->position.y = 1.5f;
	}
	else {
		isGrounded = false;
		canJump = false;
		physicsGravity = Vec3(0, -1.0f, 0);
	}


	player->position.y += speedY;
	screenX += screenMoveX;
	screenX2 += screenMoveX;
	scrollCheck();
	Render();

}
Example #3
0
	KVOID AppFrame::CreateWidgets()
	{
 		if (!OgreRoot::Initialized())
 			KNEW OgreRoot();
		if (!DataManager::Initialized())
			KNEW DataManager();
		//////////////////////////////////////////////////////////////////////////
		m_pSceneMgr = m_pRoot->createSceneManager("OctreeSceneManager");//Ogre::ST_EXTERIOR_CLOSE);

		// set shadow properties
// 		m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_NONE);
// 		m_pSceneMgr->setShadowColour(Ogre::ColourValue(0.5, 0.5, 0.5));
// 		m_pSceneMgr->setShadowTextureSize(1024);
// 		m_pSceneMgr->setShadowTextureCount(1);

		//////////////////////////////////////////////////////////////////////////
		Ogre::Camera* pCam = OgreRoot::GetSingletonPtr()->CreateCamera("$MainCamera");
		if (pCam)
		{
			OgreRoot::GetSingletonPtr()->CreateViewports(pCam);
		}
		// splash
		Kylin::LoadingProgress* pLoading = KNEW Kylin::LoadingProgress();
		pLoading->Initialize();
		pLoading->SetVisible(true);
		//////////////////////////////////////////////////////////////////////////
		Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
		//////////////////////////////////////////////////////////////////////////
		m_pInputMgr = KNEW InputManager();
		m_pInputMgr->Initialize();
		//////////////////////////////////////////////////////////////////////////
		m_pGuiMgr = KNEW GuiManager();
		m_pGuiMgr->Create(m_pWindow,m_pSceneMgr);
		m_pGuiMgr->RegisterGui(pLoading);
		//////////////////////////////////////////////////////////////////////////
		m_pScriptVM = KNEW ScriptVM();
		if(m_pScriptVM->Init())
		{
			OpenScriptBinding(m_pScriptVM->GetLuaState());
			m_pScriptVM->ExecuteScriptFile("./Data/script/startvm.lua");
		}

		//////////////////////////////////////////////////////////////////////////
		if (!EffectManager::Initialized())
			KNEW EffectManager();
		EffectManager::GetSingletonPtr()->Initialize();

		OgreOggSound::OgreOggSoundManager::getSingletonPtr()->init();
		//////////////////////////////////////////////////////////////////////////
		if (!m_pRenderableMgr)
			m_pRenderableMgr = KNEW RenderableManager();
Example #4
0
void Main::RectCheck()
{

	if (InputManager()->KeyDown(VK_LBUTTON))
	{
		if (PtInRect(&Button[0], InputManager()->GetMousePos())) // 마우스 커서가 버튼 위일때
			StartState = ButtonClicked;

		else if (PtInRect(&Button[1], InputManager()->GetMousePos()))
			PostQuitMessage(0);

		else if ((PtInRect(&Button[2], InputManager()->GetMousePos()))
			&& (InfoState != InfoMoveLeft))
		{
			if (InfoState == InfoActionLess)
				InfoState = InfoMoveLeft;
			else if (InfoState == InfoStoped)
				InfoState = InfoMoveRight;
		}
		else if (PtInRect(&Button[4], InputManager()->GetMousePos()))
			SceneManager()->ChangeScene(new CollectScene);
	}
}
Example #5
0
void Program::init(void)
{
	BENCH_START();

	createWindow();

	setTargetFPS(60.0);

	mp_DataManager = New DataManager();
	mp_DataManager->loadData("GameData.bin");

	mp_DataManager->saveData("GameData.out.txt");
	mp_DataManager->saveData("GameData.out.bin");

	mp_InputManager = New InputManager();
	mp_UnitManager = New UnitManager();

	Unit *pTestUnit = New Unit();
	mp_UnitManager->addUnit(pTestUnit);
	mp_UnitManager->addTag("test", pTestUnit);

	BENCH_PRINT("Program::init");
}
Example #6
0
void Situation_5::InputProcess()
{

	if (InputManager()->KeyDown(VK_LBUTTON))
	{
		if (SitState == Narr2)
		{
			if (PtInRect(&CommonPtr()->GetA(), InputManager()->GetMousePos()))
			{
				Game()->SetCollectionCleared(8);
				CommonPtr()->ResetCommon();
				CommonPtr()->PlayDeadBGM();
				SitState = Sit_A_1;
			}
			else if (PtInRect(&CommonPtr()->GetB(), InputManager()->GetMousePos()))
			{
				Game()->SetCollectionCleared(9);
				CommonPtr()->ResetCommon();
				CommonPtr()->PlayDeadBGM();
				SitState = Sit_B_1;
			}
			else if (PtInRect(&CommonPtr()->GetC(), InputManager()->GetMousePos()))
			{
				CommonPtr()->ResetCommon();
				SitState = Sit_C_1;
			}
		}
		//////////////////////////////////////////////////////////////////////////
		else if (SitState == Sit_A_2)		// 맞는 선택지가 비어있음
		{
			if (PtInRect(&CommonPtr()->GetReturn(), InputManager()->GetMousePos()))
				SceneManager()->ChangeScene(new Situation_1);
			else if (PtInRect(&CommonPtr()->GetMain(), InputManager()->GetMousePos()))
				SceneManager()->ChangeScene(new Main);
			else if (PtInRect(&CommonPtr()->GetExit(), InputManager()->GetMousePos()))
				PostQuitMessage(0);
		}
		else if (SitState == Sit_B_2)
		{
			if (PtInRect(&CommonPtr()->GetReturn(), InputManager()->GetMousePos()))
				SceneManager()->ChangeScene(new Situation_1);
			else if (PtInRect(&CommonPtr()->GetMain(), InputManager()->GetMousePos()))
				SceneManager()->ChangeScene(new Main);
			else if (PtInRect(&CommonPtr()->GetExit(), InputManager()->GetMousePos()))
				PostQuitMessage(0);
		}
		else if (SitState == Sit_C_2)
		{

		}
	}
	if (InputManager()->KeyDown(VK_RETURN))	// 엔터
	{
		if (SitState == Narr1)
		{
			if (CommonPtr()->GetPressEnter() && InputManager()->KeyDown(VK_RETURN))	// 엔터
			{
				CurrentNarr = &hbit[2];
				CommonPtr()->SetStartTime(GetTickCount());
				SitState = Narr2;
			}
		}
		else if (CommonPtr()->GetPressEnter() && SitState == Sit_A_1)
		{
			SitState = Sit_A_2;
		}
		else if (CommonPtr()->GetPressEnter() && SitState == Sit_B_1)
		{
			SitState = Sit_B_2;
		}
		else if (CommonPtr()->GetPressEnter() && SitState == Sit_C_1)
		{
			SitState = Sit_C_2;
		}
		///////////////////////////////////////////////////
		else if (SitState == Sit_A_2) // 맞는 선택지에서 다음씬으로
		{

		}
		else if (SitState == Sit_B_2)
		{

		}
		else if (SitState == Sit_C_2)
		{
			SceneManager()->ChangeScene(new Situation_6);
		}
	}
}
Example #7
0
void Main::ButtonUpdate()
{
#pragma region Start
	if (StartState == ActionLess&&InfoState != InfoStoped) // 움직임이 없을 때
	{
		if (PtInRect(&Button[0], InputManager()->GetMousePos()))
		{
			ButtonMinY = Button[0].top - 400;
			StartState = Rise; // 위로 움직이도록
		}
	}
	else if (StartState == Rise)
	{
		if (Button[0].top > ButtonMinY)
			OffsetRect(&Button[0], 0, -(0.2*(Button[0].top+50 - ButtonMinY) + 5));
		else
			StartState = Fall;
	}
	else if (StartState == Fall)
	{
		if (Button[0].top >= 430)
		{
			//Button[0] = { 200, 430, 500, 500 };
			SetRect(&Button[0], 200, 430, 500, 500);
			StartState = ActionLess;
		}
		else
			//OffsetRect(&Button[0], 0, 8);
			OffsetRect(&Button[0], 0, ((430-Button[0].top)*0.1)+1);
	}
	else if (StartState == ButtonClicked)
	{
		static float FallSpeed = 10.0f;
		OffsetRect(&Button[0], 0, FallSpeed);
		FallSpeed += FallSpeed*0.1f;
	}
#pragma endregion Start

#pragma region Quit
	if (PtInRect(&Button[1], InputManager()->GetMousePos()) && InfoState != InfoStoped)
	{
		ButtonMaxX = InputManager()->GetMousePos().x + 500;
		QuitState = MoveRight;
	}
	if (QuitState == MoveRight)
	{
		if (Button[1].left < ButtonMaxX)
			OffsetRect(&Button[1], (0.05*(ButtonMaxX - Button[0].left) + 1), 0);
		else
			QuitState = MoveLeft;
	}
	else
	{
		if (Button[1].left <= 200)
		{
			return;
		}
		if (Button[1].left > 200)
		{
			OffsetRect(&Button[1], -20, 0);
			if (Button[1].left < 200)
				SetRect(&Button[1], 200, 530, 500, 600);
		}
	}
#pragma endregion Quit
}
Example #8
0
#include "InputManager.h"
#include "Vec2.h"
#include <math.h>

InputManager g_inputManager = InputManager();

class Vec2;

float LinearInterpolation( float time, float start, float end )
{
	return (start * (1 - time)) + (end * time);
}

Vec2 LinearInterpolation( float time, Vec2 start, Vec2 end )
{
	return (start * (1 - time)) + (end * time);
}

// Uses absolute values
// Eg: 5 and -100. 5 is the minimum.
float MinimumValue( float a, float b ) 
{
	float c = abs(a);
	float d = abs(b);

	if( c < d ) 
	{ 
		return a;
	} 

	else return b;