예제 #1
0
//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)
int main(int _argc, char** _argv)
{
	EEDesc desc;
	desc.applicationName = L"Emerald";	//窗口名称
	desc.isFullScreen = false;			//是否全屏
	desc.width = 800;					//窗口宽度
	desc.height = 450;					//窗口高度
	desc.isSSAA = true;					//是开启抗锯齿
	desc.isVsync = false;				//是否垂直同步
	EEInitialize(desc);

	EELine2D line(FLOAT2(2.0, 3.0), FLOAT2(200.0f, 300.0f));
	line.SetColor(EEColor::RED);

	
	while (EERun())
	{
		EEBeginScene(EEColor::BLACK);
		EEShowFPSInTitle(L"- -");

		line.Process();

		EEEndScene();
	}

	EEShutdown();
	return 0;
}
예제 #2
0
	//----------------------------------------------------------------------------------------------------
	bool EEProgressbar::Update()
	{
		if (!EEObject::Update())
			return false;

		UpdateObjectState();

		if (m_isPositionDirty)
		{
			m_isPositionDirty = false;
		}

		if (m_isScaleDirty || m_isLocalZOrderDirty || m_isProgressDirty)
		{
			Rect_Float rect(
				-m_quadWidth / 2,
				-m_quadHeight / 2,
				m_quadWidth / 2,
				m_quadHeight / 2
				);

			//the value of the z depends on the progress (the scaled end - the scaled width * (1.0f - the progress)
			rect.z -= (rect.z - rect.x) * (1.0f - m_progress);

			EEQuad2DVertex vertices[4];
			vertices[0].pos = FLOAT3(rect.x, rect.y, m_localZOrder * 0.0001f);
			vertices[0].tex = FLOAT2(0, 0);
			vertices[1].pos = FLOAT3(rect.z, rect.y, m_localZOrder * 0.0001f);
			vertices[1].tex = FLOAT2(m_progress, 0);
			vertices[2].pos = FLOAT3(rect.x, rect.w, m_localZOrder * 0.0001f);
			vertices[2].tex = FLOAT2(0, 1);
			vertices[3].pos = FLOAT3(rect.z, rect.w, m_localZOrder * 0.0001f);
			vertices[3].tex = FLOAT2(m_progress, 1);

			ID3D11DeviceContext *deviceContext = EECore::s_EECore->GetDeviceContext();
			D3D11_MAPPED_SUBRESOURCE mappedResource;
			ZeroMemory(&mappedResource, sizeof(D3D11_MAPPED_SUBRESOURCE));
			deviceContext->Map(m_quadVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
			memcpy(mappedResource.pData, vertices, sizeof(vertices));
			deviceContext->Unmap(m_quadVB, 0);

			if (m_isProgressDirty)
			{
				if (m_callbackFunc)
				{
					m_callbackFunc(m_progress);
				}
			}

			m_isScaleDirty = false;
			m_isLocalZOrderDirty = false;
			m_isProgressDirty = false;
		}

		m_progressFrame.Update();

		return true;
	}
예제 #3
0
	//----------------------------------------------------------------------------------------------------
	bool EECurve2D::Update()
	{
		if (!EEObject::Update())
			return false;

		UpdateObjectState();

		if (m_isPositionDirty)
		{
			m_isPositionDirty = false;
		}

		if (m_isLocalZOrderDirty || m_isCurveDirty)
		{
			std::vector<EECurve2DVertex> vertices(m_curve.size() << 1);
			if (m_curve.size() > 1)
			{
				float halfWidth = m_width / 2;
				float deltaTex = 1.f / m_curve.size();
				for (unsigned int i = 0; i < m_curve.size() - 1; ++i)
				{
					int index = i << 1;
					FLOAT2 vertical = (m_curve[i + 1] - m_curve[i]).GetVertical();
					vertices[index].pos = FLOAT3(m_curve[i] + vertical * halfWidth, m_localZOrder * 0.0001f);
					vertices[index].tex = FLOAT2(m_texRect.x, m_texRect.y + i * deltaTex);
					vertices[index + 1].pos = FLOAT3(m_curve[i] - vertical * halfWidth, m_localZOrder * 0.0001f);
					vertices[index + 1].tex = FLOAT2(m_texRect.z, m_texRect.y + i * deltaTex);
				}
				FLOAT2 vertical = (m_curve[m_curve.size() - 1] - m_curve[m_curve.size() - 2]).GetVertical();
				vertices[vertices.size() - 2].pos = FLOAT3(m_curve.back() + vertical * halfWidth, m_localZOrder * 0.0001f);
				vertices[vertices.size() - 2].tex = FLOAT2(m_texRect.x, m_texRect.w);
				vertices[vertices.size() - 1].pos = FLOAT3(m_curve.back() - vertical * halfWidth, m_localZOrder * 0.0001f);
				vertices[vertices.size() - 1].tex = FLOAT2(m_texRect.z, m_texRect.w);
			}

			if (m_isCurveDirty)
				CreateCurveVertexBuffer();
			if (m_curveVB)
			{
				ID3D11DeviceContext *deviceContext = EECore::s_EECore->GetDeviceContext();
				D3D11_MAPPED_SUBRESOURCE mappedResource;
				ZeroMemory(&mappedResource, sizeof(D3D11_MAPPED_SUBRESOURCE));
				deviceContext->Map(m_curveVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
				memcpy(mappedResource.pData, &vertices[0], sizeof(EECurve2DVertex)* vertices.size());
				deviceContext->Unmap(m_curveVB, 0);
			}

			m_isLocalZOrderDirty = false;
			m_isCurveDirty = false;
		}

		return true;
	}
예제 #4
0
SpotLight::SpotLight(ID3D10Device* _device, FLOAT3 _position, FLOAT3 _direction, FLOAT3 _la, FLOAT3 _ld, FLOAT3 _ls, FLOAT2 _angle, float _range)
{
	m_direction = _direction;
	//this->m_up = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
	//D3DXVECTOR3 evilVector;

	//if(this->m_direction.x <= this->m_direction.y && this->m_direction.x <= this->m_direction.z && this->m_direction.x > 0)
	//{
	//	evilVector = D3DXVECTOR3(1.0f, 0.0f, 0.0f);
	//}
	//else if(this->m_direction.y <= this->m_direction.z && this->m_direction.y > 0)
	//{
	//	evilVector = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
	//}
	//else
	//{
	//	evilVector = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
	//}

	//D3DXVec3Cross(&this->m_up, &this->m_direction.toD3DXVector(), &evilVector);

	this->m_up = D3DXVECTOR3(1.0f, 0.0f, 0.0f);

	this->m_la = _la;
	this->m_ld = _ld;
	this->m_ls = _ls;
	this->m_angle = FLOAT2(cos(_angle.x / 2), cos(_angle.y / 2));
	this->m_range = _range;

	m_shadowMap = new DepthStencil(_device, INT2(512, 512), false);
	this->setPosition(_position);
}
예제 #5
0
	//----------------------------------------------------------------------------------------------------
	std::vector<FLOAT2> EEBresenhamLine(const FLOAT2& _p0, const FLOAT2& _p1)
	{
		FLOAT2 delta(_p1.x - _p0.x, _p1.y - _p0.y);
		FLOAT2 forward(delta.x >= 0.f ? 1.f : -1.f, delta.y >= 0.f ? 1.f : -1.f);
		delta = FLOAT2(delta.x >= 0 ? delta.x : -delta.x, delta.y >= 0 ? delta.y : -delta.y);
		float e = 2 * delta.y - delta.x;
		FLOAT2 pos = _p0;
		std::vector<FLOAT2> result;
		while (pos.x != _p1.x)
		{
			if (e >= 0)
			{
				pos.y += forward.y;
				e -= 2 * delta.x;
			}
			else
			{
				pos.x += forward.x;
				e += 2 * delta.y;
			}
			result.push_back(pos);
		}

		return result;
	}
예제 #6
0
	// f(x,y) = (x-xc)^2 + (y-yc)^2 - r^2
	//----------------------------------------------------------------------------------------------------
	std::vector<FLOAT2> EEPNArc(const FLOAT2& _pos, float _r, float _start, float _end)
	{
		float f = 0.f;
		FLOAT2 pos = FLOAT2(0.f, _r);
		std::vector<FLOAT2> result;

		// 45бу
		result.push_back(pos);
		while (pos.x <= pos.y)
		{
			if (f <= 0.f)
			{
				++pos.x;
				result.push_back(pos);
				f += 2 * pos.x - 1;
			}
			else
			{
				--pos.y;
				result.push_back(pos);
				f += -2 * pos.y - 1;
			}
		}
		// 90бу
		unsigned int size = result.size();
		for (unsigned int i = 0; i < size; ++i)
		{
			result.push_back(FLOAT2(result[i].y, result[i].x));
		}
		// 180бу
		size = result.size();
		for (unsigned int i = 0; i < size; ++i)
		{
			result.push_back(FLOAT2(-result[i].x, result[i].y));
		}
		// 360бу
		size = result.size();
		for (unsigned int i = 0; i < size; ++i)
		{
			result.push_back(FLOAT2(result[i].x, -result[i].y));
		}
		// shift
		for (FLOAT2& pos : result)
			pos += _pos;

		return result;
	}
예제 #7
0
	//----------------------------------------------------------------------------------------------------
	void EEPoints2D::AddPoints(std::vector<INT2>& _points)
	{
		for (INT2& point : _points)
		{
			m_points.push_back(FLOAT2((float)point.x, (float)point.y));
		}
		m_isPointsDirty = true;
	}
예제 #8
0
	//----------------------------------------------------------------------------------------------------
	bool EEQuad2D::Update()
	{
		if (!EEObject::Update())
			return false;

		UpdateObjectState();

		if (m_isPositionDirty)
		{
			m_isPositionDirty = false;
		}

		if (m_isScaleDirty || m_isLocalZOrderDirty || m_isTexRectDirty)
		{
			Rect_Float rect(
				-m_quadWidth / 2,
				-m_quadHeight / 2,
				m_quadWidth / 2,
				m_quadHeight / 2
				);

			EEQuad2DVertex quadVertices[4];
			quadVertices[0].pos = FLOAT3(rect.x, rect.y, m_localZOrder * 0.0001f);
			quadVertices[0].tex = FLOAT2(m_texRect.x, m_texRect.y);
			quadVertices[1].pos = FLOAT3(rect.z, rect.y, m_localZOrder * 0.0001f);
			quadVertices[1].tex = FLOAT2(m_texRect.z, m_texRect.y);
			quadVertices[2].pos = FLOAT3(rect.x, rect.w, m_localZOrder * 0.0001f);
			quadVertices[2].tex = FLOAT2(m_texRect.x, m_texRect.w);
			quadVertices[3].pos = FLOAT3(rect.z, rect.w, m_localZOrder * 0.0001f);
			quadVertices[3].tex = FLOAT2(m_texRect.z, m_texRect.w);

			ID3D11DeviceContext *deviceContext = EECore::s_EECore->GetDeviceContext();
			D3D11_MAPPED_SUBRESOURCE mappedResource;
			ZeroMemory(&mappedResource, sizeof(D3D11_MAPPED_SUBRESOURCE));
			deviceContext->Map(m_quadVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
			memcpy(mappedResource.pData, quadVertices, sizeof(quadVertices));
			deviceContext->Unmap(m_quadVB, 0);

			m_isScaleDirty = false;
			m_isLocalZOrderDirty = false;
			m_isTexRectDirty = false;
		}

		return true;
	}
예제 #9
0
	//----------------------------------------------------------------------------------------------------
	EEProgressbar::EEProgressbar(const Rect_Float& _progressRect, const Rect_Float& _frameRect, const EETexture& _progressTex, const EETexture& _frameTex, std::function<void(float)> _funcPtr)
		:
		EEQuad2D(_progressRect, _progressTex),
		m_progressFrame(_frameRect - FLOAT2(GetWidht() / 2, GetHeight() / 2), _frameTex),
		m_progress(0.0f),
		m_isProgressDirty(false),
		m_callbackFunc(_funcPtr)
	{
		m_progressFrame.SetParent(this);
		SetIsFocusable(true);
	}
예제 #10
0
	//----------------------------------------------------------------------------------------------------
	std::vector<FLOAT2> EEBresenhamArc(const FLOAT2& _pos, float _r, float _start, float _end)
	{
		float d = 3 - 2 * _r;
		FLOAT2 pos = FLOAT2(0.f, _r);
		std::vector<FLOAT2> result;

		// 45бу
		result.push_back(pos);
		while (pos.x++ <= pos.y)
		{
			if (d < 0)
			{
				result.push_back(pos);
				d += 4 * pos.x + 2;
			}
			else
			{
				--pos.y;
				result.push_back(pos);
				d += 4 * pos.x - 4 * pos.y + 2;
			}
		}
		// 90бу
		unsigned int size = result.size();
		for (unsigned int i = 0; i < size; ++i)
			result.push_back(FLOAT2(result[i].y, result[i].x));
		// 180бу
		size = result.size();
		for (unsigned int i = 0; i < size; ++i)
			result.push_back(FLOAT2(-result[i].x, result[i].y));
		// 360бу
		size = result.size();
		for (unsigned int i = 0; i < size; ++i)
			result.push_back(FLOAT2(result[i].x, -result[i].y));
		// shift
		for (FLOAT2& pos : result)
			pos += _pos;

		return result;
	}
예제 #11
0
	// x = a * cost, y = b * sint
	//----------------------------------------------------------------------------------------------------
	std::vector<FLOAT2> EEEllipse(const FLOAT2& _pos, float _a, float _b, float _start, float _end)
	{
		float delta = EE_PI / 360.f;
		std::vector<FLOAT2> result;

		while (_start <= _end)
		{
			result.push_back(_pos + FLOAT2(_a * cos(_start), _b * sin(_start)));
			_start += delta;
		}

		return result;
	}
예제 #12
0
void LobbyMenu::selectHero(int _playerIndex, Hero::HERO_TYPE _type, bool changeText)
{
	FLOAT2 pos;
	int buttonIndex;

	switch(_playerIndex)
	{
	case 0:
		buttonIndex = 8;
		pos = m_Buttons[8]->getPos()+FLOAT2(0.0f, -0.08f);
		break;
	case 1:
		buttonIndex = 9;
		pos = m_Buttons[9]->getPos()+FLOAT2(0.0f, -0.08f);
		break;
	case 2:
		buttonIndex = 10;
		pos = m_Buttons[10]->getPos()+FLOAT2(0.0f, -0.08f);
		break;
	case 3:
		buttonIndex = 11;
		pos = m_Buttons[11]->getPos()+FLOAT2(0.0f, -0.08f);
		break;
	}

	switch(m_currentSelections[_playerIndex])
	{
	case Hero::OFFICER:
		m_officerPortrait->setVisible(false);
		break;
	case Hero::RED_KNIGHT:
		m_redKnightPortrait->setVisible(false);
		break;
	case Hero::ENGINEER:
		m_engineerPortrait->setVisible(false);
		break;
	case Hero::DOCTOR:
		m_doctorPortrait->setVisible(false);
		break;
	case Hero::THE_MENTALIST:
		m_mentalistPortrait->setVisible(false);
		break;
	}
	
	switch(_type)
	{
	case Hero::OFFICER:
		this->m_officerPortrait->setPosition(pos);
		this->m_officerPortrait->setVisible(true);
		if(changeText == true)
		{
			this->m_Label[2]->setText("Officer");
			this->m_Label[0]->setText("2__3__5__1__3");
			this->m_Label[1]->setText("A captain of the Royal Airship Brigade, the officer is now commissioned to take charge_against the siege that has befallen Chevington. His leadership skills are a true_assets to the brave men and women stationed in the towers and siege weapons and his_skill with blade and rifle makes him a true plague upon anyone standing in his way.");
			this->m_Buttons[6]->setTexture("menu_textures\\O0.png");
			this->m_Buttons[7]->setTexture("menu_textures\\O1.png");
			delete this->m_Buttons[12];
			delete this->m_Buttons[13];
			this->m_Buttons[12] = new Button();
			this->m_Buttons[12]->Init(FLOAT2(-0.85f, -0.5f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::TARGET_ACQUIRED_PERMISSION_TO_FIRE),"",0,0,1,12,100,0,INT2(422,80), false, Skill::TARGET_ACQUIRED_PERMISSION_TO_FIRE,"menu_textures\\Skill_25.png");
			this->m_Label[7]->setText("In melee, you need to get close to your enemy,_but are guaranteed to land every strike with_greater precision, effectively dealing more_damage.");
			this->m_Buttons[13] = new Button();
			this->m_Buttons[13]->Init(FLOAT2(-0.85f, -0.7f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::READY_AIM_FIRE),"",0,0,1,12,100,0,INT2(422,80), false, Skill::READY_AIM_FIRE,"menu_textures\\Skill_26.png");
			this->m_Label[5]->setText("Bombardment____Ready aim fire");
			if (m_Combat == 1)
			{
				this->m_Label[3]->setText("Range combat_");
				this->m_Label[7]->setText("With ranged combat, you can rain damage_on your enemies from afar, but with distance_comes less accuracy and damage.");
			}
		}
		break;
	case Hero::RED_KNIGHT:
		this->m_redKnightPortrait->setPosition(pos);
		this->m_redKnightPortrait->setVisible(true);
		if(changeText == true)
		{
			this->m_Label[2]->setText("Red Knight");
			this->m_Label[0]->setText("1__5__2__1__4");
			this->m_Label[1]->setText("In a city where steam and cogs are the pinnacle of modern civilization, the ancient_order of Sword and Shield wielding knights seem a bit superfluous, but they are fierce_warriors and good men. Whenever Dark Powers show their ugly face, the Red Knights_descend upon them without mercy. This particular Knight is a paragon of his order_and instills courage in his comrades as he strikes down enemy after enemy.");
			this->m_Buttons[6]->setTexture("menu_textures\\R0.png");
			this->m_Buttons[7]->setTexture("menu_textures\\R1.png");
			this->m_Label[7]->setText("In melee, you need to get close to your enemy,_but are guaranteed to land every strike with_greater precision, effectively dealing more_damage.");
			delete this->m_Buttons[12];
			delete this->m_Buttons[13];
			this->m_Buttons[12] = new Button();
			this->m_Buttons[12]->Init(FLOAT2(-0.85f, -0.5f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::SWIFT_AS_A_CAT_POWERFUL_AS_A_BEAR),"",0,0,1,12,100,0,INT2(422,80), false, Skill::SWIFT_AS_A_CAT_POWERFUL_AS_A_BEAR,"menu_textures\\Skill_23.png");

			this->m_Buttons[13] = new Button();
			this->m_Buttons[13]->Init(FLOAT2(-0.85f, -0.7f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::COURAGE_HONOR_VALOR),"",0,0,1,12,100,0,INT2(422,80), false, Skill::COURAGE_HONOR_VALOR,"menu_textures\\Skill_24.png");
			this->m_Label[5]->setText("Mighty blow____Courage,Honor,Valor");
			if (m_Combat == 1)
			{
				this->m_Label[3]->setText("Two-handed combat_");
				this->m_Label[7]->setText("Armed with a two-handed weapon you are_able to strike multiple enemies with a blow._The heavy weight of the weapon does however_restrict your speed, making your strikes slower.");
			
			}
		}
		break;
	case Hero::ENGINEER:
		this->m_engineerPortrait->setPosition(pos);
		this->m_engineerPortrait->setVisible(true);
		if(changeText == true)
		{
			this->m_Label[2]->setText("Engineer");
			this->m_Label[0]->setText("2__3__3__5__1");
			this->m_Label[1]->setText("In the modern society of Chevington, the Engineer is a key figure on the forefront of_research and development.In a city where most things run on either steampower_, gunpowder or some innovative cog contraption,the society of engineer command much_power and a lot of wealth. This particular engineer is exceptionally intuitive and_probably understands machinery better than he understands people. Who better to_oversee the defense of a city highly reliant on such machines?");
			this->m_Buttons[6]->setTexture("menu_textures\\E0.png");
			this->m_Buttons[7]->setTexture("menu_textures\\E1.png");
			delete this->m_Buttons[12];
			delete this->m_Buttons[13];
			this->m_Buttons[12] = new Button();
			this->m_Buttons[12]->Init(FLOAT2(-0.85f, -0.5f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::TIME_IS_MONEY),"",0,0,1,12,100,0,INT2(422,80), false, Skill::TIME_IS_MONEY,"menu_textures\\Skill_27.png");
			this->m_Label[7]->setText("In melee, you need to get close to your enemy,_but are guaranteed to land every strike with_greater precision, effectively dealing more_damage.");
			this->m_Buttons[13] = new Button();
			this->m_Buttons[13]->Init(FLOAT2(-0.85f, -0.7f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::ENHANCED_DEVELOPMENT),"",0,0,1,12,100,0,INT2(422,80), false, Skill::ENHANCED_DEVELOPMENT,"menu_textures\\Skill_28.png");
						this->m_Label[5]->setText("Time is money____Enhanced development");
			if (m_Combat == 1)
			{
				this->m_Label[3]->setText("Range combat");
				this->m_Label[7]->setText("With ranged combat, you can rain damage_on your enemies from afar, but with distance_comes less accuracy and damage.");
			}
		}
		break;
	case Hero::DOCTOR:
		this->m_doctorPortrait->setPosition(pos);
		this->m_doctorPortrait->setVisible(true);
		if(changeText == true)
		{
			this->m_Label[2]->setText("Doctor");
			this->m_Label[0]->setText("1__1__3__5__3");
			this->m_Label[1]->setText("A master of surgery, medicine and the art of healing, the Doctor is not only wanted,_but needed on the field of battle. Not only skilled in healing his allies and bringing_their spirits back, but also gifted with the ability to poison his enemies, making them_weaker and easier to kill, he is a force to be reckoned with and not a man you would_want to cross.");
			this->m_Buttons[6]->setTexture("menu_textures\\D0.png");
			this->m_Buttons[7]->setTexture("menu_textures\\D1.png");
			delete this->m_Buttons[12];
			delete this->m_Buttons[13];
			this->m_Buttons[12] = new Button();
			this->m_Buttons[12]->Init(FLOAT2(-0.85f, -0.5f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::SIMONS_EVIL),"",0,0,1,12,100,0,INT2(422,80), false, Skill::SIMONS_EVIL,"menu_textures\\Skill_15.png");
			this->m_Label[7]->setText("In melee, you need to get close to your enemy,_but are guaranteed to land every strike with_greater precision, effectively dealing more_damage.");
			this->m_Buttons[13] = new Button();
			this->m_Buttons[13]->Init(FLOAT2(-0.85f, -0.7f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::LIFE_REGEN),"",0,0,1,12,100,0,INT2(422,80), false, Skill::LIFE_REGEN,"menu_textures\\Skill_29.png");
			this->m_Label[5]->setText("Holy aura____Life regen");
			if (m_Combat == 1)
			{
				this->m_Label[3]->setText("Range combat_");
				this->m_Label[7]->setText("With ranged combat, you can rain damage_on your enemies from afar, but with distance_comes less accuracy and damage.");
			}
		}
		break;
	case Hero::THE_MENTALIST:
		this->m_mentalistPortrait->setPosition(pos);
		this->m_mentalistPortrait->setVisible(true);
		if(changeText == true)
		{
			this->m_Label[2]->setText("Mentalist");
			this->m_Label[0]->setText("1__1__4__5__2");
			this->m_Label[1]->setText("The Mentalist is an enigmatic, charming character with the stunning ability to know_more about you than you do yourself. Some say he is a charlatan, other think it is_real magic. Whichever is true,it is clear that The Mentalist can do incredible things_to your mind, often without you even noticing.Be glad he is on your side.");
			this->m_Buttons[6]->setTexture("menu_textures\\M0.png");
			this->m_Buttons[7]->setTexture("menu_textures\\M1.png");
			delete this->m_Buttons[12];
			delete this->m_Buttons[13];
			this->m_Buttons[12] = new Button();
			this->m_Buttons[12]->Init(FLOAT2(-0.85f, -0.5f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::HYPNOTIC_STARE),"",0,0,1,12,100,0,INT2(422,80), false, Skill::HYPNOTIC_STARE,"menu_textures\\Skill_21.png");
			this->m_Label[7]->setText("In melee, you need to get close to your enemy,_but are guaranteed to land every strike with_greater precision, effectively dealing more_damage.");
			this->m_Buttons[13] = new Button();
			this->m_Buttons[13]->Init(FLOAT2(-0.85f, -0.7f),FLOAT2(0.079166667f,0.140740741f),m_skillHolder.getSkill(Skill::ENIGMATIC_PRESENCE),"",0,0,1,12,100,0,INT2(422,80), false, Skill::ENIGMATIC_PRESENCE,"menu_textures\\Skill_22.png");
			this->m_Label[5]->setText("Hypnotic stare____Enigmatic presence");
			if (m_Combat == 1)
			{
				this->m_Label[3]->setText("Range combat_");
				this->m_Label[7]->setText("With ranged combat, you can rain damage_on your enemies from afar, but with distance_comes less accuracy and damage.");
			}
		}
		break;
	}

	if(changeText)
	{
		m_mentalistPortrait2->setVisible(false);
		m_doctorPortrait2->setVisible(false);
		m_engineerPortrait2->setVisible(false);
		m_redKnightPortrait2->setVisible(false);
		m_officerPortrait2->setVisible(false);
	
		switch(_type)
		{
		case Hero::OFFICER:
			this->m_officerPortrait2->setVisible(true);
			break;
		case Hero::RED_KNIGHT:
			this->m_redKnightPortrait2->setVisible(true);
			break;
		case Hero::ENGINEER:
			this->m_engineerPortrait2->setVisible(true);
			break;
		case Hero::DOCTOR:
			this->m_doctorPortrait2->setVisible(true);
			break;
		case Hero::THE_MENTALIST:
			this->m_mentalistPortrait2->setVisible(true);
			break;
		}
	}
	
	m_currentSelections[_playerIndex] = _type;
}
예제 #13
0
LobbyMenu::LobbyMenu(bool _host)
{
	m_host = _host;
	enterPressed=false;
	m_Counter = 0;
	m_Character0 = false;
	m_Character1 = false;
	m_Character2 = false;
	m_Character3 = false;
	m_Character4 = false;
	m_String = "";
	m_Combat = 2;
	int graphics = g_configFile->getScreenSize().y;
	m_graphicstext = "1080";
	if (graphics == 1080)
	{
		m_graphicstext = "1080";
	}
	if (graphics == 900)
	{
		m_graphicstext = "900";
	}
	if (graphics == 720)
	{
		m_graphicstext = "720";
	}
	//this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\MENU-CharacterMenu-Background2.png", FLOAT2(0,0),  FLOAT2(2,2),0));
	this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\"+m_graphicstext+"\\MENU-CharacterMenu-Middleground.png", FLOAT2(0,0), FLOAT2(2,2),1));
	//this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\MENU-LobbyMenu-Foreground.dds", FLOAT2(0,0), FLOAT2(2,2),4));
	FLOAT2 m_size, m_side; 
	m_size.x = 0;
	m_size.y = 0;
	m_side.x = 0;
	m_side.y = 0;
	m_size.x = 1920;
	m_size.y = 1080;
	m_side.x = (122.0f/m_size.x)*2.0f;
	m_side.y = (1920.0f/m_size.y)*2.0f;
	//this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\Frame_Left.png", FLOAT2(-0.94f,0),  FLOAT2(m_side.x,m_side.y),3));
	//this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\Frame_Right.png", FLOAT2(0.94f,0),  FLOAT2(m_side.x,-m_side.y),3));
	m_side.x = (1920.0f/m_size.x)*2.0f;
	m_side.y = (122.0f/m_size.y)*2.0f;
	//this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\Frame_UP.png", FLOAT2(0,0.89f),  FLOAT2(m_side.x,m_side.y),4));
	//this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\Frame_Bottom.png", FLOAT2(0,-0.89f),  FLOAT2(-m_side.x,m_side.y),4));

	this->m_Buttons.resize(14);
	this->m_Buttons[0] = new Button();
	this->m_Buttons[0]->Init(FLOAT2(-0.140625f,  -0.89f),FLOAT2(0.272916667f,0.142592593f),"menu_textures\\Button-LobbyMenu-Chat.png","",0,0,2,5);
	this->m_Buttons[1] = new Button();
	this->m_Buttons[1]->Init(FLOAT2(-0.28125f*1.5f,  -0.875f),FLOAT2(0.272916667f,0.142592593f),"menu_textures\\Button-LobbyMenu-Store.png","",0,0,2,5);
	this->m_Buttons[2] = new Button();
	this->m_Buttons[2]->Init(FLOAT2(0.140625f,  -0.9f),FLOAT2(0.272916667f,0.142592593f),"menu_textures\\Button-LobbyMenu-MainMenu.png","",0,0,2,5);
	this->m_Buttons[3] = new Button();
	this->m_Buttons[3]->Init(FLOAT2(0.140625f,  -0.875f),FLOAT2(0.272916667f,0.142592593f),"menu_textures\\Button-LobbyMenu-CharacterInformation.png","",0,0,2,5);
	this->m_Buttons[4] = new Button();
	this->m_Buttons[4]->Init(FLOAT2(0.28125f*1.5f,  -0.875f),FLOAT2(0.272916667f,0.142592593f),"menu_textures\\Button-LobbyMenu-LevelInformation.png","",0,0,2,5);
	this->m_Buttons[5] = new Button();
	if(m_host)
		this->m_Buttons[5]->Init(FLOAT2(-0.140625f,  -0.9f),FLOAT2(0.272916667f,0.142592593f),"menu_textures\\Button-CharacterMenu-StartGame.png","",0,0,2,5);
	else
		this->m_Buttons[5]->Init(FLOAT2(-0.140625f,  -0.9f),FLOAT2(0.272916667f,0.142592593f),"menu_textures\\Button-LobbyMenu-Ready.png","",0,0,2,5);
	
	this->m_Buttons[0]->setVisible(false);
	this->m_Buttons[1]->setVisible(false);
	this->m_Buttons[3]->setVisible(false);
	this->m_Buttons[4]->setVisible(false);

	this->m_Buttons[6] = new Button();
	this->m_Buttons[6]->Init(FLOAT2(-0.85f, -0.2f),FLOAT2(0.15625f*0.6f,0.277777778f*0.6f),"","",0,0,2,10,100,0,INT2(0,0),false,0,"");
	this->m_Buttons[7] = new Button();
	this->m_Buttons[7]->Init(FLOAT2(-0.70f, -0.2f),FLOAT2(0.15625f*0.6f,0.277777778f*0.6f),"","",0,0,2,10,100,0,INT2(0,0),false,0,"");

	// Player stuff
	/*this->m_Buttons[8] = new Button();
	this->m_Buttons[8]->Init(FLOAT2(-0.30f,-0.27f),FLOAT2(0.272916667f*0.5f,0.142592593f*0.5f),"menu_textures\\Button-LobbyMenu-Player1.dds","",0,0,1);
	this->m_Buttons[9] = new Button();
	this->m_Buttons[9]->Init(FLOAT2(-0.10f,-0.27f),FLOAT2(0.272916667f*0.5f,0.142592593f*0.5f),"menu_textures\\Button-LobbyMenu-Player2.dds","",0,0,1);
	this->m_Buttons[10] = new Button();
	this->m_Buttons[10]->Init(FLOAT2(0.10f,-0.27f),FLOAT2(0.272916667f*0.5f,0.142592593f*0.5f),"menu_textures\\Button-LobbyMenu-Player3.dds","",0,0,1);
	this->m_Buttons[11] = new Button();
	this->m_Buttons[11]->Init(FLOAT2(0.30f,-0.27f),FLOAT2(0.272916667f*0.5f,0.142592593f*0.5f),"menu_textures\\Button-LobbyMenu-Player4.dds","",0,0,1);*/
	this->m_Buttons[8] = new Button();
	this->m_Buttons[8]->Init(FLOAT2(0.675f, 0.12f),FLOAT2(0.272916667f*0.3f,0.142592593f*0.3f),"menu_textures\\Button-LobbyMenu-Player4.png","",0,0,1);
	this->m_Buttons[8]->setKeep(1);
	this->m_Buttons[8]->setVisible(false);
	this->m_Buttons[9] = new Button();
	this->m_Buttons[9]->Init(FLOAT2(0.8f, 0.12f),FLOAT2(0.272916667f*0.3f,0.142592593f*0.3f),"menu_textures\\Button-LobbyMenu-Player4.png","",0,0,1);
	this->m_Buttons[9]->setKeep(1);
	this->m_Buttons[9]->setVisible(false);
	this->m_Buttons[10] = new Button();
	this->m_Buttons[10]->Init(FLOAT2(0.675f, -0.08f),FLOAT2(0.272916667f*0.3f,0.142592593f*0.3f),"menu_textures\\Button-LobbyMenu-Player4.png","",0,0,1);
	this->m_Buttons[10]->setKeep(1);
	this->m_Buttons[10]->setVisible(false);
	this->m_Buttons[11] = new Button();
	this->m_Buttons[11]->Init(FLOAT2(0.8f, -0.08f),FLOAT2(0.272916667f*0.3f,0.142592593f*0.3f),"menu_textures\\Button-LobbyMenu-Player4.png","",0,0,1);
	this->m_Buttons[11]->setKeep(1);
	this->m_Buttons[11]->setVisible(false);
	this->setReady(0);

	m_doctorPortrait2 = g_graphicsEngine->createSprite("menu_textures/Character-4.png", FLOAT2(-0.68f, 0.7f), FLOAT2(0.083333333f*1.5f,0.148148148f*1.5f), 18);
	m_officerPortrait2 = g_graphicsEngine->createSprite("menu_textures/Character-1.png", FLOAT2(-0.68f, 0.7f), FLOAT2(0.083333333f*1.5f,0.148148148f*1.5f), 18);
	m_engineerPortrait2 = g_graphicsEngine->createSprite("menu_textures/Character-3.png", FLOAT2(-0.68f, 0.7f), FLOAT2(0.083333333f*1.5f,0.148148148f*1.5f), 18);
	m_redKnightPortrait2 = g_graphicsEngine->createSprite("menu_textures/Character-2.png", FLOAT2(-0.68f,0.7f), FLOAT2(0.083333333f*1.5f,0.148148148f*1.5f), 18);
	m_mentalistPortrait2 = g_graphicsEngine->createSprite("menu_textures/Character-0.png", FLOAT2(-0.68f, 0.7f), FLOAT2(0.083333333f*1.5f,0.148148148f*1.5f), 18);

	this->miniMap1 = g_graphicsEngine->createSprite("maps/levelone/leveloneminimap.png", FLOAT2(0.822916667f, 0.60962963f), FLOAT2(0.266666667*0.7f,0.474074074*0.7f), 18);
	this->miniMap2 = g_graphicsEngine->createSprite("maps/leveltwo/leveltwominimap.png", FLOAT2(0.822916667f, 0.60962963f), FLOAT2(0.266666667*0.7f,0.474074074*0.7f), 18);
	this->miniMap1->setVisible(false);
	this->miniMap2->setVisible(false);



	this->m_Buttons[12] = new Button();
	this->m_Buttons[12]->Init(FLOAT2(-0.85f, -0.5f),FLOAT2(0.079166667f,0.140740741f),"menu_textures\\Button-Skill-30.png","",0,0,1,12,100,0,INT2(422,80), false);

	this->m_Buttons[13] = new Button();
	this->m_Buttons[13]->Init(FLOAT2(-0.85f, -0.7f),FLOAT2(0.079166667f,0.140740741f),"menu_textures\\Button-Skill-30.png","",0,0,1,12,100,0,INT2(422,80), false);

	m_doctorPortrait = g_graphicsEngine->createSprite("menu_textures/Character-4.png", FLOAT2(0.0f, 0.0f), FLOAT2(0.083333333f*0.9f,0.148148148f*0.9f), 18);
	m_officerPortrait = g_graphicsEngine->createSprite("menu_textures/Character-1.png", FLOAT2(0.0f, 0.0f), FLOAT2(0.083333333f*0.9f,0.148148148f*0.9f), 18);
	m_engineerPortrait = g_graphicsEngine->createSprite("menu_textures/Character-3.png", FLOAT2(0.0f, 0.0f), FLOAT2(0.083333333f*0.9f,0.148148148f*0.9f), 18);
	m_redKnightPortrait = g_graphicsEngine->createSprite("menu_textures/Character-2.png", FLOAT2(0.0f, 0.0f), FLOAT2(0.083333333f*0.9f,0.148148148f*0.9f), 18);
	m_mentalistPortrait = g_graphicsEngine->createSprite("menu_textures/Character-0.png", FLOAT2(0.0f, 0.0f), FLOAT2(0.083333333f*0.9f,0.148148148f*0.9f), 18);

	m_doctorPortrait->setVisible(false);
	m_officerPortrait->setVisible(false);
	m_engineerPortrait->setVisible(false);
	m_redKnightPortrait->setVisible(false);
	m_mentalistPortrait->setVisible(false);

	m_doctorPortrait2->setVisible(false);
	m_officerPortrait2->setVisible(false);
	m_engineerPortrait2->setVisible(false);
	m_redKnightPortrait2->setVisible(false);
	m_mentalistPortrait2->setVisible(false);

	m_currentSelections[0] = Hero::HERO_TYPE::NONE;
	m_currentSelections[1] = Hero::HERO_TYPE::NONE;
	m_currentSelections[2] = Hero::HERO_TYPE::NONE;
	m_currentSelections[3] = Hero::HERO_TYPE::NONE;
	
	/*this->m_Buttons[12] = new Button();
	this->m_Buttons[12]->Init(FLOAT2(-0.445f,  0.73f),FLOAT2(0.178125f*0.5f,0.194444444f*0.5f),"menu_textures\\CharacterMenu-Button-Officer.png","",0,0,1);
	this->m_Buttons[13] = new Button();
	this->m_Buttons[13]->Init(FLOAT2(-0.22f, 0.73f),FLOAT2(0.178125f*0.5f,0.194444444f*0.5f),"menu_textures\\CharacterMenu-Button-RedKnight.png","",0,0,1);
	this->m_Buttons[14] = new Button();
	this->m_Buttons[14]->Init(FLOAT2(0.0f,  0.73f),FLOAT2(0.178125f*0.5f,0.194444444f*0.5f),"menu_textures\\CharacterMenu-Button-Engineer.png","",0,0,1);
	this->m_Buttons[15] = new Button();
	this->m_Buttons[15]->Init(FLOAT2(0.22f,  0.73f),FLOAT2(0.178125f*0.5f,0.194444444f*0.5f),"menu_textures\\CharacterMenu-Button-Doctor.png","",0,0,1);
	this->m_Buttons[16] = new Button();
	this->m_Buttons[16]->Init(FLOAT2(0.445f,  0.73f),FLOAT2(0.178125f*0.5f,0.194444444f*0.5f),"menu_textures\\CharacterMenu-Button-Mentalist.png","",0,0,1);*/

	
	//this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\Frame_Right.png", FLOAT2(0.94f,0),  FLOAT2(m_side.x,-m_side.y),3));
	
	this->m_slider.Init(FLOAT2(-0.5f, -0.275f), 0.0f, FLOAT2(0.15f,0.3f),"menu_textures\\LobbyMenuSlider.png","", 0.0f, 1.0f, 1, 15);
	int windowed = g_configFile->getWindowed();
	m_changePosY= 1.0f;
	m_fontsize = 1.0f;
	if (graphics == 1080)
	{
		m_changePosY= 1.0f;
		if (windowed == 1)
		{
			m_fontsize = 1;
		}
		else
		{
			m_fontsize =1;
		}
	}
	if (graphics == 900)
	{
		m_changePosY= 0.833333333334f;
		if (windowed == 1)
		{
			m_fontsize = 1;
		}
		else
		{
			m_fontsize =0.833333333334f;
		}
	}
	if (graphics == 720)
	{
		m_changePosY= 0.66666666666667f;
		if (windowed == 1)
		{
			m_fontsize = 1;
		}
		else
		{
			m_fontsize =0.66666666666667f;
		}
	}

	this->m_Label.resize(8);
	this->m_Label[0] = new TextLabel("","text3.png",INT2(110*m_changePosY,205),52*m_fontsize);
	this->m_Label[1] = new TextLabel("","text3.png",INT2(415*m_changePosY,855),50*m_fontsize);
	this->m_Label[2] = new TextLabel("","text3.png",INT2(60*m_changePosY,120),75*m_fontsize);
	this->m_Label[3] = new TextLabel("","text3.png",INT2(60*m_changePosY,500),75*m_fontsize);
	this->m_Label[3]->setText("Close combat_");
	this->m_Label[4] = new TextLabel("","text3.png",INT2(60*m_changePosY,160),75*m_fontsize);
	this->m_Label[5] = new TextLabel("NONE____NONE","text3.png",INT2(200*m_changePosY,890),60*m_fontsize);
	this->m_Label[6] = new TextLabel("Level 1__MAPSIZE_SMALL__WAVES_20__STARTING DIVINE POWER_1500","text3.png",INT2(1550*m_changePosY,120),60*m_fontsize);
	this->m_Label[7] = new TextLabel("","text3.png",INT2(60*m_changePosY,550),50*m_fontsize);
	this->m_LabelInput = new TextInput("text3.png",INT2(1040*m_changePosY,1040),80*m_fontsize);
	this->m_Chattext.resize(5);
	this->m_Chattext[0] = new TextLabel("","text2.png",INT2(1040*m_changePosY,980),60*m_fontsize);
	this->m_Chattext[1] = new TextLabel("","text2.png",INT2(1040*m_changePosY,950),60*m_fontsize);
	this->m_Chattext[2] = new TextLabel("","text2.png",INT2(1040*m_changePosY,920),60*m_fontsize);
	this->m_Chattext[3] = new TextLabel("","text2.png",INT2(1040*m_changePosY,890),60*m_fontsize);
	this->m_Chattext[4] = new TextLabel("","text2.png",INT2(1040*m_changePosY,860),60*m_fontsize);
	this->m_Buttons[6]->SetTextBoxValue(true);
	this->m_Buttons[7]->SetTextBoxValue(false);
}
예제 #14
0
void Cursor::setPosition(INT2 position)
{
	INT2 screenSize = g_graphicsEngine->getRealScreenSize();
	this->m_sprite->setPosition(FLOAT2(((float)position.x / (float)screenSize.x) * 2 - 1, ((float)-position.y / (float)screenSize.y) * 2 + 1));
}
예제 #15
0
Cursor::Cursor()
{
	this->m_sprite = g_graphicsEngine->createSpriteSheet("menu_textures\\MouseCursor.png", FLOAT2(0.0f, 0.0f), FLOAT2(0.075f, 0.15f), INT2(3, 4), 20);
}
예제 #16
0
파일: Hero.cpp 프로젝트: ghazp/Spelprojekt
void Hero::setNextPosition(FLOAT3 _nextPosition)
{
	if(this->m_alive == true)
	{
		if(g_pathfinder->sameGridPosition(FLOAT2(this->m_position.x, this->m_position.z), FLOAT2(_nextPosition.x, _nextPosition.z)) == false)
		{
			this->m_path = g_pathfinder->getPath(FLOAT2(this->m_position.x, this->m_position.z), FLOAT2(_nextPosition.x, _nextPosition.z));

			if(this->m_path.nrOfPoints > 1)
			{
				this->m_nextPosition = FLOAT3(this->m_path.points[1].x, 0.0f, this->m_path.points[1].y);
				//this->m_startPos= FLOAT3(this->m_path.points[0].x, 0.0f, this->m_path.points[0].y);
				this->m_goalPosition = _nextPosition;
				this->m_pathCounter = 2;
				this->m_reachedPosition = false;
				this->m_hasTarget = false;
				this->m_target = NULL;
				this->m_reallyReachedPosition = false;

				this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
				this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::MOVE, this->m_id, this->m_position));
			}
			else if(this->m_path.nrOfPoints == 1)
			{
				//this->m_startPos= this->m_nextPosition;
				this->m_nextPosition = _nextPosition;
				this->m_goalPosition = _nextPosition;
				this->m_pathCounter = 1;
				this->m_reachedPosition = false;
				this->m_hasTarget = false;
				this->m_target = NULL;
				this->m_reallyReachedPosition = false;

				this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
				this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::MOVE, this->m_id, this->m_position));
			}
			else
			{
				this->m_path = Path();
				this->m_pathCounter = 0;
				this->m_reachedPosition = true;
				this->m_hasTarget = false;
				this->m_target = NULL;
				this->m_reallyReachedPosition = true;
				this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::IDLE, this->m_id, this->m_position));
				//this->m_startPos= m_nextPosition;

				this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
			} 
		}
		else
		{
			this->m_path = Path();
			this->m_pathCounter = 0;
			this->m_reachedPosition = true;
			this->m_nextPosition = m_position;
			this->m_hasTarget = false;
			this->m_target = NULL;
			this->m_reallyReachedPosition = true;
			this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::IDLE, this->m_id, this->m_position));
			//this->m_startPos= m_nextPosition;

			this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
		}
	}
}
예제 #17
0
파일: Hero.cpp 프로젝트: ghazp/Spelprojekt
void Hero::updateSpecificUnitEntity(float dt)
{
	if(this->m_health > 0)
	{
		//Handle incoming messages
		Message *m;

		while(this->m_messageQueue->incomingQueueEmpty() == false)
		{
			m = this->m_messageQueue->pullIncomingMessage();

			if(m->type == Message::Collision)
			{
				//this->m_position = FLOAT3(0.0f, 0.0f, 0.0f);
			}

			delete m;
		}

		if(this->m_attackCooldown > 0.0f)
		{
			this->m_attackCooldown = this->m_attackCooldown - dt;
		}
		if(this->m_hasTarget == true)
		{
			ServerEntity *se = EntityHandler::getServerEntity(this->m_target);

			if(se == NULL)
			{
				this->m_hasTarget = false;
				this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::IDLE, this->m_id, this->m_position));
			}
			else
			{
				FLOAT3 distance = se->getPosition() - this->m_position;
				this->m_rotation.x = atan2(-distance.x, -distance.z);

				//If the hero is in range, KILL IT!
				if(se != NULL)
				{
					if((se->getPosition() - this->m_position).length() <= this->m_regularAttack->getRange())
					{
						if(this->m_attackCooldown <= 0.0f)
						{
							//this->m_messageQueue->pushOutgoingMessage(new CreateActionTargetMessage(Skill::ATTACK, this->m_id, se->getId(), this->m_position));
							//EntityHandler::addEntity(new Arrow((m_position-se->getPosition()).length(), se->getId(), m_id));
							//this->dealDamage(se, this->m_physicalDamage, this->m_mentalDamage); // dont
							this->attack(this->m_target);
							this->m_attackCooldown = this->m_attackSpeed;
							this->m_nextPosition = this->m_position;
							this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
						}

						if(this->m_reachedPosition == false)
						{
							this->m_reachedPosition = true;
							this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::IDLE, this->m_id, this->m_position));
						}
					}
					else //Otherwise you should find a way to get to the enemy
					{
						if(this->m_reachedPosition == true)
						{
							this->m_path = g_pathfinder->getPath(FLOAT2(this->m_position.x, this->m_position.z), FLOAT2(se->getPosition().x, se->getPosition().z));

							if(this->m_path.nrOfPoints > 0)
							{
								this->m_pathCounter = 1;
								this->m_nextPosition = FLOAT3(this->m_path.points[0].x, 0.0f, this->m_path.points[0].y);
								this->m_reachedPosition = false;
								this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::MOVE, this->m_id, this->m_position));
								this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
							}
						}
						else //Move along the path
						{
							distance = this->m_nextPosition - this->m_position;

							if(distance.length() - 0.125f > this->m_movementSpeed * dt)
							{
								distance = distance / distance.length();
								this->m_position = this->m_position + (distance * this->m_movementSpeed * dt);
								this->m_rotation.x = atan2(-distance.x, -distance.z);
							}
							else
							{
								if(this->m_pathCounter < this->m_path.nrOfPoints)
								{
									this->m_nextPosition = FLOAT3(this->m_path.points[this->m_pathCounter].x, 0.0f, this->m_path.points[this->m_pathCounter].y);
									this->m_pathCounter++;
									this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
								}
								else if(this->m_reachedPosition == false)
								{
									this->m_position = this->m_nextPosition;
									this->m_reachedPosition = true;
									this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::IDLE, this->m_id, this->m_position));
									this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
									this->m_messageQueue->pushOutgoingMessage(new UpdateEntityMessage(this->getId(),this->getPosition().x,this->getPosition().z,this->getRotation().x,0.0f,0.0f,0.0f,0.0f,this->getMovementSpeed()));
								}

								this->m_obb->Center = XMFLOAT3(this->m_position.x, this->m_position.y, this->m_position.z);
							}
						}
					}
				}
				else //The target doesn't exist
				{
					this->m_hasTarget = false;
					this->m_reachedPosition = true;
					this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::IDLE, this->m_id, this->m_position));
				}
			}
		}
		else if(this->m_reachedPosition == false)
		{
			FLOAT3 distance = this->m_nextPosition - this->m_position;
			float lol = 0.0f;

			if(this->m_reallyReachedPosition == false)
			{
				lol = 0.125f;
			}

			if(distance.length() - lol > this->m_movementSpeed * dt)
			{
				distance = distance / distance.length();
				this->m_position = this->m_position + (distance * this->m_movementSpeed * dt);
			}
			else
			{
				if(this->m_pathCounter < this->m_path.nrOfPoints)
				{
					this->m_nextPosition = FLOAT3(this->m_path.points[this->m_pathCounter].x, 0.0f, this->m_path.points[this->m_pathCounter].y);
					this->m_pathCounter++;

					this->m_obb->Center = XMFLOAT3(this->m_position.x, this->m_position.y, this->m_position.z);
					this->m_rotation.x = atan2(-distance.x, -distance.z);

					this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
				}
				else
				{
					this->m_nextPosition = this->m_position;
					this->m_reachedPosition = true;
					//this->m_startPos= m_nextPosition;
					this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
					this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::IDLE, this->m_id, this->m_position));
				}
			}

			this->m_obb->Center = XMFLOAT3(this->m_position.x, this->m_position.y, this->m_position.z);
			this->m_rotation.x = atan2(-distance.x, -distance.z);
		}
	}
	else if(this->m_alive == true)
	{
		this->m_messageQueue->pushOutgoingMessage(new CreateActionMessage(Skill::DEATH, this->m_id, this->m_position));
		this->m_position = FLOAT3(-1000.0f, 0.0f, -1000.0f);
		this->m_hasTarget = NULL;
		this->m_reachedPosition = true;
		this->m_messageQueue->pushOutgoingMessage(this->getUpdateEntityMessage());
		this->m_messageQueue->pushOutgoingMessage(new HeroDiedMessage(this->m_id, this->m_playerId));
		this->m_alive = false;
	}
}
예제 #18
0
	//----------------------------------------------------------------------------------------------------
	bool EEComboBox::AddItem(const std::wstring& _str, std::function<void(void)> _funcPtr)
	{
		float height = GetHeight() * (m_options.size() + 1);
		m_options.push_back(new EELineBrowser(Rect_Float(0.0f, height, GetWidth(), height + GetHeight()) - FLOAT2(GetWidth() / 2, GetHeight() / 2),
			m_color, m_font.GetColor(), _str));
		int index = m_options.size() - 1;
		m_options[index]->SetParent(this);
		m_options[index]->SetIsFocusable(true);
		m_options[index]->SetTriggeredFunc(
			[&, index, _funcPtr]()
		{
			_funcPtr();
			m_selected = index;
			m_isSelectedDirty = true;
			m_isSelecting = false;
		});

		return true;
	}
예제 #19
0
static void ReportGLLimits(ScriptInterface& scriptInterface, CScriptValRooted settings)
{
	const char* errstr = "(error)";

#define INTEGER(id) do { \
	GLint i = -1; \
	glGetIntegerv(GL_##id, &i); \
	if (ogl_SquelchError(GL_INVALID_ENUM)) \
		scriptInterface.SetProperty(settings.get(), "GL_" #id, errstr); \
	else \
		scriptInterface.SetProperty(settings.get(), "GL_" #id, i); \
	} while (false)

#define INTEGER2(id) do { \
	GLint i[2] = { -1, -1 }; \
	glGetIntegerv(GL_##id, i); \
	if (ogl_SquelchError(GL_INVALID_ENUM)) { \
		scriptInterface.SetProperty(settings.get(), "GL_" #id "[0]", errstr); \
		scriptInterface.SetProperty(settings.get(), "GL_" #id "[1]", errstr); \
	} else { \
		scriptInterface.SetProperty(settings.get(), "GL_" #id "[0]", i[0]); \
		scriptInterface.SetProperty(settings.get(), "GL_" #id "[1]", i[1]); \
	} \
	} while (false)

#define FLOAT(id) do { \
	GLfloat f = std::numeric_limits<GLfloat>::quiet_NaN(); \
	glGetFloatv(GL_##id, &f); \
	if (ogl_SquelchError(GL_INVALID_ENUM)) \
		scriptInterface.SetProperty(settings.get(), "GL_" #id, errstr); \
	else \
		scriptInterface.SetProperty(settings.get(), "GL_" #id, f); \
	} while (false)

#define FLOAT2(id) do { \
	GLfloat f[2] = { std::numeric_limits<GLfloat>::quiet_NaN(), std::numeric_limits<GLfloat>::quiet_NaN() }; \
	glGetFloatv(GL_##id, f); \
	if (ogl_SquelchError(GL_INVALID_ENUM)) { \
		scriptInterface.SetProperty(settings.get(), "GL_" #id "[0]", errstr); \
		scriptInterface.SetProperty(settings.get(), "GL_" #id "[1]", errstr); \
	} else { \
		scriptInterface.SetProperty(settings.get(), "GL_" #id "[0]", f[0]); \
		scriptInterface.SetProperty(settings.get(), "GL_" #id "[1]", f[1]); \
	} \
	} while (false)

#define STRING(id) do { \
	const char* c = (const char*)glGetString(GL_##id); \
	if (!c) c = ""; \
	if (ogl_SquelchError(GL_INVALID_ENUM)) c = errstr; \
	scriptInterface.SetProperty(settings.get(), "GL_" #id, std::string(c)); \
	}  while (false)

#define QUERY(target, pname) do { \
	GLint i = -1; \
	pglGetQueryivARB(GL_##target, GL_##pname, &i); \
	if (ogl_SquelchError(GL_INVALID_ENUM)) \
		scriptInterface.SetProperty(settings.get(), "GL_" #target ".GL_" #pname, errstr); \
	else \
		scriptInterface.SetProperty(settings.get(), "GL_" #target ".GL_" #pname, i); \
	} while (false)

#define VERTEXPROGRAM(id) do { \
	GLint i = -1; \
	pglGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_##id, &i); \
	if (ogl_SquelchError(GL_INVALID_ENUM)) \
		scriptInterface.SetProperty(settings.get(), "GL_VERTEX_PROGRAM_ARB.GL_" #id, errstr); \
	else \
		scriptInterface.SetProperty(settings.get(), "GL_VERTEX_PROGRAM_ARB.GL_" #id, i); \
	} while (false)

#define FRAGMENTPROGRAM(id) do { \
	GLint i = -1; \
	pglGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_##id, &i); \
	if (ogl_SquelchError(GL_INVALID_ENUM)) \
		scriptInterface.SetProperty(settings.get(), "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, errstr); \
	else \
		scriptInterface.SetProperty(settings.get(), "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, i); \
	} while (false)

#define BOOL(id) INTEGER(id)

	ogl_WarnIfError();

	// Core OpenGL 1.3:
	// (We don't bother checking extension strings for anything older than 1.3;
	// it'll just produce harmless warnings)
	STRING(VERSION);
	STRING(VENDOR);
	STRING(RENDERER);
	STRING(EXTENSIONS);
#if !CONFIG2_GLES
	INTEGER(MAX_LIGHTS);
	INTEGER(MAX_CLIP_PLANES);
	// Skip MAX_COLOR_MATRIX_STACK_DEPTH (only in imaging subset)
	INTEGER(MAX_MODELVIEW_STACK_DEPTH);
	INTEGER(MAX_PROJECTION_STACK_DEPTH);
	INTEGER(MAX_TEXTURE_STACK_DEPTH);
#endif
	INTEGER(SUBPIXEL_BITS);
#if !CONFIG2_GLES
	INTEGER(MAX_3D_TEXTURE_SIZE);
#endif
	INTEGER(MAX_TEXTURE_SIZE);
	INTEGER(MAX_CUBE_MAP_TEXTURE_SIZE);
#if !CONFIG2_GLES
	INTEGER(MAX_PIXEL_MAP_TABLE);
	INTEGER(MAX_NAME_STACK_DEPTH);
	INTEGER(MAX_LIST_NESTING);
	INTEGER(MAX_EVAL_ORDER);
#endif
	INTEGER2(MAX_VIEWPORT_DIMS);
#if !CONFIG2_GLES
	INTEGER(MAX_ATTRIB_STACK_DEPTH);
	INTEGER(MAX_CLIENT_ATTRIB_STACK_DEPTH);
	INTEGER(AUX_BUFFERS);
	BOOL(RGBA_MODE);
	BOOL(INDEX_MODE);
	BOOL(DOUBLEBUFFER);
	BOOL(STEREO);
#endif
	FLOAT2(ALIASED_POINT_SIZE_RANGE);
#if !CONFIG2_GLES
	FLOAT2(SMOOTH_POINT_SIZE_RANGE);
	FLOAT(SMOOTH_POINT_SIZE_GRANULARITY);
#endif
	FLOAT2(ALIASED_LINE_WIDTH_RANGE);
#if !CONFIG2_GLES
	FLOAT2(SMOOTH_LINE_WIDTH_RANGE);
	FLOAT(SMOOTH_LINE_WIDTH_GRANULARITY);
	// Skip MAX_CONVOLUTION_WIDTH, MAX_CONVOLUTION_HEIGHT (only in imaging subset)
	INTEGER(MAX_ELEMENTS_INDICES);
	INTEGER(MAX_ELEMENTS_VERTICES);
	INTEGER(MAX_TEXTURE_UNITS);
#endif
	INTEGER(SAMPLE_BUFFERS);
	INTEGER(SAMPLES);
	// TODO: compressed texture formats
	INTEGER(RED_BITS);
	INTEGER(GREEN_BITS);
	INTEGER(BLUE_BITS);
	INTEGER(ALPHA_BITS);
#if !CONFIG2_GLES
	INTEGER(INDEX_BITS);
#endif
	INTEGER(DEPTH_BITS);
	INTEGER(STENCIL_BITS);
#if !CONFIG2_GLES
	INTEGER(ACCUM_RED_BITS);
	INTEGER(ACCUM_GREEN_BITS);
	INTEGER(ACCUM_BLUE_BITS);
	INTEGER(ACCUM_ALPHA_BITS);
#endif

#if !CONFIG2_GLES

	// Core OpenGL 2.0 (treated as extensions):

	if (ogl_HaveExtension("GL_EXT_texture_lod_bias"))
	{
		FLOAT(MAX_TEXTURE_LOD_BIAS_EXT);
	}

	if (ogl_HaveExtension("GL_ARB_occlusion_query"))
	{
		QUERY(SAMPLES_PASSED, QUERY_COUNTER_BITS);
	}

	if (ogl_HaveExtension("GL_ARB_shading_language_100"))
	{
		STRING(SHADING_LANGUAGE_VERSION_ARB);
	}

	if (ogl_HaveExtension("GL_ARB_vertex_shader"))
	{
		INTEGER(MAX_VERTEX_ATTRIBS_ARB);
		INTEGER(MAX_VERTEX_UNIFORM_COMPONENTS_ARB);
		INTEGER(MAX_VARYING_FLOATS_ARB);
		INTEGER(MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB);
		INTEGER(MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB);
	}

	if (ogl_HaveExtension("GL_ARB_fragment_shader"))
	{
		INTEGER(MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB);
	}

	if (ogl_HaveExtension("GL_ARB_vertex_shader") || ogl_HaveExtension("GL_ARB_fragment_shader") ||
		ogl_HaveExtension("GL_ARB_vertex_program") || ogl_HaveExtension("GL_ARB_fragment_program"))
	{
		INTEGER(MAX_TEXTURE_IMAGE_UNITS_ARB);
		INTEGER(MAX_TEXTURE_COORDS_ARB);
	}

	if (ogl_HaveExtension("GL_ARB_draw_buffers"))
	{
		INTEGER(MAX_DRAW_BUFFERS_ARB);
	}

	// Core OpenGL 3.0:

	if (ogl_HaveExtension("GL_EXT_gpu_shader4"))
	{
		INTEGER(MIN_PROGRAM_TEXEL_OFFSET); // no _EXT version of these in glext.h
		INTEGER(MAX_PROGRAM_TEXEL_OFFSET);
	}

	if (ogl_HaveExtension("GL_EXT_framebuffer_object"))
	{
		INTEGER(MAX_COLOR_ATTACHMENTS_EXT);
		INTEGER(MAX_RENDERBUFFER_SIZE_EXT);
	}

	if (ogl_HaveExtension("GL_EXT_framebuffer_multisample"))
	{
		INTEGER(MAX_SAMPLES_EXT);
	}

	if (ogl_HaveExtension("GL_EXT_texture_array"))
	{
		INTEGER(MAX_ARRAY_TEXTURE_LAYERS_EXT);
	}

	if (ogl_HaveExtension("GL_EXT_transform_feedback"))
	{
		INTEGER(MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT);
		INTEGER(MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT);
		INTEGER(MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT);
	}


	// Other interesting extensions:

	if (ogl_HaveExtension("GL_EXT_timer_query") || ogl_HaveExtension("GL_ARB_timer_query"))
	{
		QUERY(TIME_ELAPSED, QUERY_COUNTER_BITS);
	}

	if (ogl_HaveExtension("GL_ARB_timer_query"))
	{
		QUERY(TIMESTAMP, QUERY_COUNTER_BITS);
	}

	if (ogl_HaveExtension("GL_EXT_texture_filter_anisotropic"))
	{
		FLOAT(MAX_TEXTURE_MAX_ANISOTROPY_EXT);
	}

	if (ogl_HaveExtension("GL_ARB_texture_rectangle"))
	{
		INTEGER(MAX_RECTANGLE_TEXTURE_SIZE_ARB);
	}

	if (ogl_HaveExtension("GL_ARB_vertex_program") || ogl_HaveExtension("GL_ARB_fragment_program"))
	{
		INTEGER(MAX_PROGRAM_MATRICES_ARB);
		INTEGER(MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB);
	}

	if (ogl_HaveExtension("GL_ARB_vertex_program"))
	{
		VERTEXPROGRAM(MAX_PROGRAM_ENV_PARAMETERS_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_LOCAL_PARAMETERS_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_INSTRUCTIONS_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_TEMPORARIES_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_PARAMETERS_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_ATTRIBS_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_ADDRESS_REGISTERS_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_NATIVE_TEMPORARIES_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_NATIVE_PARAMETERS_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_NATIVE_ATTRIBS_ARB);
		VERTEXPROGRAM(MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB);

		if (ogl_HaveExtension("GL_ARB_fragment_program"))
		{
			// The spec seems to say these should be supported, but
			// Mesa complains about them so let's not bother
			/*
			VERTEXPROGRAM(MAX_PROGRAM_ALU_INSTRUCTIONS_ARB);
			VERTEXPROGRAM(MAX_PROGRAM_TEX_INSTRUCTIONS_ARB);
			VERTEXPROGRAM(MAX_PROGRAM_TEX_INDIRECTIONS_ARB);
			VERTEXPROGRAM(MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB);
			VERTEXPROGRAM(MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB);
			VERTEXPROGRAM(MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB);
			*/
		}
	}

	if (ogl_HaveExtension("GL_ARB_fragment_program"))
	{
		FRAGMENTPROGRAM(MAX_PROGRAM_ENV_PARAMETERS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_LOCAL_PARAMETERS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_INSTRUCTIONS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_ALU_INSTRUCTIONS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_TEX_INSTRUCTIONS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_TEX_INDIRECTIONS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_TEMPORARIES_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_PARAMETERS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_ATTRIBS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_TEMPORARIES_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_PARAMETERS_ARB);
		FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_ATTRIBS_ARB);

		if (ogl_HaveExtension("GL_ARB_vertex_program"))
		{
			// The spec seems to say these should be supported, but
			// Intel drivers on Windows complain about them so let's not bother
			/*
			FRAGMENTPROGRAM(MAX_PROGRAM_ADDRESS_REGISTERS_ARB);
			FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB);
			*/
		}
	}

	if (ogl_HaveExtension("GL_ARB_geometry_shader4"))
	{
		INTEGER(MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB);
		INTEGER(MAX_GEOMETRY_OUTPUT_VERTICES_ARB);
		INTEGER(MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB);
		INTEGER(MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB);
		INTEGER(MAX_GEOMETRY_VARYING_COMPONENTS_ARB);
		INTEGER(MAX_VERTEX_VARYING_COMPONENTS_ARB);
	}

#else // CONFIG2_GLES

	// Core OpenGL ES 2.0:

	STRING(SHADING_LANGUAGE_VERSION);
	INTEGER(MAX_VERTEX_ATTRIBS);
	INTEGER(MAX_VERTEX_UNIFORM_VECTORS);
	INTEGER(MAX_VARYING_VECTORS);
	INTEGER(MAX_COMBINED_TEXTURE_IMAGE_UNITS);
	INTEGER(MAX_VERTEX_TEXTURE_IMAGE_UNITS);
	INTEGER(MAX_FRAGMENT_UNIFORM_VECTORS);
	INTEGER(MAX_TEXTURE_IMAGE_UNITS);
	INTEGER(MAX_RENDERBUFFER_SIZE);

#endif // CONFIG2_GLES
}
예제 #20
0
	//----------------------------------------------------------------------------------------------------
	bool EEFloatBoard::Update()
	{
		if (!EEQuad2D::Update())
			return false;

		if (m_isRangeDirty)
		{
			m_num.clear();
			m_num.resize(m_intRange + m_decimalRange + 1);

			int width = (int)(m_quadWidth / m_num.size()); //the size should not be zero
			for (unsigned int i = 0; i < m_num.size(); ++i)
			{
				m_num[i].SetParent(this);
				m_num[i].SetLocalZOrder(m_localZOrder); //It is wrong~~
				m_num[i].SetRect(Rect_Float((float)(m_num.size() - i - 1) * width, 0.0f, (float)(m_num.size() - i) * width, (float)m_quadHeight) - FLOAT2(GetWidht() / 2, GetHeight() / 2));
				m_num[i].SetIsUseColor(false);
				m_num[i].SetIsUseTex(true);
			}

			m_isRangeDirty = false;
		}

		if (m_isValueDirty)
		{
			float value = m_value >= 0 ? m_value : -m_value;
			int intValue = (int)value;
			for (int i = 0; i < m_intRange; ++i)
			{
				m_num[i].SetTexture(m_numTexs[intValue % 10]);
				intValue /= 10;
			}
			m_num[m_intRange].SetTexture(m_numTexs[10]);
			float decimalValue = value - intValue;
			for (unsigned int i = m_intRange + 1; i < m_num.size(); ++i)
			{
				m_num[i].SetTexture(m_numTexs[intValue % 10]);
				intValue /= 10;
			}

			m_isValueDirty = false;
		}

		for (unsigned int i = 0; i < m_num.size(); ++i)
		{
			m_num[i].Update();
		}


		return true;
	}
예제 #21
0
IntroMenu::IntroMenu(void)
{
	firstRun	=	true;
	secondRun	=	false;
	thirdRun	=	false;
	forthRun	=	false;
	m_time		=	0;
	m_counter	=	1;
	int graphics = g_configFile->getScreenSize().y;
	m_graphicstext = "1080";
	if (graphics == 1080)
	{
		m_graphicstext = "1080";
	}
	if (graphics == 900)
	{
		m_graphicstext = "900";
	}
	if (graphics == 720)
	{
		m_graphicstext = "720";
	}
	this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\"+m_graphicstext+"\\MENU-INTRO-0.png", FLOAT2(0,  0),  FLOAT2(2, 2),0));
	this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\"+m_graphicstext+"\\MENU-INTRO-1.png", FLOAT2(0,  0),  FLOAT2(2, 2),0));
	this->m_Images.push_back(g_graphicsEngine->createSprite("menu_textures\\"+m_graphicstext+"\\MENU-INTRO-2.png", FLOAT2(0,  0),  FLOAT2(2, 2),0));
	this->m_Images[0]->setVisible(false);
	this->m_Images[1]->setVisible(false);
	this->m_Images[2]->setVisible(false);
}
예제 #22
0
/** Adds GL limits to the json data structure.
 *  (C) 2014-2015 Wildfire Games (0 A.D.), ported by Joerg Henrichs
 */
void getGLLimits(HardwareStats::Json *json)
{
    // Various macros to make the data assembly shorter.
#define INTEGER(id)                               \
    do {                                          \
        GLint i = -1;                             \
        glGetIntegerv(GL_##id, &i);               \
        if (glGetError()==GL_NO_ERROR)            \
            json->add("GL_"#id, i);               \
    } while (false)
#define INTEGER2(id)                              \
    do {                                          \
        GLint i[2] = { -1, -1 };                  \
        glGetIntegerv(GL_##id, i);                \
        if (glGetError()==GL_NO_ERROR) {          \
            json->add("GL_"#id"[0]", i[0]);       \
            json->add("GL_"#id"[1]", i[1]);       \
        }                                         \
    } while (false)
#define FLOAT(id)                                 \
    do {                                          \
        GLfloat f = -1.0f;                        \
        glGetFloatv(GL_##id, &f);                 \
        if (glGetError()==GL_NO_ERROR)            \
            json->add("GL_"#id, f);               \
    } while (false)
#define FLOAT2(id)                                \
    do {                                          \
        GLfloat f[2] = {-1.0f, -1.0f};            \
        glGetFloatv(GL_##id,  f);                 \
        if (glGetError()==GL_NO_ERROR)  {         \
            json->add("GL_"#id"[0]", f[0]);       \
            json->add("GL_"#id"[1]", f[1]);       \
        }                                         \
    } while (false)
#define STRING(id)                                         \
    do {                                                   \
        const char* c = (const char*)glGetString(GL_##id); \
        if(!c) c="";                                       \
        json->add("GL_"#id, c);                            \
    } while (false)


    STRING(VERSION);
    STRING(VENDOR);
    STRING(RENDERER);
    INTEGER(SUBPIXEL_BITS);
    INTEGER(MAX_TEXTURE_SIZE);
    INTEGER(MAX_CUBE_MAP_TEXTURE_SIZE);
    INTEGER2(MAX_VIEWPORT_DIMS);
    FLOAT2(ALIASED_POINT_SIZE_RANGE);
    FLOAT2(ALIASED_LINE_WIDTH_RANGE);
    INTEGER(SAMPLE_BUFFERS);
    INTEGER(SAMPLES);
    // TODO: compressed texture formats
    INTEGER(RED_BITS);
    INTEGER(GREEN_BITS);
    INTEGER(BLUE_BITS);
    INTEGER(ALPHA_BITS);
    INTEGER(DEPTH_BITS);
    INTEGER(STENCIL_BITS);

    return;

#ifdef NOT_DONE_YET
#define QUERY(target, pname) do { \
    GLint i = -1; \
    pglGetQueryivARB(GL_##target, GL_##pname, &i); \
    if (ogl_SquelchError(GL_INVALID_ENUM)) \
    scriptInterface.SetProperty(settings, "GL_" #target ".GL_" #pname, errstr); \
else \
    scriptInterface.SetProperty(settings, "GL_" #target ".GL_" #pname, i); \
        } while (false)
#define VERTEXPROGRAM(id) do { \
    GLint i = -1; \
    pglGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_##id, &i); \
    if (ogl_SquelchError(GL_INVALID_ENUM)) \
    scriptInterface.SetProperty(settings, "GL_VERTEX_PROGRAM_ARB.GL_" #id, errstr); \
else \
    scriptInterface.SetProperty(settings, "GL_VERTEX_PROGRAM_ARB.GL_" #id, i); \
        } while (false)
#define FRAGMENTPROGRAM(id) do { \
    GLint i = -1; \
    pglGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_##id, &i); \
    if (ogl_SquelchError(GL_INVALID_ENUM)) \
    scriptInterface.SetProperty(settings, "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, errstr); \
else \
    scriptInterface.SetProperty(settings, "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, i); \
        } while (false)
#define BOOL(id) INTEGER(id)


#if !CONFIG2_GLES
        INTEGER(MAX_LIGHTS);
        INTEGER(MAX_CLIP_PLANES);
        // Skip MAX_COLOR_MATRIX_STACK_DEPTH (only in imaging subset)
        INTEGER(MAX_MODELVIEW_STACK_DEPTH);
        INTEGER(MAX_PROJECTION_STACK_DEPTH);
        INTEGER(MAX_TEXTURE_STACK_DEPTH);
#endif
#if !CONFIG2_GLES
        INTEGER(MAX_3D_TEXTURE_SIZE);
#endif
#if !CONFIG2_GLES
        INTEGER(MAX_PIXEL_MAP_TABLE);
        INTEGER(MAX_NAME_STACK_DEPTH);
        INTEGER(MAX_LIST_NESTING);
        INTEGER(MAX_EVAL_ORDER);
#endif
#if !CONFIG2_GLES
        INTEGER(MAX_ATTRIB_STACK_DEPTH);
        INTEGER(MAX_CLIENT_ATTRIB_STACK_DEPTH);
        INTEGER(AUX_BUFFERS);
        BOOL(RGBA_MODE);
        BOOL(INDEX_MODE);
        BOOL(DOUBLEBUFFER);
        BOOL(STEREO);
#endif
#if !CONFIG2_GLES
        FLOAT2(SMOOTH_POINT_SIZE_RANGE);
        FLOAT(SMOOTH_POINT_SIZE_GRANULARITY);
#endif
#if !CONFIG2_GLES
        FLOAT2(SMOOTH_LINE_WIDTH_RANGE);
        FLOAT(SMOOTH_LINE_WIDTH_GRANULARITY);
        // Skip MAX_CONVOLUTION_WIDTH, MAX_CONVOLUTION_HEIGHT (only in imaging subset)
        INTEGER(MAX_ELEMENTS_INDICES);
        INTEGER(MAX_ELEMENTS_VERTICES);
        INTEGER(MAX_TEXTURE_UNITS);
#endif
#if !CONFIG2_GLES
        INTEGER(INDEX_BITS);
#endif
#if !CONFIG2_GLES
        INTEGER(ACCUM_RED_BITS);
        INTEGER(ACCUM_GREEN_BITS);
        INTEGER(ACCUM_BLUE_BITS);
        INTEGER(ACCUM_ALPHA_BITS);
#endif
#if !CONFIG2_GLES
        // Core OpenGL 2.0 (treated as extensions):
        if (ogl_HaveExtension("GL_EXT_texture_lod_bias"))
        {
            FLOAT(MAX_TEXTURE_LOD_BIAS_EXT);
        }
        if (ogl_HaveExtension("GL_ARB_occlusion_query"))
        {
            QUERY(SAMPLES_PASSED, QUERY_COUNTER_BITS);
        }
        if (ogl_HaveExtension("GL_ARB_shading_language_100"))
        {
            STRING(SHADING_LANGUAGE_VERSION_ARB);
        }
        if (ogl_HaveExtension("GL_ARB_vertex_shader"))
        {
            INTEGER(MAX_VERTEX_ATTRIBS_ARB);
            INTEGER(MAX_VERTEX_UNIFORM_COMPONENTS_ARB);
            INTEGER(MAX_VARYING_FLOATS_ARB);
            INTEGER(MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB);
            INTEGER(MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB);
        }
        if (ogl_HaveExtension("GL_ARB_fragment_shader"))
        {
            INTEGER(MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB);
        }
        if (ogl_HaveExtension("GL_ARB_vertex_shader") || ogl_HaveExtension("GL_ARB_fragment_shader") ||
            ogl_HaveExtension("GL_ARB_vertex_program") || ogl_HaveExtension("GL_ARB_fragment_program"))
        {
            INTEGER(MAX_TEXTURE_IMAGE_UNITS_ARB);
            INTEGER(MAX_TEXTURE_COORDS_ARB);
        }
        if (ogl_HaveExtension("GL_ARB_draw_buffers"))
        {
            INTEGER(MAX_DRAW_BUFFERS_ARB);
        }
        // Core OpenGL 3.0:
        if (ogl_HaveExtension("GL_EXT_gpu_shader4"))
        {
            INTEGER(MIN_PROGRAM_TEXEL_OFFSET); // no _EXT version of these in glext.h
            INTEGER(MAX_PROGRAM_TEXEL_OFFSET);
        }
        if (ogl_HaveExtension("GL_EXT_framebuffer_object"))
        {
            INTEGER(MAX_COLOR_ATTACHMENTS_EXT);
            INTEGER(MAX_RENDERBUFFER_SIZE_EXT);
        }
        if (ogl_HaveExtension("GL_EXT_framebuffer_multisample"))
        {
            INTEGER(MAX_SAMPLES_EXT);
        }
        if (ogl_HaveExtension("GL_EXT_texture_array"))
        {
            INTEGER(MAX_ARRAY_TEXTURE_LAYERS_EXT);
        }
        if (ogl_HaveExtension("GL_EXT_transform_feedback"))
        {
            INTEGER(MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT);
            INTEGER(MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT);
            INTEGER(MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT);
        }
        // Other interesting extensions:
        if (ogl_HaveExtension("GL_EXT_timer_query") || ogl_HaveExtension("GL_ARB_timer_query"))
        {
            QUERY(TIME_ELAPSED, QUERY_COUNTER_BITS);
        }
        if (ogl_HaveExtension("GL_ARB_timer_query"))
        {
            QUERY(TIMESTAMP, QUERY_COUNTER_BITS);
        }
        if (ogl_HaveExtension("GL_EXT_texture_filter_anisotropic"))
        {
            FLOAT(MAX_TEXTURE_MAX_ANISOTROPY_EXT);
        }
        if (ogl_HaveExtension("GL_ARB_texture_rectangle"))
        {
            INTEGER(MAX_RECTANGLE_TEXTURE_SIZE_ARB);
        }
        if (ogl_HaveExtension("GL_ARB_vertex_program") || ogl_HaveExtension("GL_ARB_fragment_program"))
        {
            INTEGER(MAX_PROGRAM_MATRICES_ARB);
            INTEGER(MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB);
        }
        if (ogl_HaveExtension("GL_ARB_vertex_program"))
        {
            VERTEXPROGRAM(MAX_PROGRAM_ENV_PARAMETERS_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_LOCAL_PARAMETERS_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_INSTRUCTIONS_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_TEMPORARIES_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_PARAMETERS_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_ATTRIBS_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_ADDRESS_REGISTERS_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_NATIVE_TEMPORARIES_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_NATIVE_PARAMETERS_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_NATIVE_ATTRIBS_ARB);
            VERTEXPROGRAM(MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB);
            if (ogl_HaveExtension("GL_ARB_fragment_program"))
            {
                // The spec seems to say these should be supported, but
                // Mesa complains about them so let's not bother
                /*
                VERTEXPROGRAM(MAX_PROGRAM_ALU_INSTRUCTIONS_ARB);
                VERTEXPROGRAM(MAX_PROGRAM_TEX_INSTRUCTIONS_ARB);
                VERTEXPROGRAM(MAX_PROGRAM_TEX_INDIRECTIONS_ARB);
                VERTEXPROGRAM(MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB);
                VERTEXPROGRAM(MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB);
                VERTEXPROGRAM(MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB);
                */
            }
        }
        if (ogl_HaveExtension("GL_ARB_fragment_program"))
        {
            FRAGMENTPROGRAM(MAX_PROGRAM_ENV_PARAMETERS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_LOCAL_PARAMETERS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_INSTRUCTIONS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_ALU_INSTRUCTIONS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_TEX_INSTRUCTIONS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_TEX_INDIRECTIONS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_TEMPORARIES_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_PARAMETERS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_ATTRIBS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_TEMPORARIES_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_PARAMETERS_ARB);
            FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_ATTRIBS_ARB);
            if (ogl_HaveExtension("GL_ARB_vertex_program"))
            {
                // The spec seems to say these should be supported, but
                // Intel drivers on Windows complain about them so let's not bother
                /*
                FRAGMENTPROGRAM(MAX_PROGRAM_ADDRESS_REGISTERS_ARB);
                FRAGMENTPROGRAM(MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB);
                */
            }
        }
        if (ogl_HaveExtension("GL_ARB_geometry_shader4"))
        {
            INTEGER(MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB);
            INTEGER(MAX_GEOMETRY_OUTPUT_VERTICES_ARB);
            INTEGER(MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB);
            INTEGER(MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB);
            INTEGER(MAX_GEOMETRY_VARYING_COMPONENTS_ARB);
            INTEGER(MAX_VERTEX_VARYING_COMPONENTS_ARB);
        }
#else // CONFIG2_GLES
        // Core OpenGL ES 2.0:
        STRING(SHADING_LANGUAGE_VERSION);
        INTEGER(MAX_VERTEX_ATTRIBS);
        INTEGER(MAX_VERTEX_UNIFORM_VECTORS);
        INTEGER(MAX_VARYING_VECTORS);
        INTEGER(MAX_COMBINED_TEXTURE_IMAGE_UNITS);
        INTEGER(MAX_VERTEX_TEXTURE_IMAGE_UNITS);
        INTEGER(MAX_FRAGMENT_UNIFORM_VECTORS);
        INTEGER(MAX_TEXTURE_IMAGE_UNITS);
        INTEGER(MAX_RENDERBUFFER_SIZE);
#endif // CONFIG2_GLES
#ifdef SDL_VIDEO_DRIVER_X11
#define GLXQCR_INTEGER(id) do { \
    unsigned int i = UINT_MAX; \
    if (pglXQueryCurrentRendererIntegerMESA(id, &i)) \
    scriptInterface.SetProperty(settings, #id, i); \
        } while (false)
#define GLXQCR_INTEGER2(id) do { \
    unsigned int i[2] = { UINT_MAX, UINT_MAX }; \
    if (pglXQueryCurrentRendererIntegerMESA(id, i)) { \
    scriptInterface.SetProperty(settings, #id "[0]", i[0]); \
    scriptInterface.SetProperty(settings, #id "[1]", i[1]); \
    } \
        } while (false)
#define GLXQCR_INTEGER3(id) do { \
    unsigned int i[3] = { UINT_MAX, UINT_MAX, UINT_MAX }; \
    if (pglXQueryCurrentRendererIntegerMESA(id, i)) { \
    scriptInterface.SetProperty(settings, #id "[0]", i[0]); \
    scriptInterface.SetProperty(settings, #id "[1]", i[1]); \
    scriptInterface.SetProperty(settings, #id "[2]", i[2]); \
    } \
        } while (false)
#define GLXQCR_STRING(id) do { \
    const char* str = pglXQueryCurrentRendererStringMESA(id); \
    if (str) \
    scriptInterface.SetProperty(settings, #id ".string", str); \
        } while (false)
        SDL_SysWMinfo wminfo;
        SDL_VERSION(&wminfo.version);
        if (SDL_GetWMInfo(&wminfo) && wminfo.subsystem == SDL_SYSWM_X11)
        {
            Display* dpy = wminfo.info.x11.gfxdisplay;
            int scrnum = DefaultScreen(dpy);
            const char* glxexts = glXQueryExtensionsString(dpy, scrnum);
            scriptInterface.SetProperty(settings, "glx_extensions", glxexts);
            if (strstr(glxexts, "GLX_MESA_query_renderer") && pglXQueryCurrentRendererIntegerMESA && pglXQueryCurrentRendererStringMESA)
            {
                GLXQCR_INTEGER(GLX_RENDERER_VENDOR_ID_MESA);
                GLXQCR_INTEGER(GLX_RENDERER_DEVICE_ID_MESA);
                GLXQCR_INTEGER3(GLX_RENDERER_VERSION_MESA);
                GLXQCR_INTEGER(GLX_RENDERER_ACCELERATED_MESA);
                GLXQCR_INTEGER(GLX_RENDERER_VIDEO_MEMORY_MESA);
                GLXQCR_INTEGER(GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA);
                GLXQCR_INTEGER(GLX_RENDERER_PREFERRED_PROFILE_MESA);
                GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA);
                GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA);
                GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA);
                GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA);
                GLXQCR_STRING(GLX_RENDERER_VENDOR_ID_MESA);
                GLXQCR_STRING(GLX_RENDERER_DEVICE_ID_MESA);
            }
        }
#endif // SDL_VIDEO_DRIVER_X11

#endif  // ifdef XX
}   // getGLLimits
예제 #23
0
bool DIVANote::Update(double _deltaTime)
{
	m_restTime -= _deltaTime;

	// Normal
	if (m_type == NOTETYPE_NORMAL)
	{
		// Hit time
		if (abs(m_restTime) <= m_actionTime && m_state == DIVA_NOTE_DEFAULT)
		{
			if (EEGetKeyHit(DIVAConfig::GetKeyMap(m_key)))
			{
				m_state = DIVA_NOTE_COOL;
			}
		}
		// Missed
		else if (m_restTime + m_actionTime <= 0 && m_state == DIVA_NOTE_DEFAULT)
		{
			m_state = DIVA_NOTE_WORST;
		}

		float percent = (float)(m_totalTime - m_restTime) / m_totalTime;
		m_note.SetPosition(FLOAT3(percent * (m_x - m_tailx) + m_tailx, percent * (m_y - m_taily) + m_taily, 0.f));

		Process();
		m_strip.Process();
		m_note.Process();
	}
	// Strip
	else
	{
		if (m_restTime < 0)
		{
			m_restDuration = m_totalDuration + m_restTime;
		}

		// Hit time
		if (abs(m_restTime) <= m_actionTime && m_state == DIVA_NOTE_DEFAULT)
		{
			if (EEGetKeyHit(DIVAConfig::GetKeyMap(m_key)))
			{
				m_state = DIVA_NOTE_COOL;
			}
		}
		// Missed
		else if (m_restTime + m_actionTime <= 0 && m_state == DIVA_NOTE_DEFAULT)
		{
			m_state = DIVA_NOTE_WORST;
		}
		// Strip time
		else if (m_restDuration > m_actionTime && m_state != DIVA_NOTE_DEFAULT)
		{
			m_state = DIVA_NOTE_STRIP_DEFAULT;
			if (!EEIsKeyDown(DIVAConfig::GetKeyMap(m_key)))
				m_state = DIVA_NOTE_STRIP_WORST;
		}
		// Release time
		else if (abs(m_restDuration) <= m_actionTime && m_state != DIVA_NOTE_DEFAULT)
		{
			if (!EEIsKeyDown(DIVAConfig::GetKeyMap(m_key)))
				m_state = DIVA_NOTE_STRIP_COOL;
		}
		// Missed
		else if (m_restDuration + m_actionTime <= 0)
		{
			if (EEIsKeyDown(DIVAConfig::GetKeyMap(m_key)))
				m_state = DIVA_NOTE_STRIP_WORST;
		}

		float percent = (float)(m_totalTime - m_restTime) / m_totalTime;
		if (percent > 1.f)
			percent = 1.f;
		FLOAT2 vertical = (FLOAT2(m_x, m_y) - FLOAT2(m_tailx, m_taily)).GetVertical() * 30.f;
		FLOAT2 center1 = (FLOAT2(m_x, m_y) - FLOAT2(m_tailx, m_taily)) / 3.f + FLOAT2(m_tailx, m_taily) - vertical;
		FLOAT2 center2 = (FLOAT2(m_x, m_y) - FLOAT2(m_tailx, m_taily)) * 2 / 3.f + FLOAT2(m_tailx, m_taily) + vertical;
		std::vector<FLOAT2> pointsData;
		for (float t = percent - m_restDuration / m_totalTime; t < percent; t += 0.001f)
			pointsData.push_back(EEBezier(FLOAT2(m_tailx, m_taily), center1, center2, FLOAT2(m_x, m_y), t));

		if (pointsData.size())
		{
			m_stripNote.SetPositionXY(pointsData.front());
			m_note.SetPositionXY(pointsData.back());
		}
		else
			m_note.SetPositionXY(FLOAT2(m_x, m_y));
		m_strip.SetCurve(pointsData);

		Process();
		m_strip.Process();
		m_note.Process();
		m_stripNote.Process();
	}

	return true;
}
예제 #24
0
void SpotLight::setAngle(FLOAT2 _angle)
{
	this->m_angle = FLOAT2(cos(_angle.x / 2), cos(_angle.y / 2));
}
예제 #25
0
	//-----------------------------------------------------------------------
	bool FontClass::Print(FLOAT _posX, FLOAT _posY, const FLOAT4& _color, const char* _info)
	{
		float fontPosX = (_posX / (float)m_width) * 2.0f - 1.0f;
		float fontPosY = 1.0f - (_posY / (float)m_height) * 2.0f;
		float deltaX = 2.0f / (float)m_width;
		float deltaY = -32.0f / (float)m_height;
		float fontWidth = 0.0f;
		float fontHeight = fontPosY + deltaY;


		int length = (int)strlen(_info);

		std::vector<FontVertex> vertices(6 * length);

		int index(0), letter(0);
		for (int i = 0; _info[i] != '\0'; ++i)
		{
			letter = ((int)_info[i]) - 32;
			if (letter == 0)
			{
				fontPosX = fontPosX + 3 * deltaX;
			}
			else
			{
				fontWidth = fontPosX + m_fontData[letter].size * deltaX;

				vertices[index].pos = FLOAT3(fontPosX, fontPosY, 0.0f);
				vertices[index].tex = FLOAT2(m_fontData[letter].left, 0.0f);
				index++;
				vertices[index].pos = FLOAT3(fontWidth, fontHeight, 0.0f);
				vertices[index].tex = FLOAT2(m_fontData[letter].right, 1.0f);
				index++;
				vertices[index].pos = FLOAT3(fontPosX, fontHeight, 0.0f);
				vertices[index].tex = FLOAT2(m_fontData[letter].left, 1.0f);
				index++;

				vertices[index].pos = FLOAT3(fontPosX, fontPosY, 0.0f);
				vertices[index].tex = FLOAT2(m_fontData[letter].left, 0.0f);
				index++;
				vertices[index].pos = FLOAT3(fontWidth, fontPosY, 0.0f);
				vertices[index].tex = FLOAT2(m_fontData[letter].right, 0.0f);
				index++;
				vertices[index].pos = FLOAT3(fontWidth, fontHeight, 0.0f);
				vertices[index].tex = FLOAT2(m_fontData[letter].right, 1.0f);
				index++;

				fontPosX = fontPosX + m_fontData[letter].size * deltaX + deltaX;
			}
		}

		ID3D11Buffer *fontVB;

		D3D11_BUFFER_DESC vbDesc = { 0 };
		vbDesc.ByteWidth = sizeof(FontVertex) * vertices.size();
		vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
		vbDesc.CPUAccessFlags = 0;
		vbDesc.MiscFlags = 0;
		vbDesc.StructureByteStride = 0;
		vbDesc.Usage = D3D11_USAGE_IMMUTABLE;

		D3D11_SUBRESOURCE_DATA vbData;
		vbData.pSysMem = &vertices[0];
		vbData.SysMemPitch = 0;
		vbData.SysMemSlicePitch = 0;

		if (FAILED(m_device->CreateBuffer(&vbDesc, &vbData, &fontVB)))
		{
			MessageBox(NULL, L"CreateVertexBuffer failed!", L"Error", MB_OK);
			return false;
		}

		SetFontParameters(_color);
		m_deviceContext->PSSetShaderResources(0, 1, &m_fontTex);

		m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
		m_deviceContext->IASetInputLayout(m_fontIL);
		UINT stride = sizeof(FontVertex);
		UINT offset = 0;
		m_deviceContext->IASetVertexBuffers(0, 1, &fontVB, &stride, &offset);
		m_deviceContext->IASetIndexBuffer(NULL, DXGI_FORMAT_R32_UINT, 0);
		m_deviceContext->VSSetShader(m_fontVS, NULL, 0);
		m_deviceContext->PSSetShader(m_fontPS, NULL, 0);

		m_deviceContext->Draw(vertices.size(), 0);

		SAFE_RELEASE(fontVB);
		return true;
	}
예제 #26
0
	//----------------------------------------------------------------------------------------------------
	bool EECylinder::CreateCylinderBuffer()
	{
		float radiusDelta = (m_bottomRadius - m_topRadius) / m_stack;
		float heightDelta = m_height / m_stack;
		int perRow = m_slice + 1;
		int rows = m_stack + 1;
		float topY = m_height * 0.5f;

		m_vertexCount = perRow * rows + 2 * (m_slice + 2);
		std::vector<EECylinderVertex> vertices(m_vertexCount);
		int index = 0;
		for (int i = 0; i < rows; ++i)
		{
			float tmpY = topY - heightDelta * i;
			float tmpRadius = m_topRadius + i * radiusDelta;
			for (int j = 0; j < perRow; ++j)
			{
				float theta = EE_2PI * j / m_slice;
				index = i * perRow + j;
				vertices[index].pos = FLOAT3(tmpRadius*cos(theta), tmpY, tmpRadius*sin(theta));
				vertices[index].normal = FLOAT3(cos(theta), (m_bottomRadius - m_topRadius) / m_height, sin(theta)).GetNormalization();
				vertices[index].tex = FLOAT2(1.f*j / m_slice, 1.f*i / m_stack);
			}
		}
		// top
		++index;
		for (int i = 0; i < m_slice + 1; ++i)
		{
			float theta = EE_2PI * i / m_slice;
			float x = m_topRadius * cosf(theta);
			float y = m_height * 0.5f;
			float z = m_topRadius * sinf(theta);
			float u = x / m_height + 0.5f;
			float v = z / m_height + 0.5f;
			vertices[index].pos = FLOAT3(x, y, z);
			vertices[index].normal = FLOAT3(0.f, 1.f, 0.f);
			vertices[index++].tex = FLOAT2(u, v);
		}
		vertices[index].pos = FLOAT3(0.f, m_height * 0.5f, 0.f);
		vertices[index].normal = FLOAT3(0.f, 1.f, 0.f);
		vertices[index++].tex = FLOAT2(0.5f, 0.5f);
		// bottom
		for (int i = 0; i < m_slice + 1; ++i)
		{
			float theta = EE_2PI * i / m_slice;
			float x = m_bottomRadius * cosf(theta);
			float y = -m_height * 0.5f;
			float z = m_bottomRadius * sinf(theta);
			float u = x / m_height + 0.5f;
			float v = z / m_height + 0.5f;
			vertices[index].pos = FLOAT3(x, y, z);
			vertices[index].normal = FLOAT3(0.f, -1.f, 0.f);
			vertices[index++].tex = FLOAT2(u, v);
		}
		vertices[index].pos = FLOAT3(0.f, -m_height * 0.5f, 0.f);
		vertices[index].normal = FLOAT3(0.f, -1.f, 0.f);
		vertices[index++].tex = FLOAT2(0.5f, 0.5f);
		SAFE_RELEASE(m_objectVB);
		D3D11_BUFFER_DESC vbDesc = { 0 };
		vbDesc.ByteWidth = sizeof(EECylinderVertex)* vertices.size();
		vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
		vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
		vbDesc.MiscFlags = 0;
		vbDesc.StructureByteStride = 0;
		vbDesc.Usage = D3D11_USAGE_DYNAMIC;
		D3D11_SUBRESOURCE_DATA vbData;
		vbData.pSysMem = &vertices[0];
		vbData.SysMemPitch = 0;
		vbData.SysMemSlicePitch = 0;
		if (FAILED(EECore::s_EECore->GetDevice()->CreateBuffer(&vbDesc, &vbData, &m_objectVB)))
		{
			MessageBoxW(NULL, L"CreateVertexBuffer failed!", L"Error", MB_OK);
			return false;
		}

		m_indexCount = m_slice * m_stack * 6 + m_slice * 6;
		std::vector<unsigned int> indices(m_indexCount);
		index = 0;
		for (int i = 0; i < m_stack; ++i)
		{
			for (int j = 0; j < m_slice; ++j)
			{
				indices[index] = i * perRow + j;
				indices[index + 1] = (i + 1) * perRow + j + 1;
				indices[index + 2] = (i + 1) * perRow + j;
				indices[index + 3] = i * perRow + j;
				indices[index + 4] = i * perRow + j + 1;
				indices[index + 5] = (i + 1) * perRow + j + 1;

				index += 6;
			}
		}
		// top
		int start = perRow * rows;
		int center = perRow * rows + m_slice + 1;
		for (int i = 0; i < m_slice; ++i)
		{
			indices[index++] = center;
			indices[index++] = start + i + 1;
			indices[index++] = start + i;
		}
		// bottom
		start = perRow * rows + m_slice + 2;
		center = perRow * rows + 2 * (m_slice + 2) - 1;
		for (int i = 0; i < m_slice; ++i)
		{
			indices[index++] = center;
			indices[index++] = start + i;
			indices[index++] = start + i + 1;
		}
		SAFE_RELEASE(m_objectIB);
		D3D11_BUFFER_DESC ibDesc = { 0 };
		ibDesc.ByteWidth = sizeof(UINT)* indices.size();
		ibDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
		ibDesc.CPUAccessFlags = 0;
		ibDesc.MiscFlags = 0;
		ibDesc.StructureByteStride = 0;
		ibDesc.Usage = D3D11_USAGE_IMMUTABLE;
		D3D11_SUBRESOURCE_DATA ibData;
		ibData.pSysMem = &indices[0];
		ibData.SysMemPitch = 0;
		ibData.SysMemSlicePitch = 0;
		if (FAILED(EECore::s_EECore->GetDevice()->CreateBuffer(&ibDesc, &ibData, &m_objectIB)))
		{
			MessageBoxW(NULL, L"CreateIndexBuffer failed!", L"Error", MB_OK);
			return false;
		}

		return true;
	}
예제 #27
0
void LobbyState::update(float _dt)
{
	if(m_playerId == 0)
		m_menu->Update(_dt, m_hostMayStartGame);
	else
		m_menu->Update(_dt, m_clientMayReady);

	if(GetKeyState(VK_LEFT) < 0)
	{
		if(g_graphicsEngine->getCamera()->getPos().x >= 0)
		{
			FLOAT2 newPos = FLOAT2(g_graphicsEngine->getCamera()->getPos().x, g_graphicsEngine->getCamera()->getPos().y);
			g_graphicsEngine->getCamera()->set( newPos + FLOAT2(-speed * _dt, 0));
			//pl[0]->setPosition(pl[0]->getPosition() + FLOAT3(-0.05f, 0, 0));
		}
	}
	if(GetKeyState(VK_RIGHT) < 0)
	{
		if(g_graphicsEngine->getCamera()->getPos().x <= step*3)
		{
			FLOAT2 newPos = FLOAT2(g_graphicsEngine->getCamera()->getPos().x, g_graphicsEngine->getCamera()->getPos().y);
			g_graphicsEngine->getCamera()->set( newPos + FLOAT2(speed * _dt, 0));
			//pl[0]->setPosition(pl[0]->getPosition() + FLOAT3(0.05f, 0, 0));
		}
	}

	float max = step*3;
	float min = 0;


	float value = this->m_menu->getSlider()->GetValue();

	//camera linear velocity
	float camVel=0.8;
	//distance from the real camera pos to the slider pos
	distToSlider=abs(cameraRealPos-this->m_menu->getSlider()->GetValue() * max)*3;
	//if you are close enough, it will keep a constant speed before it stops
	if(distToSlider < 1.0)
		distToSlider = 1.0;

	//ugly solution for if the enterkey was pressed, fetch chat string
	if(m_menu->wasEnterPressed())
	{
		this->m_network->sendMessage(NetworkTextMessage(m_menu->getChatString()));
		m_menu->resetEnterPressed();
	}
	//camera real pos is the camera position, which tries to reach the position from the slider
	//if the real pos is inside a certain value, it wont move
	this->m_sliderMove = false;
	if(cameraRealPos > this->m_menu->getSlider()->GetValue() * max-0.05 && cameraRealPos < this->m_menu->getSlider()->GetValue() * max + 0.05)
	{
	}
	else
	{	//otherwise, move the cameras pos toward the slider
		if(cameraRealPos<this->m_menu->getSlider()->GetValue() * max)
			cameraRealPos+=_dt*camVel*distToSlider;
		else if(cameraRealPos>this->m_menu->getSlider()->GetValue() * max)
			cameraRealPos-=_dt*camVel*distToSlider;
		g_graphicsEngine->getCamera()->set(FLOAT2(cameraRealPos, 0));
		this->m_sliderMove = true;
	}

	float mouseX = (g_mouse->getPos().x / float(g_graphicsEngine->getScreenSize().x))*2-1;
	 max = step*5;
	if(g_mouse->isLButtonReleased() && mouseX >= -0.58f && mouseX <= 0.58f && !m_sliderMove)
	{
		D3DXVECTOR3 pickDir;
		D3DXVECTOR3 pickOrig;
		float alve = 1.0f/5.0f;
		g_graphicsEngine->getCamera()->calcPick(pickDir, pickOrig, g_mouse->getPos());
		float dist;
		if(m_officer->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::OFFICER;
			m_network->sendMessage(NetworkSelectHeroMessage(0, this->m_menu->getCombat()));
			//this->m_menu->getSlider()->setValue(alve*0);
			this->m_menu->getSlider()->setPosition((m_officer->getRoom()->getPosition().x-step*2+0.6)/max);
			//this->m_menu->getSlider()->setPosition((m_officer->getRoom()->getPosition().x));
		} 
		else if(m_redKnight->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::RED_KNIGHT;
			m_network->sendMessage(NetworkSelectHeroMessage(1, this->m_menu->getCombat()));
			//this->m_menu->getSlider()->setValue(alve*0);
			this->m_menu->getSlider()->setPosition((m_redKnight->getRoom()->getPosition().x-step*2)/max);
			//this->m_menu->getSlider()->setPosition((m_redKnight->getRoom()->getPosition().x));
		}
		else if(m_engi->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::ENGINEER;
			m_network->sendMessage(NetworkSelectHeroMessage(2, this->m_menu->getCombat()));
			//this->m_menu->getSlider()->setValue(alve*2);
			this->m_menu->getSlider()->setPosition((m_engi->getRoom()->getPosition().x-step)/max);
			//this->m_menu->getSlider()->setPosition((m_engi->getRoom()->getPosition().x));
		}
		else if(m_doctor->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::DOCTOR;
			m_network->sendMessage(NetworkSelectHeroMessage(3, this->m_menu->getCombat()));
			//this->m_menu->getSlider()->setValue(alve*3);
			this->m_menu->getSlider()->setPosition((m_doctor->getRoom()->getPosition().x-step)/max);
			//this->m_menu->getSlider()->setPosition((m_doctor->getRoom()->getPosition().x));
		}
		else if(m_mentalist->getRoom()->intersects(dist, pickOrig, pickDir))
		{
			this->m_heroType = Hero::THE_MENTALIST;
			m_network->sendMessage(NetworkSelectHeroMessage(4, this->m_menu->getCombat()));
			this->m_menu->getSlider()->setPosition((m_mentalist->getRoom()->getPosition().x-step)/max);
			//this->m_menu->getSlider()->setValue(alve*4);
			//this->m_menu->getSlider()->setPosition((m_mentalist->getRoom()->getPosition().x));
		}
	}
	
	if(m_menu->MainMenuIsDown())
	{
		sf::Packet dispack;
		dispack << (int)NetworkMessage::PLAYERDISCONNECTED;
		this->m_network->sendPacket(dispack);
		this->m_network->disconnect();
	}

	if(this->m_menu->CloseCombatIsDown() && this->m_heroType != Hero::NONE)
	{
		this->m_network->sendMessage(NetworkSelectHeroMessage(this->m_heroType, this->m_menu->getCombat()));
	}
	else if(this->m_menu->RangeCombatIsDown() && this->m_heroType != Hero::NONE)
	{
		this->m_network->sendMessage(NetworkSelectHeroMessage(this->m_heroType, this->m_menu->getCombat()));
	}

	if(this->m_menu->StartGameIsDown())
	{
		// The host has some restrictions
		if(m_playerId == 0)
		{
			if(m_hostMayStartGame)
			{
				//Skicka ready till servern
				m_network->sendMessage(NetworkReadyMessage(true));
			}
		}
		else if(m_heroType != Hero::HERO_TYPE::NONE)
		{
			//Skicka ready till servern
			m_network->sendMessage(NetworkReadyMessage(true));
		}
	}
	else if(this->m_menu->MainMenuIsDown() == true)
	{
		this->setDone(true);
		this->m_nextState = State::MAIN_MENU;
	}

	//Kolla om n�tverket har sagt att spelet har startat
	while(!m_network->startGameQueueEmpty())
	{
		NetworkStartGameMessage e = m_network->startGameQueueFront();
		this->mapName = e.getMapName();
		this->setDone(true);
		this->m_nextState = State::LOADING;
	}

	//kollar om n�n klient skickat ett text medelande
	while(!m_network->networkTextMessageQueueEmpty())
	{
		NetworkTextMessage e = m_network->networkTextMessageFront();
		m_menu->addStringToChat(e.getTxtMessage());
	}

	while(!m_network->heroSelectedQueueEmpty())
	{
		NetworkHeroSelectedMessage nhsm = m_network->heroSelectedQueueFront();

		// Check if a player has disconnected (chosen hero NONE)
		if(nhsm.getHeroId()== Hero::HERO_TYPE::NONE)
		{
			m_menu->removePlayer(nhsm.getPlayerId());
			if(m_playerId == 0)
			{
				m_hostsSuperVector.erase(nhsm.getPlayerId());
				if(m_hostsSuperVector.size() < 2)
				{
					m_hostMayStartGame = true;
				}
			}
		}
		else
		{
			m_heroType = Hero::HERO_TYPE(nhsm.getHeroId());
		
			if(nhsm.getPlayerId() == this->m_playerId)
			{
				m_menu->selectHero(nhsm.getPlayerId(), m_heroType, true);
				// If its the host that picked a hero, he might now be able to start the game
				if(m_playerId == 0)
				{
					// Check how many players are ready
					int notReadyCounter = 0;
					for(map<int, bool>::iterator iter = m_hostsSuperVector.begin(); iter != m_hostsSuperVector.end(); iter++)
					{
						if(!iter->second)
						{
							notReadyCounter++;
						}
					}
					// The host can only ready up if he is the only one not ready.
					if(notReadyCounter < 2)
					{
						m_hostMayStartGame = true;
					}
				}
				else
					m_clientMayReady = true;
			}
			else
			{
				m_menu->selectHero(nhsm.getPlayerId(), m_heroType, false);
			}
			//Select
			switch(nhsm.getHeroId())
			{
				case Hero::HERO_TYPE::OFFICER:
					if(this->m_officer->getCharacter()->getAnimation()->getCurrentAnimation() == "OfficerIdle")
					{
						this->m_officer->getCharacter()->getAnimation()->PlayLoop("OfficerSelectIdle");
						this->m_officer->getCharacter()->getAnimation()->Play("OfficerSelect");
						this->m_officer->getRoom()->setGlowIndex("glowIntensity");
						this->m_officer->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_officer->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
				case Hero::HERO_TYPE::RED_KNIGHT:
					if(this->m_redKnight->getCharacter()->getAnimation()->getCurrentAnimation() == "RedKnightIdle")
					{
						this->m_redKnight->getCharacter()->getAnimation()->PlayLoop("RedKnightSelectIdle");
						this->m_redKnight->getCharacter()->getAnimation()->Play("RedKnightSelect");
						this->m_redKnight->getRoom()->setGlowIndex("glowIntensity1");
						this->m_redKnight->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_redKnight->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
				case Hero::HERO_TYPE::ENGINEER:
					if(this->m_engi->getCharacter()->getAnimation()->getCurrentAnimation() == "EngiIdle")
					{
						this->m_engi->getCharacter()->getAnimation()->PlayLoop("EngiSelectIdle");
						this->m_engi->getCharacter()->getAnimation()->Play("EngiSelect");
						this->m_engi->getRoom()->setGlowIndex("glowIntensity2");
						this->m_engi->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_engi->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
				case Hero::HERO_TYPE::DOCTOR:
					if(this->m_doctor->getCharacter()->getAnimation()->getCurrentAnimation() == "DoctorIdle")
					{
						this->m_doctor->getCharacter()->getAnimation()->PlayLoop("DoctorSelectedIdle");
						this->m_doctor->getCharacter()->getAnimation()->Play("DoctorSelected");
						this->m_doctor->getRoom()->setGlowIndex("glowIntensity3");
						this->m_doctor->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_doctor->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
				case Hero::HERO_TYPE::THE_MENTALIST:
					if(this->m_mentalist->getCharacter()->getAnimation()->getCurrentAnimation() == "MentalistIdle")
					{
						this->m_mentalist->getCharacter()->getAnimation()->PlayLoop("MentalistSelectIdle");
						this->m_mentalist->getCharacter()->getAnimation()->Play("MentalistSelect");
						this->m_mentalist->getRoom()->setGlowIndex("glowIntensity4");
						this->m_mentalist->getDoor()->getAnimation()->PlayLoop("OpenIdle");
						this->m_mentalist->getDoor()->getAnimation()->Play("DoorOpen");
					}
					break;
			}
		}

		bool heroesNotSelected[] = {false, false, false, false, false};
		for(int i = 0; i < 4; i++)
		{
			if(m_menu->getHeroesSelected()[i] != Hero::HERO_TYPE::NONE)
			{
				heroesNotSelected[m_menu->getHeroesSelected()[i]] = true;
			}
		}

		//Deselect
		for(int i = 0; i < numCharacters; i++)
		{
			if(heroesNotSelected[i] == false)
			{
				switch(i)
				{
				case Hero::HERO_TYPE::OFFICER:
					if(this->m_officer->getCharacter()->getAnimation()->getCurrentAnimation() == "OfficerSelectIdle")
					{
						this->m_officer->getCharacter()->getAnimation()->PlayLoop("OfficerIdle");
						this->m_officer->getCharacter()->getAnimation()->Play("OfficerDeselect");
						this->m_officer->getRoom()->setGlowIndex("");
						this->m_officer->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_officer->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				case Hero::HERO_TYPE::RED_KNIGHT:
					if(this->m_redKnight->getCharacter()->getAnimation()->getCurrentAnimation() == "RedKnightSelectIdle")
					{
						this->m_redKnight->getCharacter()->getAnimation()->PlayLoop("RedKnightIdle");
						this->m_redKnight->getCharacter()->getAnimation()->Play("RedKnightDeselect");
						this->m_redKnight->getRoom()->setGlowIndex("");
						this->m_redKnight->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_redKnight->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				case Hero::HERO_TYPE::ENGINEER:
					if(this->m_engi->getCharacter()->getAnimation()->getCurrentAnimation() == "EngiSelectIdle")
					{
						this->m_engi->getCharacter()->getAnimation()->PlayLoop("EngiIdle");
						this->m_engi->getCharacter()->getAnimation()->Play("EngiDeselect");
						this->m_engi->getRoom()->setGlowIndex("");
						this->m_engi->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_engi->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				case Hero::HERO_TYPE::DOCTOR:
					if(this->m_doctor->getCharacter()->getAnimation()->getCurrentAnimation() == "DoctorSelectedIdle")
					{
						this->m_doctor->getCharacter()->getAnimation()->PlayLoop("DoctorIdle");
						this->m_doctor->getCharacter()->getAnimation()->Play("DoctorDeselected");
						this->m_doctor->getRoom()->setGlowIndex("");
						this->m_doctor->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_doctor->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				case Hero::HERO_TYPE::THE_MENTALIST:
					if(this->m_mentalist->getCharacter()->getAnimation()->getCurrentAnimation() == "MentalistSelectIdle")
					{
						this->m_mentalist->getCharacter()->getAnimation()->PlayLoop("MentalistIdle");
						this->m_mentalist->getCharacter()->getAnimation()->Play("MentalistDeselect");
						this->m_mentalist->getRoom()->setGlowIndex("");
						this->m_mentalist->getDoor()->getAnimation()->PlayLoop("ClosedIdle");
						this->m_mentalist->getDoor()->getAnimation()->Play("DoorClose");
					}
					break;
				}
			}
		}
	}

	while(!m_network->playerJoinedMessageQueueEmpty())
	{
		NetworkPlayerJoinedMessage msg = m_network->playerJoinedMessageQueueFront();

		if(msg.getPlayerIndex() == this->m_playerId)
		{
			this->m_menu->setPlayerName(msg.getPlayerIndex(), msg.getName(), true);
		}
		else
		{
			this->m_menu->setPlayerName(msg.getPlayerIndex(), msg.getName(), false);
		}

		if(m_playerId == 0)
		{
			m_hostsSuperVector[msg.getPlayerIndex()] = false;
			if(msg.getPlayerIndex() != 0)
				m_hostMayStartGame = false;
		}
	}
	
	while(!m_network->readyMessageToClientQueueEmpty())
	{
		NetworkReadyMessageToClient msg = m_network->readyMessageToClientQueueFront();
		this->m_menu->setReady(msg.m_playerIndex);
		if(m_playerId == 0)
		{
			m_hostsSuperVector[msg.m_playerIndex] = true;

			// Check how many players are ready
			int notReadyCounter = 0;
			for(map<int, bool>::iterator iter = m_hostsSuperVector.begin(); iter != m_hostsSuperVector.end(); iter++)
			{
				if(!iter->second)
				{
					notReadyCounter++;
				}
			}
			// The host can only ready up if he is the only one not ready.
			if(notReadyCounter < 2)
			{
				if(m_heroType != Hero::HERO_TYPE::NONE)
				{
					m_hostMayStartGame = true;
				}
			}
		}
	}
}