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());
	}

}
Esempio n. 2
0
void cCredits::OnDraw()
{
	float fSize[2] = {17,19};
	float fY = mfYPos;
	for(size_t i=0; i< mvTextRows.size(); ++i)
	{
		int lSize =0;
		if(mvTextRows[i][0] == _W('*'))
		{
			lSize=1;
		}
		if(mvTextRows[i].size()<=1)
		{
			fY += fSize[lSize];
		}

		if(fY >= -fSize[lSize])
		{
			if(fY > 600) continue;

			float fAlpha = fY/300;
			if(fAlpha > 1) fAlpha = (2 - fAlpha);
			
			if(lSize==0)
				mpFont->Draw(cVector3f(400,fY,10),fSize[lSize],cColor(1,fAlpha),eFontAlign_Center,
							mvTextRows[i].c_str());
			else
				mpFont->Draw(cVector3f(400,fY,10),fSize[lSize],cColor(0.8f,fAlpha),eFontAlign_Center,
							mvTextRows[i].substr(1).c_str());
		}
		fY += fSize[lSize];
	}
}
Esempio n. 3
0
void cPreMenu::OnPostSceneDraw()
{
	mpInit->mpGraphicsHelper->ClearScreen(cColor(0,0));
	
	if(mlState == 1 || mlState ==2)
	{
		mpInit->mpGraphicsHelper->DrawTexture(mvTextures[mlCurrentLogo],cVector3f(0,0,-10),cVector3f(800,600,0),
												cColor(mfAlpha,1));
	}
	if (mlState == 4)
	{
		mpInit->mpGraphicsHelper->DrawTexture(mpLogoTexture,cVector3f(400,300,-10)-(mvecLogoSize/2),mvecLogoSize, cColor(mfLogoFade,1));
		mpInit->mpGraphicsHelper->DrawTexture(mpEpTexture,cVector3f(276,440,-10), cVector3f(248,46,0), cColor(mfEpFade,1));
		if (mbFlash)
			mpInit->mpGame->GetGraphics()->GetDrawer()->DrawGfxObject( mpFlashGfx, cVector3f(0,0,10), cVector2f(800,600), cColor(1,0.9f));
	}

	if (mlState == 1 || mlState == 2 || mlState == 4)
	{
		for ( int i =0; i< (int)mvRaindropVector.size(); ++i )
		{
			cRaindrop* pRaindrop = &(mvRaindropVector[i]);
			if (pRaindrop->fColor >= 0)
			{
				mpInit->mpGame->GetGraphics()->GetDrawer()->DrawGfxObject( pRaindrop->mpGfx, cVector3f(pRaindrop->vPos) + cVector3f(0,0,5), cVector2f(20,6*pRaindrop->fLength), cColor(pRaindrop->fColor,1),false,false);//, -0.2f - 1.5f*pRaindrop->fAngle );
				//mpInit->mpGame->GetGraphics()->GetLowLevel()->DrawLine2D(pRaindrop->vPos, pRaindrop->vPos+(pRaindrop->vDir*pRaindrop->fLength),0,cColor(pRaindrop->fColor,pRaindrop->fColor));
			}
		}
	}

}
	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)));
	}
Esempio n. 5
0
	cColor cVertexBufferOGL::GetColor(tVertexFlag aType, unsigned alIdx)
	{
		if(!(aType & mVertexFlags)) return cColor();

		int idx = cMath::Log2ToInt((int)aType);
		int pos = alIdx * kvVertexElements[idx];

		return cColor(mvVertexArray[idx][pos+0],mvVertexArray[idx][pos+1],
			mvVertexArray[idx][pos+2],mvVertexArray[idx][pos+3]);
	}
Esempio n. 6
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));
	}
}
Esempio n. 7
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));
	
}
Esempio n. 8
0
	void cFrustum::Draw(iLowLevelGraphics *apLowLevelGraphics)
	{
		apLowLevelGraphics->DrawLine(mvOrigin, mvEndPoints[0],cColor(1,1,1,1));
		apLowLevelGraphics->DrawLine(mvOrigin, mvEndPoints[1],cColor(1,1,1,1));
		apLowLevelGraphics->DrawLine(mvOrigin, mvEndPoints[2],cColor(1,1,1,1));
		apLowLevelGraphics->DrawLine(mvOrigin, mvEndPoints[3],cColor(1,1,1,1));

		apLowLevelGraphics->DrawLine(mvEndPoints[0], mvEndPoints[1],cColor(1,1,1,1));
		apLowLevelGraphics->DrawLine(mvEndPoints[1], mvEndPoints[2],cColor(1,1,1,1));
		apLowLevelGraphics->DrawLine(mvEndPoints[2], mvEndPoints[3],cColor(1,1,1,1));
		apLowLevelGraphics->DrawLine(mvEndPoints[3], mvEndPoints[0],cColor(1,1,1,1));

		apLowLevelGraphics->DrawLine(mvEndPoints[0], mvEndPoints[2],cColor(1,1,1,1));
		apLowLevelGraphics->DrawLine(mvEndPoints[1], mvEndPoints[3],cColor(1,1,1,1));
	}
Esempio n. 9
0
	void cFrustum::Draw(iLowLevelGraphics *a_pLowLevelGraphics)
	{
		a_pLowLevelGraphics->DrawLine(m_vOrigin, m_vEndPoints[0], cColor(1,1,1,1));
		a_pLowLevelGraphics->DrawLine(m_vOrigin, m_vEndPoints[1], cColor(1,1,1,1));
		a_pLowLevelGraphics->DrawLine(m_vOrigin, m_vEndPoints[2], cColor(1,1,1,1));
		a_pLowLevelGraphics->DrawLine(m_vOrigin, m_vEndPoints[3], cColor(1,1,1,1));

		a_pLowLevelGraphics->DrawLine(m_vEndPoints[0], m_vEndPoints[1], cColor(1,0,0,1));
		a_pLowLevelGraphics->DrawLine(m_vEndPoints[1], m_vEndPoints[2], cColor(1,0,0,1));
		a_pLowLevelGraphics->DrawLine(m_vEndPoints[2], m_vEndPoints[3], cColor(1,0,0,1));
		a_pLowLevelGraphics->DrawLine(m_vEndPoints[3], m_vEndPoints[0], cColor(1,0,0,1));

		a_pLowLevelGraphics->DrawLine(m_vEndPoints[0], m_vEndPoints[2], cColor(0,1,0,1));
		a_pLowLevelGraphics->DrawLine(m_vEndPoints[1], m_vEndPoints[3], cColor(0,1,0,1));
	}
Esempio n. 10
0
	cWorld3D::cWorld3D(tString asName,cGraphics *apGraphics,cResources *apResources,cSound* apSound,
						cPhysics *apPhysics, cScene *apScene,cSystem *apSystem, cAI *apAI,
						cHaptic *apHaptic)
	{
		mpGraphics = apGraphics;
		mpResources = apResources;
		mpSound = apSound;
		mpPhysics = apPhysics;
		mpScene = apScene;
		mpSystem =apSystem;
		mpAI = apAI;
		mpHaptic = apHaptic;

		mpRootNode = hplNew( cNode3D, () );

		mpScript = NULL;

		msName=asName;

		mAmbientColor=cColor(0,0);

		mpPortalContainer = hplNew( cPortalContainer, () );

		mpPhysicsWorld = NULL;
		mbAutoDeletePhysicsWorld = false;

		msFileName = "";
	}
void CPFA_qt_user_functions::DrawOnRobot(CFootBotEntity& entity) {
	CPFA_controller& c = dynamic_cast<CPFA_controller&>(entity.GetControllableEntity().GetController());

	if(c.IsHoldingFood() == true) {
		DrawCylinder(CVector3(0.0, 0.0, 0.3), CQuaternion(), loopFunctions.FoodRadius, 0.025, CColor::BLACK);
	}

	if(loopFunctions.DrawIDs == 1) {
		/* Disable lighting, so it does not interfere with the chosen text color */
		glDisable(GL_LIGHTING);
		/* Disable face culling to be sure the text is visible from anywhere */
		glDisable(GL_CULL_FACE);
		/* Set the text color */
		CColor cColor(CColor::BLACK);
		glColor3ub(cColor.GetRed(), cColor.GetGreen(), cColor.GetBlue());

		/* The position of the text is expressed wrt the reference point of the footbot
		 * For a foot-bot, the reference point is the center of its base.
		 * See also the description in
		 * $ argos3 -q foot-bot
		 */
		
		// Disable for now
		//GetOpenGLWidget().renderText(0.0, 0.0, 0.5,             // position
		//			     entity.GetId().c_str()); // text
		
		/* Restore face culling */
		glEnable(GL_CULL_FACE);
		/* Restore lighting */
		glEnable(GL_LIGHTING);
	}
}
	void cGLState_Diffuse::Bind()
	{
		mpLowGfx->SetActiveTextureUnit(0);
		mpLowGfx->SetTextureEnv(eTextureParam_ColorFunc,eTextureFunc_Dot3RGBA);
		mpLowGfx->SetTextureEnv(eTextureParam_ColorSource1,eTextureSource_Constant);
		mpLowGfx->SetTextureConstantColor(cColor(0.5f,0.5f,1,0));
	}
Esempio n. 13
0
	void iLight3D::OnSetDiffuse()
	{
		for(size_t i =0; i<mvBillboards.size(); ++i)
		{
			cBillboard *pBill = mvBillboards[i];
			pBill->SetColor(cColor(mDiffuseColor.r,mDiffuseColor.g,mDiffuseColor.b,1));
		}
	}
Esempio n. 14
0
	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);
	}
Esempio n. 15
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();
	}
}
Esempio n. 16
0
	cWidgetFrame::cWidgetFrame(cGuiSet *apSet, cGuiSkin *apSkin) : iWidget(eWidgetType_Frame,apSet, apSkin)
	{
		mbClipsGraphics = true;

		mbDrawFrame = false;

		mbDrawBackground = false;
		mfBackgroundZ = -0.5;
		mBackGroundColor = cColor(1,1);
	}
Esempio n. 17
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)) );
		}
	}
Esempio n. 18
0
	cFrameBitmap::cFrameBitmap(iBitmap2D *a_pBitmap, cFrameTexture *a_pFrmTex, int a_lHandle)
	{
		m_pBitmap = a_pBitmap;
		m_pFrameTexture = a_pFrmTex;
		m_pBitmap->FillRect(cRectl(0,0,0,0),cColor(1,1));
		m_lMinHole = 6;
		m_lHandle = a_lHandle;
		m_bIsFull = false;
		m_bIsLocked = false;

		m_Rects.Insert(cFBitmapRect(0,0,m_pBitmap->GetWidth(),m_pBitmap->GetHeight(),-1));
	}
Esempio n. 19
0
	cSector::cSector(tString asId,cPortalContainer *apContainer)
	{
		msId = asId;

		mpContainer = apContainer;

		mBV.SetPosition(0);
		mBV.SetLocalMinMax(cVector3f(100000, 100000, 100000),cVector3f(-100000, -100000, -100000));

		mlVisitCount =-1;

		mAmbient = cColor(1,1);
	}
Esempio n. 20
0
	cFrameBitmap::cFrameBitmap(iBitmap2D *apBitmap,  cFrameTexture *apFrmTex, int alHandle) : iFrameBase()
	{
		mpBitmap = apBitmap;
		mpFrameTexture = apFrmTex;
		mpBitmap->FillRect(cRect2l(0,0,0,0), cColor(1,1));
		mlMinHole = 6;
		mlHandle = alHandle;
		mbIsFull = false;
		mbIsLocked = false;

		//Root node in rect tree
		mRects.Insert(cFBitmapRect(0,0,mpBitmap->GetWidth(), mpBitmap->GetHeight(),-1));
	}
void cGameMessage::Draw(iFontData *apFont)
{
	if(mbActive == false) return;
	
	float fSide=30;
	if(mpMessHandler->mbBlackText)
	{
		apFont->DrawWordWrap(cVector3f(fSide, 300,152),800 - fSide*2,16,14,cColor(0,mfFade),
			eFontAlign_Left,msText);
	}
	else
	{
		apFont->DrawWordWrap(cVector3f(fSide, 300,152),800 - fSide*2,16,14,cColor(1,1,1,mfFade),
							eFontAlign_Left,msText);
		apFont->DrawWordWrap(cVector3f(fSide, 300,151) + cVector3f(1,1,-1),800 - fSide*2,16,14,cColor(0,0,0,mfFade),
							eFontAlign_Left,msText);
		apFont->DrawWordWrap(cVector3f(fSide, 300,151) + cVector3f(-1,-1,-1),800 - fSide*2,16,14,cColor(0,0,0,mfFade),
							eFontAlign_Left,msText);
		apFont->DrawWordWrap(cVector3f(fSide, 300,151) + cVector3f(1,-1,-1),800 - fSide*2,16,14,cColor(0,0,0,mfFade),
							eFontAlign_Left,msText);
		apFont->DrawWordWrap(cVector3f(fSide, 300,151) + cVector3f(-1,1,-1),800 - fSide*2,16,14,cColor(0,0,0,mfFade),
							eFontAlign_Left,msText);
	}
}
Esempio n. 22
0
	void cBoundingVolume::DrawEdges(const cVector3f& avLightPos,float afLightRange, iLowLevelGraphics *apLowLevelGraphics)
	{
		cShadowVolumeBV *pVolume = GetShadowVolume(avLightPos, afLightRange, false);
		
		apLowLevelGraphics->SetBlendActive(true);
		apLowLevelGraphics->SetBlendFunc(eBlendFunc_One,eBlendFunc_One);
		apLowLevelGraphics->SetDepthWriteActive(false);
		tVertexVec vVtx;
		vVtx.resize(4);
		
		for(int capplane=0; capplane<mShadowVolume.mlCapPlanes; capplane++)
		{
			mShadowVolume.mvPlanes[capplane].CalcNormal();
			apLowLevelGraphics->DrawLine(GetWorldCenter(),GetWorldCenter() + 
									mShadowVolume.mvPlanes[capplane].normal*-0.5f, cColor(1,1,1,1));
		}

		int lPlane = mShadowVolume.mlCapPlanes;
		for(int quad = 0; quad < (int)pVolume->mvPoints.size(); quad+=4)
		{
			
			for(int i=0; i<4; i++)
				vVtx[i].pos = pVolume->mvPoints[quad+i];
			
			apLowLevelGraphics->DrawQuad(vVtx,cColor(0.2f,0,0.2f));

			cVector3f vCenter = (vVtx[1].pos + vVtx[0].pos)*0.5f;
			mShadowVolume.mvPlanes[lPlane].CalcNormal();
			apLowLevelGraphics->DrawLine(vCenter,vCenter + 
				mShadowVolume.mvPlanes[lPlane].normal*-0.5f, cColor(1,1,1,1));
			lPlane++;
		}

		apLowLevelGraphics->SetBlendActive(false);
		apLowLevelGraphics->SetDepthWriteActive(true);
	}
Esempio n. 23
0
void cPreMenu::OnDraw()
{
	//////////////////////////////////
	// STATE 1 (TEXT)
	if(mlState == 0 || mlState == 3 || mlState == 5)
	{
		int lPrevStart=0;
		int lCharCount =0;
		for(size_t i=0; i < mvTextRows.size(); ++i)
		{
			lPrevStart = lCharCount;
			lCharCount += (int)mvTextRows[i].length();
			if(lCharCount >= mlCurrentTextChar)
			{
				tWString sText = mvTextRows[i].substr(0,mlCurrentTextChar - lPrevStart);
				mpTextFont->Draw(cVector3f(25,90+19*(float)i,10)+mvecLastTextPos,17+mfLastTextSize,cColor(mfLastTextColor,mfFontColor,mfFontColor,1),//cColor(0.7f,1,0.7f,1),
									eFontAlign_Left,sText.c_str());
				if (mlState == 5)
				{
					// First pair of shadow texts
					mpTextFont->Draw(cVector3f(25 + mfLastTextSpeed1,90+19*(float)i,0)+mvecLastTextPos,17+(mfLastTextSize),cColor(mfLastTextColor+0.5f,0,0,0.25f),//cColor(0.7f,1,0.7f,1),
									eFontAlign_Left,sText.c_str());
					mpTextFont->Draw(cVector3f(25 + 1.5f*mfLastTextSpeed1,90+19*(float)i,0)+mvecLastTextPos,17+(mfLastTextSize),cColor(mfLastTextColor+0.5f,0,0,0.20f),//cColor(0.7f,1,0.7f,1),
									eFontAlign_Left,sText.c_str());
					// Second pair
					mpTextFont->Draw(cVector3f(25 + 3*mfLastTextSpeed1,90+19*(float)i,0)+mvecLastTextPos,17+(mfLastTextSize),cColor(mfLastTextColor+0.25f,0,0,0.15f),//cColor(0.7f,1,0.7f,1),
									eFontAlign_Left,sText.c_str());
					mpTextFont->Draw(cVector3f(25 + 5*mfLastTextSpeed1,90+19*(float)i,0)+mvecLastTextPos,17+(mfLastTextSize),cColor(mfLastTextColor+0.25f,0,0,0.1f),//cColor(0.7f,1,0.7f,1),
									eFontAlign_Left,sText.c_str());
					
					//mpTextFont->Draw(cVector3f(25-mfLastTextPos,90+19*(float)i-mfLastTextPos,0),cVector2f(17,17+(mfLastTextSize)),cColor(mfLastTextColor,mfFontColor,mfFontColor,0.25f),//cColor(0.7f,1,0.7f,1),
					//				eFontAlign_Left,sText.c_str());
				}
								
				break;
			}
			else
			{
				mpTextFont->Draw(cVector3f(25,90+19*(float)i,10),17,cColor(mfFontColor,mfFontColor),//cColor(0.7f,1,0.7f,1),
								eFontAlign_Left,mvTextRows[i].c_str());
			}
		}
	}
}
Esempio n. 24
0
void SGTransformManip::draw(int manipIndex, bool hideMode ) {
	double manipSize = SGMatrix::getManipSizeFromWorldPoint( intersector.center, SGMatrix::getCamMatrix() );
	double centerSize = intersector.centerSize / manipSize;

	GLushort linePattern = 0x5555;

	MColor xColor(1, 0, 0); MColor yColor(0, 1, 0); MColor zColor(0, 0, 1); MColor cColor(100/255.0f, 220/255.0f, 255/255.0f);

	if (intersectType == SGTransformManipIntersector::kCenter)
		cColor = MColor(1, 1, 0);
	else if (intersectType == SGTransformManipIntersector::kX)
		xColor = MColor(1, 1, 0);
	else if (intersectType == SGTransformManipIntersector::kY)
		yColor = MColor(1, 1, 0);
	else if (intersectType == SGTransformManipIntersector::kZ)
		zColor = MColor(1, 1, 0);

	MVector camX = SGMatrix::getCamVector(0).normal() * centerSize;
	MVector camY = SGMatrix::getCamVector(1).normal() * centerSize;
	MPointArray centerManipPoints; centerManipPoints.setLength(5);

	centerManipPoints[0] =  camX + camY + intersector.center;
	centerManipPoints[1] = -camX + camY + intersector.center;
	centerManipPoints[2] = -camX - camY + intersector.center;
	centerManipPoints[3] =  camX - camY + intersector.center;
	centerManipPoints[4] = centerManipPoints[0];

	MPointArray xLine, yLine, zLine;
	xLine.setLength(2);yLine.setLength(2);zLine.setLength(2);

	xLine[0] = intersector.center; xLine[1] = intersector.axisX + xLine[0];
	yLine[0] = intersector.center; yLine[1] = intersector.axisY + yLine[0];
	zLine[0] = intersector.center; zLine[1] = intersector.axisZ + zLine[0];

	manip->pushLine(manipIndex, xLine, xColor, 1, &linePattern);
	manip->pushLine(manipIndex, yLine, yColor, 1, &linePattern);
	manip->pushLine(manipIndex, zLine, zColor, 1, &linePattern);
	if (!hideMode) {
		manip->pushShape(manipIndex, cone.shape, intersector.coneXMatrix, xColor);
		manip->pushShape(manipIndex, cone.shape, intersector.coneYMatrix, yColor);
		manip->pushShape(manipIndex, cone.shape, intersector.coneZMatrix, zColor);
		manip->pushLine(manipIndex, centerManipPoints, cColor, 1, &linePattern);
	}
}
int BuzzSetLEDsFb(buzzvm_t vm) {
   buzzvm_lnum_assert(vm, 3);
   /* Push the color components */
   buzzvm_lload(vm, 1);
   buzzvm_lload(vm, 2);
   buzzvm_lload(vm, 3);
   buzzvm_type_assert(vm, 3, BUZZTYPE_INT);
   buzzvm_type_assert(vm, 2, BUZZTYPE_INT);
   buzzvm_type_assert(vm, 1, BUZZTYPE_INT);
   /* Create a new color with that */
   CColor cColor(buzzvm_stack_at(vm, 3)->i.value,
                 buzzvm_stack_at(vm, 2)->i.value,
                 buzzvm_stack_at(vm, 1)->i.value);
   /* Get pointer to the controller */
   buzzvm_pushs(vm, buzzvm_string_register(vm, "controller", 1));
   buzzvm_gload(vm);
   /* Call function */
   reinterpret_cast<CBuzzControllerEFootBot*>(buzzvm_stack_at(vm, 1)->u.value)->SetLEDs(cColor);
   return buzzvm_ret0(vm);
}
Esempio n. 26
0
void CBuzzQT::Draw(CBuzzController& c_contr) {
   /* This is the message that will be shown */
   std::string strMsg("R" + ToString(c_contr.GetBuzzVM()->robot));
   /* Append debug message */
   if(c_contr.GetDebugMsg() != "")
      strMsg += ": " + c_contr.GetDebugMsg();
   /* Disable face culling to be sure the text is visible from anywhere */
   glDisable(GL_CULL_FACE);
   /* Disable lighting, so it does not interfere with the chosen text color */
   glDisable(GL_LIGHTING);
   /* Set the text color */
   CColor cColor(CColor::BLACK);
   glColor3ub(cColor.GetRed(), cColor.GetGreen(), cColor.GetBlue());
   /* The position of the text is expressed wrt the reference point of
    * the robot */
   GetOpenGLWidget().renderText(0.0, 0.0, 0.4,   // position
                                strMsg.c_str()); // text
   /* Restore lighting */
   glEnable(GL_LIGHTING);
   /* Restore face culling */
   glEnable(GL_CULL_FACE);
}
Esempio n. 27
0
void cEffectLightFlash::Update(float afTimeStep)
{
	cColor Col = mpLight->GetDiffuseColor();
	//Log("Update...\n");
	if(mbIsDying==false)
	{
		if(mpLight->IsFading()==false)
		{
			//Log("Fade to black\n");
			mpLight->FadeTo(cColor(0,0),mfRadius,mfNegTime);
			mbIsDying = true;
		}
	}
	else
	{
		if(mpLight->IsFading()==false)
		{
			//Log("Kill\n");
			mbDead = true;
		}
	}
}
Esempio n. 28
0
	//TODO: Z might have to be some standard value...
	//Has 100 right now, this should be in some global value..
	int cLight2DPoint::Render(iLowLevelGraphics* apLowLevel, int alFirstIndex)
	{
		//make the center vetrex:
		cVector3f vTex(0);
		cVector3f vPos;
		cVector3f vLightPos = GetWorldPosition();
		vLightPos.z = 100;
		float fRadius = GetFarAttenuation();

		cColor Col = GetDiffuseColor()*mfIntensity;
		Col.a =0;
		cVertex Vtx = cVertex(vLightPos,vTex,Col);
		apLowLevel->AddVertexToBatch(&Vtx); //index 0!

		Col = cColor(0,0);
		int idx=alFirstIndex+1;
		for(float fAngle=0;fAngle<=k2Pif;fAngle+=k2Pif/32)
		{
			vPos.x = vLightPos.x + fRadius * cos(fAngle);//*0.5;
			vPos.y = vLightPos.y + fRadius * sin(fAngle);//*0.5;
			vPos.z = 100;
			Vtx = cVertex(vPos,vTex,Col);
			apLowLevel->AddVertexToBatch(&Vtx);
			if(idx>0) {
				apLowLevel->AddIndexToBatch(alFirstIndex);     //The center
				apLowLevel->AddIndexToBatch(idx);   //The current point
				apLowLevel->AddIndexToBatch(idx-1); //The previous  point
			}
			idx++;
		}
		apLowLevel->AddIndexToBatch(alFirstIndex);     //The center
		apLowLevel->AddIndexToBatch(alFirstIndex+1);     //The current point
		apLowLevel->AddIndexToBatch(idx-1); //The previous  point

		return idx;
	}
Esempio n. 29
0
cEffectLightFlash::cEffectLightFlash(cInit *apInit,const cVector3f& avPos,
									float afRadius, const cColor &aColor, 
									float afAddTime, float afNegTime)
{
	mpInit = apInit;

	cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();

	mpLight = pWorld->CreateLightPoint("Flash");
	mpLight->SetFarAttenuation(afRadius);
	mpLight->SetDiffuseColor(cColor(0,0));
	mpLight->SetCastShadows(true);
	mpLight->SetIsSaved(false);
	mpLight->SetPosition(avPos);

	mfRadius = afRadius;
	mfNegTime = afNegTime;
	
	//Log("Fade to %s : %f in time %f\n",aColor.ToString().c_str(),mfRadius,afAddTime);
	mpLight->FadeTo(aColor,mfRadius,afAddTime);

	mbIsDying = false;
	mbDead = false;
}
Esempio n. 30
0
void cCredits::OnPostSceneDraw()
{
	mpInit->mpGraphicsHelper->ClearScreen(cColor(0,0));
	
}