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); }
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:"); }
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); }
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!"); }
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); }