void Light::onDisplayLoop(int elapseTime) { deltaTime = (elapseTime - lastFrame) / 300.0f; lastFrame = elapseTime; changeValue += deltaTime; // printf("delta time: %f \n ", deltaTime); sceneRender(); }
int main() { // Initialize graphics gfxInitDefault(); C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); // Initialize the renderbuffer static C3D_RenderBuf rb; C3D_RenderBufInit(&rb, 240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8); rb.clearColor = CLEAR_COLOR; C3D_RenderBufClear(&rb); C3D_RenderBufBind(&rb); // Initialize the scene sceneInit(); // Main loop while (aptMainLoop()) { C3D_VideoSync(); hidScanInput(); // Respond to user input u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu // Render the scene sceneRender(); C3D_Flush(); C3D_RenderBufTransfer(&rb, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), DISPLAY_TRANSFER_FLAGS); C3D_RenderBufClear(&rb); } // Deinitialize the scene sceneExit(); // Deinitialize graphics C3D_Fini(); gfxExit(); return 0; }
//--------------------------------------------------------------------------------- int main(int argc, char **argv) { //--------------------------------------------------------------------------------- // Initialize graphics gfxInitDefault(); C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); // Initialize the render target C3D_RenderTarget* target = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8); C3D_RenderTargetSetClear(target, C3D_CLEAR_ALL, CLEAR_COLOR, 0); C3D_RenderTargetSetOutput(target, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS); // Initialize the scene sceneInit(); // Main loop while (aptMainLoop()) { hidScanInput(); // Respond to user input u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu moveSprites(); // Render the scene C3D_FrameBegin(C3D_FRAME_SYNCDRAW); C3D_FrameDrawOn(target); sceneRender(); C3D_FrameEnd(0); } // Deinitialize the scene sceneExit(); // Deinitialize graphics C3D_Fini(); gfxExit(); return 0; }
int main() { // Initialize graphics gfxInitDefault(); gpuInit(); // Initialize the scene sceneInit(); gpuClearBuffers(CLEAR_COLOR); // Main loop while (aptMainLoop()) { gspWaitForVBlank(); // Synchronize with the start of VBlank gfxSwapBuffersGpu(); // Swap the framebuffers so that the frame that we rendered last frame is now visible hidScanInput(); // Read the user input // Respond to user input u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu // Render the scene gpuFrameBegin(); sceneRender(); gpuFrameEnd(); gpuClearBuffers(CLEAR_COLOR); // Flush the framebuffers out of the data cache (not necessary with pure GPU rendering) //gfxFlushBuffers(); } // Deinitialize the scene sceneExit(); // Deinitialize graphics gpuExit(); gfxExit(); return 0; }
void Engine::onBeforeRendering() { sceneRender(); }