Ejemplo n.º 1
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());
}
Ejemplo n.º 2
0
void Game_Init(void *pUserData)
{
	// create the renderer with a single layer that clears before rendering
	MFRenderLayerDescription layers[] = { "Scene" };
	pRenderer = MFRenderer_Create(layers, 1, NULL, NULL);
	MFRenderer_SetCurrent(pRenderer);

	pDefaultStates = MFStateBlock_CreateDefault();
	MFRenderer_SetGlobalStateBlock(pRenderer, pDefaultStates);

	MFRenderLayer *pLayer = MFRenderer_GetLayer(pRenderer, 0);
	MFRenderLayer_SetClear(pLayer, MFRCF_All, MakeVector(0.f, 0.f, 0.2f, 1.f));

	MFRenderLayerSet layerSet;
	MFZeroMemory(&layerSet, sizeof(layerSet));
	layerSet.pSolidLayer = pLayer;
	MFRenderer_SetRenderLayerSet(pRenderer, &layerSet);

	// init HKUserInterface
	HKUserInterface::Init();

	pUI = new HKUserInterface();
	HKUserInterface::SetActiveUI(pUI);

	// load a test UI
	HKWidget *pTestLayout = HKWidget_CreateFromXML("ui-test.xml");
	MFDebug_Assert(pTestLayout != NULL, "Couldn't load UI!");

	pUI->AddTopLevelWidget(pTestLayout, true);
}
Ejemplo n.º 3
0
void Game_Init()
{
	// create the renderer with a single layer that clears before rendering
	MFRenderLayerDescription layers[] = { { "Prism" }, { "Box" } };
	pRenderer = MFRenderer_Create(layers, 2, NULL, NULL);
	MFRenderer_SetCurrent(pRenderer);

	pDefaultStates = MFStateBlock_CreateDefault();
	MFRenderer_SetGlobalStateBlock(pRenderer, pDefaultStates);

	// configure prism layer
	MFRenderLayer *pLayer = MFRenderer_GetLayer(pRenderer, 0);
	MFRenderLayer_SetClear(pLayer, MFRCF_All, MakeVector(0.f, 0.f, 0.0f, 1.f));

	// create a render target for the layer
	MFRenderTarget *pRenderTarget = MFRenderTarget_CreateSimple("Prism", 256, 256);
	pPrismRenderTarget = MFMaterial_Create("Prism_RenderTarget0");
	MFRenderLayer_SetLayerRenderTarget(pLayer, pRenderTarget);
	MFRenderTarget_Release(pRenderTarget); // the render layer now has a reference, it will be destroyed with the renderer

	// configure box layer
	pLayer = MFRenderer_GetLayer(pRenderer, 1);
	MFRenderLayer_SetClear(pLayer, MFRCF_All, MakeVector(0.f, 0.f, 0.2f, 1.f));

	// configure the box layer as the default render layer
	MFRenderLayerSet layerSet;
	MFZeroMemory(&layerSet, sizeof(layerSet));
	layerSet.pSolidLayer = pLayer;
	MFRenderer_SetRenderLayerSet(pRenderer, &layerSet);

	// build a vertex buffer
	BuildVertexBuffers();

	// create some state blocks
	pPrismStateBlock = MFStateBlock_Create(128);
	pBoxStateBlock = MFStateBlock_Create(128);
}
Ejemplo n.º 4
0
void Game_Init()
{
	// create the renderer with a single layer that clears before rendering
	MFRenderLayerDescription layers[] = { { "Scene" } };
	pRenderer = MFRenderer_Create(layers, 1, NULL, NULL);
	MFRenderer_SetCurrent(pRenderer);

	MFRenderLayer *pLayer = MFRenderer_GetLayer(pRenderer, 0);
	MFRenderLayer_SetClear(pLayer, MFRCF_All, MakeVector(0.f, 0.f, 0.2f, 1.f));

	MFRenderLayerSet layerSet;
	MFZeroMemory(&layerSet, sizeof(layerSet));
	layerSet.pSolidLayer = pLayer;
	MFRenderer_SetRenderLayerSet(pRenderer, &layerSet);

	Scan("data:");
}
Ejemplo n.º 5
0
void Game_Init()
{
	// create the renderer with a single layer that clears before rendering
	MFRenderLayerDescription layers[] = { "Scene" };
	pRenderer = MFRenderer_Create(layers, 1, NULL, NULL);
	MFRenderer_SetCurrent(pRenderer);

	pDefaultStates = MFStateBlock_CreateDefault();
	MFRenderer_SetGlobalStateBlock(pRenderer, pDefaultStates);

	MFRenderLayer *pLayer = MFRenderer_GetLayer(pRenderer, 0);
	MFRenderLayer_SetClear(pLayer, MFRCF_All, MakeVector(0.f, 0.f, 0.2f, 1.f));

	MFRenderLayerSet layerSet;
	MFZeroMemory(&layerSet, sizeof(layerSet));
	layerSet.pSolidLayer = pLayer;
	MFRenderer_SetRenderLayerSet(pRenderer, &layerSet);
}
Ejemplo n.º 6
0
void Game_Init()
{
	// create the renderer with a single layer that clears before rendering
	MFRenderLayerDescription layers[] = { { "Scene" } };
	pRenderer = MFRenderer_Create(layers, 1, NULL, NULL);
	MFRenderer_SetCurrent(pRenderer);

	MFRenderLayer *pLayer = MFRenderer_GetLayer(pRenderer, 0);
	MFRenderLayer_SetClear(pLayer, MFRCF_All, MakeVector(0.f, 0.f, 0.2f, 1.f));

	MFRenderLayerSet layerSet;
	MFZeroMemory(&layerSet, sizeof(layerSet));
	layerSet.pSolidLayer = pLayer;
	MFRenderer_SetRenderLayerSet(pRenderer, &layerSet);

	// load model
	pModel = MFModel_CreateWithAnimation("astro");
	MFDebug_Assert(pModel, "Couldn't load mesh!");
}