예제 #1
0
void cPreMenu::Reset()
{
	mbActive = false;
	mfAlpha = 0;
	mfAlphaAdd = 0.6f;

	mlState = 0;
	mlCurrentLogo = 0;

	mlCurrentTextChar = 0;
	mfNewCharCount =0;
	mfClickCount =0;

	mfFontColor =1;
	mfLogoSizeFactor = 1.05f;
	mvecLogoSize = cVector3f(1024,301,0)*mfLogoSizeFactor;
	mfLogoFade = 1;
	mfEpFade = 0;

	mvecLastTextPos = cVector3f(0);
	mfLastTextSize = 0;
	mfLastTextColor = 1;
	mfLastTextSpeed1 = 0.25f;
	mfLastTextSpeed2 = 0.5f;

	mfAdd = 0.002f;
	
	mbFadeWindSound = false;
	mbFadeRainSound = false;

	mbPlayingRainSound = false;
	mbPlayingWindSound = false;
	mbPlayingMusic = false;
	mbPlayingThunderSound = false;

	mfRaindropFade = 0;

	mbFlash = true;

	mvRaindropVector.resize(100);

	mpRaindropGfx = mpInit->mpGame->GetGraphics()->GetDrawer()->CreateGfxObject("menu_rain_drop.jpg","diffadditive2d");
	mpFlashGfx = mpInit->mpGame->GetGraphics()->GetDrawer()->CreateGfxObject("effect_white.jpg","diffadditive2d");

	
	for ( int i =0; i< (int)mvRaindropVector.size(); ++i )
	{
		cRaindrop* pRaindrop = &(mvRaindropVector[i]);
		pRaindrop->vPos = cVector2f(cMath::RandRectf(-20,800),-50);
		pRaindrop->vDir = cVector2f(cMath::RandRectf(20,100), 600);
		pRaindrop->vDir.Normalise();
		pRaindrop->fColor = 1;
		pRaindrop->fLength = cMath::RandRectf(10,40);
		pRaindrop->mpGfx = mpRaindropGfx;
	}

	mpWindSound = NULL;
	mpRainSound = NULL;
	
}
예제 #2
0
	cResourceImage::cResourceImage(tString asName,cFrameTexture *apFrameTex,
		cFrameBitmap *apFrameBmp, cRect2l aRect,
		cVector2l avSrcSize, int alHandle) : iResourceBase(asName,0)
	{
		mpFrameTexture = apFrameTex;
		mpFrameBitmap = apFrameBmp;
		mRect = aRect;
		mvSourceSize = avSrcSize;
		mlHandle = alHandle;

		cVector2f vTexSize = cVector2f((float)mRect.w,(float)mRect.h ) /
								cVector2f((float)mvSourceSize.x,(float)mvSourceSize.y);
		cVector2f vTexPos = cVector2f((float)mRect.x,(float)mRect.y ) /
								cVector2f((float)mvSourceSize.x,(float)mvSourceSize.y);

		mvVtx.push_back(cVertex(cVector3f(0,0,0),
						cVector3f(vTexPos.x+kContractSize, vTexPos.y+kContractSize,0), cColor(1)));

		mvVtx.push_back(cVertex(cVector3f((float)mRect.w,0,0),
						cVector3f(vTexPos.x+vTexSize.x-kContractSize, vTexPos.y+kContractSize,0),
						cColor(1)));

		mvVtx.push_back(cVertex(cVector3f((float)mRect.w,(float)mRect.h,0),
						cVector3f(vTexPos.x+vTexSize.x-kContractSize, vTexPos.y+vTexSize.y-kContractSize,0),
						cColor(1)));

		mvVtx.push_back(cVertex(cVector3f(0,(float)mRect.h,0),
						cVector3f(vTexPos.x+kContractSize, vTexPos.y+vTexSize.y-kContractSize,0),
						cColor(1)));
	}
예제 #3
0
void cNumericalButton::OnDraw()
{
	if(mbOver && mpPanel->mbMouseIsDown)
		mpDrawer->DrawGfxObject(mpGfxDown,mvPositon,cVector2f(mRect.w,mRect.h),cColor(1,mpPanel->mfAlpha));
	else
		mpDrawer->DrawGfxObject(mpGfxUp,mvPositon,cVector2f(mRect.w,mRect.h),cColor(1,mpPanel->mfAlpha));

	cVector3f vFontPos = mvPositon + cVector3f(mRect.w/2,1,1);

	tWString sChar;
	if(mlNum==-1) sChar =_W("*");
	else if(mlNum==-2) sChar =_W("#");
	else sChar = cString::To16Char(cString::ToString(mlNum));
	
	if(mbOver && mpPanel->mbMouseIsDown)
	{
		mpInit->mpDefaultFont->Draw(vFontPos + cVector3f(1,1,0), 17, cColor(0,0,0,0.9f * mpPanel->mfAlpha),eFontAlign_Center,				
									sChar.c_str());
	}
	else
	{
		mpInit->mpDefaultFont->Draw(vFontPos, 17, cColor(0,0,0,0.9f * mpPanel->mfAlpha),eFontAlign_Center,				
									sChar.c_str());
	}

}
예제 #4
0
	bool cLight2DPoint::UpdateBoundingBox()
	{
		mBoundingBox = cRect2f(cVector2f(GetWorldPosition().x,GetWorldPosition().y)-mfFarAttenuation,
				cVector2f(mfFarAttenuation*2));

		return true;
	}
예제 #5
0
	void cWidgetComboBox::OpenMenu()
	{
		if(mvItems.empty()) return;

		if(mbMenuOpen) return;
		mpSet->SetAttentionWidget(this);
		mbMenuOpen = true;

		mlMouseOverSelection = mlSelectedItem;

		mvSize = cVector2f(mvSize.x, mvSize.y + mfMenuHeight);
		
		if((int)mvItems.size() > mlMaxItems)
		{
			mpSlider->SetEnabled(true);
			mpSlider->SetVisible(true);

			mpSlider->SetPosition(cVector3f(mvSize.x - 20 - mvGfxBorders[1]->GetActiveSize().x, 
											(mvSize.y-mfMenuHeight)+mvGfxBorders[1]->GetActiveSize().y,
											1.2f));
			mpSlider->SetSize(cVector2f(20,mfMenuHeight - mvGfxBorders[1]->GetActiveSize().y -
														mvGfxBorders[2]->GetActiveSize().y));

			mpSlider->SetBarValueSize(mlMaxItems);
			mpSlider->SetMaxValue((int)mvItems.size() - mlMaxItems);

			mpSet->SetFocusedWidget(mpSlider);
		}
		else
		{
			mpSet->SetFocusedWidget(this);
		}

		mbClipsGraphics = true;
	}
예제 #6
0
파일: Widget.cpp 프로젝트: MIFOZ/EFE-Engine
	void iWidget::DrawBordersAndCorners(cGuiGfxElement *a_pBackgorund,
									cGuiGfxElement **a_pBorderVec, cGuiGfxElement **a_pCornerVec,
									const cVector3f &a_vPosition, const cVector2f &a_vSize)
	{
		m_pSet->SetDrawOffset(a_vPosition);

		if(a_pBackgorund)
			m_pSet->DrawGfx(a_pBackgorund, cVector3f(a_pCornerVec[0]->GetActiveSize().x,
													a_pCornerVec[0]->GetActiveSize().y,0),
									a_vSize - a_pCornerVec[2]->GetActiveSize()-a_pCornerVec[0]->GetActiveSize(),
									cColor(1,1));

		// Borders
		//Right
		m_pSet->DrawGfx(a_pCornerVec[0],
			cVector3f(	a_vSize.x - a_pBorderVec[0]->GetActiveSize().x,
			a_pCornerVec[1]->GetActiveSize().y,0),
			cVector2f(	a_pBorderVec[0]->GetImageSize().x,
			a_vSize.y - (a_pCornerVec[2]->GetActiveSize().y +
			a_pCornerVec[1]->GetActiveSize().y)));
		//Left
		m_pSet->DrawGfx(a_pCornerVec[1],
			cVector3f(	0,a_pCornerVec[0]->GetActiveSize().y,0),
			cVector2f(	a_pBorderVec[1]->GetImageSize().x,
			a_vSize.y - (a_pCornerVec[3]->GetActiveSize().y +
			a_pCornerVec[0]->GetActiveSize().y)));

		//Up
		m_pSet->DrawGfx(a_pBorderVec[2],
			cVector3f(	a_pCornerVec[0]->GetActiveSize().x,0,0),
			cVector2f(	a_vSize.x - (a_pCornerVec[0]->GetActiveSize().x+
			a_pCornerVec[1]->GetActiveSize().x),
			a_pBorderVec[2]->GetImageSize().y));

		//Down
		m_pSet->DrawGfx(a_pCornerVec[3],
			cVector3f(	a_pCornerVec[3]->GetActiveSize().x,
			a_vSize.y - a_pBorderVec[3]->GetActiveSize().y,0),
			cVector2f(	a_vSize.x - (a_pCornerVec[2]->GetActiveSize().x+
			a_pCornerVec[3]->GetActiveSize().x),
			a_pBorderVec[3]->GetImageSize().y));

		// Corners
		//Left Up
		m_pSet->DrawGfx(a_pCornerVec[0], cVector3f(0,0,0));
		//Right Up
		m_pSet->DrawGfx(a_pCornerVec[1], cVector3f(	a_vSize.x - a_pCornerVec[1]->GetActiveSize().x,0,0));

		//Right Down
		m_pSet->DrawGfx(a_pCornerVec[2], cVector3f(	a_vSize.x - a_pCornerVec[2]->GetActiveSize().x,
			a_vSize.y - a_pCornerVec[2]->GetActiveSize().y,0));
		//Left Down
		m_pSet->DrawGfx(a_pCornerVec[3], cVector3f(0,a_vSize.y - a_pCornerVec[3]->GetActiveSize().y,0));

		m_pSet->SetDrawOffset(0);
	}
예제 #7
0
void cFadeHandler::OnDraw()
{
	if(mfAlpha !=0)
		mpDrawer->DrawGfxObject(mpBlackGfx,cVector3f(0,0,150),cVector2f(800,600),cColor(1,mfAlpha));

	if(mfWideScreenAlpha != 0)
	{
		mpDrawer->DrawGfxObject(mpBlackGfx,cVector3f(0,0,40),cVector2f(800,75),cColor(1,mfWideScreenAlpha));
		mpDrawer->DrawGfxObject(mpBlackGfx,cVector3f(0,525,40),cVector2f(800,75),cColor(1,mfWideScreenAlpha));
	}
}
예제 #8
0
	void cWidgetComboBox::OnDraw(float a_fTimeStep, cGuiClipRegion *a_pClipRegion)
	{
		if (m_bMenuOpen)
		{
			m_pSet->DrawGfx(m_pGfxBackground,GetGlobalPosition() + cVector3f(0,m_vSize.y-m_fMenuHeight,1),
				cVector2f(m_vSize.x, m_fMenuHeight));

			DrawBordersAndCorners(NULL, m_vGfxBorders, m_vGfxCorners,
				GetGlobalPosition() + cVector3f(0,m_vSize.y-m_fMenuHeight,1.4f),
				cVector2f(m_vSize.x, m_fMenuHeight));
		}
	}
예제 #9
0
void cHOECamera::CalculateCameraPos()
{
    cVector3f vRotated;
    cVector3f vOrigin = mvStartPos;

    cMatrixf mtxRotation = cMath::MatrixMul(cMath::MatrixRotateY(mvAngle.y),cMath::MatrixRotateX(mvAngle.x));

    vRotated = cMath::MatrixMul(mtxRotation, vOrigin);

    mpCamera->SetPosition(vRotated);
    float fYaw = cMath::GetAngleFromPoints2D(cVector2f(vRotated.x,vRotated.z),cVector2f(0));
    mpCamera->SetYaw(-fYaw);
    mpCamera->SetPitch(mvAngle.x);
}
예제 #10
0
	void cWidgetComboBox::OnDraw(float afTimeStep, cGuiClipRegion *apClipRegion)
	{
		if(mbMenuOpen)
		{
			mpSet->DrawGfx(mpGfxBackground,GetGlobalPosition() + cVector3f(0,mvSize.y-mfMenuHeight,1),
							cVector2f(mvSize.x, mfMenuHeight));

			////////////////////////////////
			// Background and borders
			DrawBordersAndCorners(	NULL, mvGfxBorders, mvGfxCorners, 
									GetGlobalPosition() + cVector3f(0,mvSize.y-mfMenuHeight,1.4f),
									cVector2f(mvSize.x, mfMenuHeight));
		}
	}
예제 #11
0
cNumericalPanel::cNumericalPanel(cInit *apInit)  : iUpdateable("NumericalPanel")
{
	mpInit = apInit;
	mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer();

	//Load graphics (use notebook background for now).
	mpGfxBackground = mpDrawer->CreateGfxObject("notebook_background.bmp","diffalpha2d");

	mpGfxPanel = mpDrawer->CreateGfxObject("numpanel_panel.bmp","diffalpha2d");
	
	cVector2f vPos(307, 205);

	for(int i=1; i<=12; ++i)
	{
		int lNum = i;
		if(i==10) lNum=-1;
		else if(i==11)lNum=0;
		else if(i==12) lNum=-2;

		mlstButtons.push_back(hplNew( cNumericalButton, (mpInit,this,vPos,cVector2f(62,30),lNum)) );
        
		if(i%3 ==0)
		{
			vPos.y += (30 + 16);
			vPos.x = 307;
		}
		else
		{
			vPos.x += 62 + 16;
		}
	}

	Reset();
}
예제 #12
0
	bool cArea2D::UpdateBoundingBox()
	{
		mBoundingBox = cRect2f(cVector2f(GetWorldPosition().x-mvSize.x/2,
			GetWorldPosition().y-mvSize.y/2),mvSize);

		return true;
	}
예제 #13
0
	cVector2f cWidgetTextBox::GetBackgroundSize()
	{
		return cVector2f(mvSize.x - mvGfxCorners[0]->GetActiveSize().x - 
										mvGfxCorners[1]->GetActiveSize().x,
						mvSize.y - mvGfxCorners[0]->GetActiveSize().y -
									mvGfxCorners[2]->GetActiveSize().y);
	}
예제 #14
0
void cNumericalPanel::SetActive(bool abX)
{
	if(mbActive == abX) return;

	mbActive = abX;

	if(mbActive)
	{
		if(mpInit->mbHasHaptics)
			mpInit->mpPlayer->GetHapticCamera()->SetActive(false);

		mpInit->mpGame->GetInput()->BecameTriggerd("RightClick");
		mpInit->mpGame->GetInput()->BecameTriggerd("LeftClick");
		

		mLastCrossHairState = mpInit->mpPlayer->GetCrossHairState();

		mpInit->mpPlayer->SetCrossHairPos(mvMousePos);
		mpInit->mpPlayer->SetCrossHairState(eCrossHairState_Pointer);

		mvDigits.clear();
	}
	else
	{
		if(mpInit->mbHasHaptics)
			mpInit->mpPlayer->GetHapticCamera()->SetActive(true);

		mpInit->mpPlayer->SetCrossHairState(mLastCrossHairState);
		mpInit->mpPlayer->SetCrossHairPos(cVector2f(400,300));
	}
}
예제 #15
0
void cPlayerState_Climb::LeaveState(iPlayerState* apNextState)
{
	mpPlayer->SetCrossHairState(eCrossHairState_None);

	mpPlayer->GetCharacterBody()->SetGravityActive(true);
	
	mpPlayer->GetCamera()->SetPitchLimits(mvPrevPitchLimits);
	mpPlayer->GetCamera()->SetYawLimits(cVector2f(0, 0));
}
예제 #16
0
void cCollider2D::SetCollideMesh(cCollisionMesh2D* apMesh, cRect2f& aRect)
{
    apMesh->mvPos[0] = cVector2f(aRect.x,aRect.y);
    apMesh->mvPos[1] = cVector2f(aRect.x +  aRect.w,aRect.y);
    apMesh->mvPos[2] = cVector2f(aRect.x +  aRect.w,aRect.y +  aRect.h);
    apMesh->mvPos[3] = cVector2f(aRect.x,aRect.y + aRect.w);

    apMesh->mvNormal[0] = cVector2f(0,-1);
    apMesh->mvNormal[1] = cVector2f(1,0);
    apMesh->mvNormal[2] = cVector2f(0,1);
    apMesh->mvNormal[3] = cVector2f(-1,0);
}
예제 #17
0
void cNumericalPanel::OnDraw()
{
	if(mfAlpha == 0) return;
	
	mpDrawer->DrawGfxObject(mpGfxBackground,cVector3f(0,0,0),cVector2f(800,600),cColor(1,mfAlpha));

	
	mpDrawer->DrawGfxObject(mpGfxPanel,cVector3f(280,170,10),cVector2f(270,300),cColor(1,mfAlpha));

	////////////////////////////////
	// Update buttons
	tNumericalButtonListIt it = mlstButtons.begin();
	for(; it != mlstButtons.end(); ++it)
	{
		cNumericalButton *pButton = *it;

		pButton->OnDraw();
	}
}
예제 #18
0
void cWidgetListBox::OnChangeSize()
{
    if(mpSlider)
        {
            mpSlider->SetSize(cVector2f(mfSliderWidth,mvSize.y));
            mpSlider->SetPosition(cVector3f(mvSize.x - mfSliderWidth, 0, 0.2f));

            UpdateProperties();
        }
}
예제 #19
0
	cGfxObject::cGfxObject(iMaterial* apMat,const tString& asFile, bool abIsImage)
	{
		mpMat = apMat;

		msSourceFile = asFile;

		mbIsImage = abIsImage;
	
		if(mbIsImage)
		{
			mvVtx = apMat->GetImage(eMaterialTexture_Diffuse)->GetVertexVecCopy(0,-1);
		}
		else
		{
			mvVtx.push_back(cVertex(cVector3f(0,0,0),cVector2f(0,0),cColor(1,1)) );
			mvVtx.push_back(cVertex(cVector3f(1,0,0),cVector2f(1,0),cColor(1,1)) );
			mvVtx.push_back(cVertex(cVector3f(1,1,0),cVector2f(1,1),cColor(1,1)) );
			mvVtx.push_back(cVertex(cVector3f(0,1,0),cVector2f(0,1),cColor(1,1)) );
		}
	}
예제 #20
0
void cDemoEndText::OnPostSceneDraw()
{
	if(mbActive==false) return;
	if(mvTextures.empty()) return;

	mpInit->mpGraphicsHelper->ClearScreen(cColor(0,0));

	mpInit->mpGraphicsHelper->DrawTexture(mvTextures[mlCurrentImage],0,
											cVector2f(800,600),cColor(mfAlpha,1));
	
}
예제 #21
0
	void cWidgetTextBox::OnDraw(float afTimeStep, cGuiClipRegion *apClipRegion)
	{
		////////////////////////////////
		// Text
		cVector3f vTextAdd = cVector3f(3,2,0.2f) + mvGfxCorners[0]->GetActiveSize();
		DrawDefaultText(cString::SubW(msText,mlFirstVisibleChar,mlVisibleCharSize),
						GetGlobalPosition()+ vTextAdd,
						eFontAlign_Left);

		//Marker
		if(mlMarkerCharPos >=0)
		{
			float fMarkerPos = CharToLocalPos(mlMarkerCharPos);
			mpSet->DrawGfx(	mpGfxMarker,GetGlobalPosition() + vTextAdd + cVector3f(fMarkerPos,0,0.1f),
							cVector2f(2, mvDefaultFontSize.y));

			//Selected text
			if(mlSelectedTextEnd >=0)
			{
				float fSelectEnd = CharToLocalPos(mlSelectedTextEnd);

				float fPos = fSelectEnd < fMarkerPos ? fSelectEnd : fMarkerPos;
				float fEnd = fSelectEnd > fMarkerPos ? fSelectEnd : fMarkerPos;
				
				if(fPos <0)fPos =0;
				if(fEnd > mfTextMaxSize) fEnd = mfTextMaxSize;
				
				float fSize = fEnd - fPos;

				mpSet->DrawGfx( mpGfxSelectedTextBack, GetGlobalPosition() + 
								vTextAdd + cVector3f(fPos,0,0.2f),
								cVector2f(fSize,mvDefaultFontSize.y));
			}
		}

		
		////////////////////////////////
		// Background and Borders
		DrawBordersAndCorners(	mpGfxBackground, mvGfxBorders, mvGfxCorners, 
								GetGlobalPosition(), mvSize);
	}
예제 #22
0
	void cWidgetComboBox::OnChangeSize()
	{
		if(mpText && mpButton && mpSlider)
		{
			mpText->SetSize(mvSize);
			mvSize = mpText->GetSize();	

			cVector2f vBackSize = mpText->GetBackgroundSize();
			
			mpButton->SetSize(cVector2f(mfButtonWidth,vBackSize.y));
			mpButton->SetPosition(cVector3f( mvSize.x - (mvSize.x - vBackSize.x)/2 - mfButtonWidth,
											(mvSize.y - vBackSize.y)/2, 0.3f));

			mpSlider->SetBarValueSize(mlMaxItems);
			mpSlider->SetMaxValue((int)mvItems.size() - mlMaxItems);
		}
	}
예제 #23
0
bool cPlayerState_UseItem::OnAddPitch(float afVal)
{
	cInput *pInput = mpInit->mpGame->GetInput();
	
				// TODO: Fix this! -- Ricky26
	/*if(pInput->IsTriggerd("LookMode"))
	{
		float fInvert = mpInit->mpButtonHandler->GetInvertMouseY() ? -1.0f : 1.0f;
		mpPlayer->GetCamera()->AddPitch( -afVal *2.0f*fInvert * mpPlayer->GetLookSpeed());
	}
	else*/ if(mpPlayer->AddCrossHairPos(cVector2f(0,afVal * 600.0f)))
	{
		mpPlayer->GetCamera()->AddPitch( -afVal * mpPlayer->GetLookSpeed());
	}

	return false;
}
예제 #24
0
bool cPlayerState_UseItem::OnAddYaw(float afVal)
{ 
	cInput *pInput = mpInit->mpGame->GetInput();
	
				// TODO: Fix this! -- Ricky26
	/*if(pInput->IsTriggerd("LookMode"))
	{
		mpPlayer->GetCamera()->AddYaw( -afVal * 2.0f * mpPlayer->GetLookSpeed());
		mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
	}
	else */if(mpPlayer->AddCrossHairPos(cVector2f(afVal * 800.0f,0)))
	{
		mpPlayer->GetCamera()->AddYaw( -afVal * mpPlayer->GetLookSpeed());
		mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
	}

	return false;
}
예제 #25
0
bool cWidgetListBox::DrawText(iWidget* apWidget,cGuiMessageData& aData)
{
    cVector3f vPosition = GetGlobalPosition() + cVector3f(3,2,0);
    for(int i=mlFirstItem; i < (int)mvItems.size(); ++i)
        {
            if(i-mlFirstItem > mlMaxItems) break;

            if(i == mlSelectedItem)
                {
                    mpSet->DrawGfx(	mpGfxSelection,vPosition  - cVector3f(3,0,0),
                                    cVector2f(mvSize.x,mvDefaultFontSize.y));
                }

            DrawDefaultText(mvItems[i],vPosition,eFontAlign_Left);
            vPosition.y += mvDefaultFontSize.y +2;
        }

    return true;
}
예제 #26
0
bool cPlayerState_InteractMode::OnAddYaw(float afVal)
{
	cInput *pInput = mpInit->mpGame->GetInput();

	// TODO: Fix this shizz! -- Ricky26
	/*if(pInput->IsTriggerd("LookMode"))
	{
		mpPlayer->GetCamera()->AddYaw( -afVal * 2.0f * mpPlayer->GetLookSpeed());
		mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
	}
	else*/
	{
		if(mpPlayer->AddCrossHairPos(cVector2f(afVal * 800.0f,0)))
		{
			mpPlayer->GetCamera()->AddYaw( -afVal * mpPlayer->GetLookSpeed());
			mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
		}
		
		cVector2f vBorder = mpPlayer->GetInteractMoveBorder();
		cVector2f vPos = mpPlayer->GetCrossHairPos();
		
		if(vPos.x < vBorder.x + mfRange || vPos.x > (799 - vBorder.x - mfRange))
		{
			float fDist;
			if(vPos.x < vBorder.x + mfRange)
			{
				fDist = (vPos.x - vBorder.x);
				mvLookSpeed.x = 1 - (fDist / mfRange) * 1;
			}
			else 
			{
				fDist = ((799 - vBorder.x) - vPos.x);
				mvLookSpeed.x = (1-(fDist / mfRange)) * -1;
			}
		}
		else
		{
			mvLookSpeed.x =0;
		}
	}

	return false;
}
예제 #27
0
bool cPlayerState_InteractMode::OnAddPitch(float afVal)
{
	cInput *pInput = mpInit->mpGame->GetInput();
	
				// TODO: Fix this! -- Ricky26
/*	if(pInput->IsTriggerd("LookMode"))
	{
		float fInvert = mpInit->mpButtonHandler->GetInvertMouseY() ? -1.0f : 1.0f;
		mpPlayer->GetCamera()->AddPitch( -afVal *2.0f*fInvert * mpPlayer->GetLookSpeed());
	}
	else*/
	{
		if(mpPlayer->AddCrossHairPos(cVector2f(0,afVal * 600.0f)))
		{
			mpPlayer->GetCamera()->AddPitch( -afVal * mpPlayer->GetLookSpeed());
		}

		cVector2f vBorder = mpPlayer->GetInteractMoveBorder();
		cVector2f vPos = mpPlayer->GetCrossHairPos();
		
		if(vPos.y < vBorder.y + mfRange || vPos.y > (599 - vBorder.y - mfRange))
		{
			float fDist;
			if(vPos.y < vBorder.y + mfRange)
			{
				fDist = (vPos.y - vBorder.y);
				mvLookSpeed.y = 1 - (fDist / mfRange) * 1;
			}
			else 
			{
				fDist = ((599 - vBorder.y) - vPos.y);
				mvLookSpeed.y = (1-(fDist / mfRange)) * -1;
			}
		}
		else
		{
			mvLookSpeed.y =0;
		}
	}

	return false;
}
예제 #28
0
	tVertexVec cResourceImage::GetVertexVecCopy(const cVector2f &avPos, const cVector2f &avSize)
	{
		tVertexVec vTmpVtx = mvVtx;

		if(avSize == cVector2f(-1,-1)) {
			vTmpVtx[1].pos.x = mvVtx[0].pos.x + mRect.w;
			vTmpVtx[2].pos.x = mvVtx[0].pos.x + mRect.w;
			vTmpVtx[2].pos.y = mvVtx[0].pos.y + mRect.h;
			vTmpVtx[3].pos.y = mvVtx[0].pos.y + mRect.h;
		}
		else {
			vTmpVtx[1].pos.x = mvVtx[0].pos.x + avSize.x;
			vTmpVtx[2].pos.x = mvVtx[0].pos.x + avSize.x;
			vTmpVtx[2].pos.y = mvVtx[0].pos.y + avSize.y;
			vTmpVtx[3].pos.y = mvVtx[0].pos.y + avSize.y;
		}

		for(int i=0;i<4;i++)
			vTmpVtx[i].pos+=avPos;

		return vTmpVtx;
	}
예제 #29
0
	bool cWidgetComboBox::DrawText(iWidget* apWidget,cGuiMessageData& aData)
	{
		if(mbMenuOpen==false) return false;

		cVector3f vPos = GetGlobalPosition() + 
			cVector3f(mvGfxBorders[0]->GetActiveSize().x+3,mpText->GetSize().y+2,1.2f);
		
		for(int i=mlFirstItem; i<(int)mvItems.size(); ++i)
		{
			if(i-mlFirstItem >= mlMaxItems) break;

			if(i == mlMouseOverSelection)
			{
				mpSet->DrawGfx(mpGfxSelection,vPos - cVector3f(3,0,0),
								cVector2f(mvSize.x,mvDefaultFontSize.y));
			}

			DrawDefaultText(mvItems[i],vPos,eFontAlign_Left);
			vPos.y += mvDefaultFontSize.y +2;
		}

		return true;
	}
예제 #30
0
	cVector2f iWidget::GetPosRelativeToMouse(cGuiMessageData &aData)
	{
		cVector3f vTemp = GetGlobalPosition() - aData.mvPos;
		return cVector2f(vTemp.x, vTemp.y);
	}