Example #1
0
void TitleScreen::Draw()
{
	GHScreen::Draw();

	MFView_Push();

	MFRect rect;
	rect.x = (MFDisplay_GetAspectRatio() >= 1.5) ? -106.0f : 0.0f;
	rect.y = 0.0f;
	rect.width = (MFDisplay_GetAspectRatio() >= 1.5) ? 852.0f : 640.0f;
	rect.height = 480.0f;
	MFView_SetOrtho(&rect);

	MFPrimitive_DrawUntexturedQuad(20, 20, 640-40, 480-40, MakeVector(0,0,0,0.8f));

	CenterText(30, 34, MFVector::yellow, "Main Menu", pHeading);

	float height = TEXT_HEIGHT;
	float y = 90-height;
	float x = 55.0f;

//	MFFont_DrawText(pText, , y+=height, 20, MFVector::white, "H - Enter help screen");

//	CenterText(rect.height - 20 - 54, 44, MFVector::red, "Press ESC to continue", pFancy);

	MFView_Pop();
}
Example #2
0
void Game_Draw(void *pUserData)
{
	// set projection
	MFView_SetAspectRatio(MFDisplay_GetAspectRatio());
	MFView_SetProjection();

	// render the mesh
	MFRenderer_AddModel(pModel, NULL, MFView_GetViewState());
}
Example #3
0
void Game_Draw()
{
	// render the prism
	MFView_SetAspectRatio(1.f);
	MFView_SetProjection();

	MFRenderLayer *pLayer = MFRenderer_GetLayer(pRenderer, 0);
	MFRenderLayer_AddVertices(pLayer, pPrismMeshStateBlock, 0, 3*12, MFPT_TriangleList, MFMaterial_GetStockMaterial(MFMat_White), pPrismStateBlock, NULL, MFView_GetViewState());

	// render the box
	MFView_SetAspectRatio(MFDisplay_GetAspectRatio());
	MFView_SetProjection();

	pLayer = MFRenderer_GetLayer(pRenderer, 1);
	MFRenderLayer_AddVertices(pLayer, pBoxMeshStateBlock, 0, 3*12, MFPT_TriangleList, pPrismRenderTarget, pBoxStateBlock, NULL, MFView_GetViewState());
}
Example #4
0
void Game_Draw(void *pUserData)
{
	if(!bShowModel)
	{
		MFView_SetOrtho();

		// draw model list
		if(models.size() > 0)
		{
			for(int a=0; a<(int)models.size(); ++a)
			{
				MFFont_DrawText2(MFFont_GetDebugFont(), 100.f, 100.f + (-menuIndex*20 + a*20), 20.f, a == menuIndex ? MFVector::yellow : MFVector::white, models[a].CStr());
			}
		}
		else
		{
			MFFont_DrawText2(MFFont_GetDebugFont(), 100.f, 100.f, 20.f, MFVector::red, "No models found!");
		}
	}
	else
	{
		if(pModel)
		{
			// set projection
			MFView_ConfigureProjection(MFDEGREES(60.f), 0.1f, 10000.f);
			MFView_SetAspectRatio(MFDisplay_GetAspectRatio());
			MFView_SetProjection();

			// render the mesh
			MFRenderer_AddModel(pModel, NULL, MFView_GetViewState());
		}
		else
		{
			MFView_SetOrtho();
			MFFont_DrawText2(MFFont_GetDebugFont(), 100.f, 100.f, 20.f, MFVector::red, "Failed to load model!");
		}
	}
}
Example #5
0
void Game_Draw(void *pUserData)
{
	// Set identity camera (no camera)
	MFView_SetAspectRatio(MFDisplay_GetAspectRatio());
	MFView_SetProjection();

	MFMaterial_SetMaterial(MFMaterial_GetStockMaterial(MFMat_White));

	// set the world matrix to identity
	MFMatrix world = MFMatrix::identity;

	// move the box into the scene (along the z axis)
	world.Translate(MakeVector(0, 0, 5));

	// increment rotation
	static float rotation = 0.0f;
	rotation += MFSystem_GetTimeDelta();

	// rotate the box
	world.RotateYPR(rotation, rotation * 2.0f, rotation * 0.5f);

	// begin rendering the box
	MFPrimitive(PT_TriList);
	MFSetMatrix(world);

	// begin rendering 12 triangles (12 * 3 vertices)
	MFBegin(3 * 12);

	// draw a bunch of triangles
	MFSetColour(1,0,0,1);
	MFSetPosition(-1,-1, -1);
	MFSetPosition(-1, 1, -1);
	MFSetPosition( 1, 1, -1);
	MFSetPosition(-1,-1, -1);
	MFSetPosition( 1, 1, -1);
	MFSetPosition( 1,-1, -1);

	MFSetColour(0,1,0,1);
	MFSetPosition(-1,-1,1);
	MFSetPosition( 1,-1,1);
	MFSetPosition( 1, 1,1);
	MFSetPosition(-1,-1,1);
	MFSetPosition( 1, 1,1);
	MFSetPosition(-1, 1,1);

	MFSetColour(0,0,1,1);
	MFSetPosition( 1,-1,1);
	MFSetPosition( 1,-1,-1);
	MFSetPosition( 1, 1,-1);
	MFSetPosition( 1,-1,1);
	MFSetPosition( 1, 1,-1);
	MFSetPosition( 1, 1,1);

	MFSetColour(1,0,1,1);
	MFSetPosition(-1,-1,1);
	MFSetPosition(-1, 1,1);
	MFSetPosition(-1, 1,-1);
	MFSetPosition(-1,-1,1);
	MFSetPosition(-1, 1,-1);
	MFSetPosition(-1,-1,-1);

	MFSetColour(1,1,0,1);
	MFSetPosition(-1, 1,1);
	MFSetPosition( 1, 1,1);
	MFSetPosition( 1, 1,-1);
	MFSetPosition(-1, 1,1);
	MFSetPosition( 1, 1,-1);
	MFSetPosition(-1, 1,-1);

	MFSetColour(0,1,1,1);
	MFSetPosition(-1,-1,1);
	MFSetPosition(-1,-1,-1);
	MFSetPosition( 1,-1,-1);
	MFSetPosition(-1,-1,1);
	MFSetPosition( 1,-1,-1);
	MFSetPosition( 1,-1,1);

	MFEnd();

	MFRect disp;
	MFDisplay_GetDisplayRect(&disp);
	MFView_SetOrtho(&disp);
	pUI->Draw();
}