public PCTimer(UpdateEvent updateEvent) { timer= new InternalClock(); update= updateEvent; prevTime= DateTime.Now; time= new GameTime(DateTime.Now-prevTime); Wfx.Application.Idle+= onIdle; }
// Updates the game public void update(GameTime time) { /*if(dxg.im== null || dxg.swapChain== null || dxg.renderTarget== null) return; dxg.im.ClearRenderTargetView(dxg.renderTarget, new DX.Color4(window.renderColor.af, window.renderColor.rf, window.renderColor.gf, window.renderColor.bf)); dxg.im.ClearDepthStencilView(dxg.depthStencilView, DXGI.DepthStencilClearFlags.Depth|DXGI.DepthStencilClearFlags.Stencil, 1f, 0); dxg.im.InputAssembler.InputLayout= if(camera!= null) camera.update(); dxg.swapChain.Present(0, DXGI.PresentFlags.None);*/ if(camera!= null) camera.update(); graphics.clearScreen(); graphics.renderScene(0, 36); graphics.present(); }
// Updates the game protected virtual void onUpdate(GameTime time) { // Variables InputArgs args= Input.getInputArgs(); window.viewport.cls(); // Handles input if(handleState!= null) handleState(args); // Updates the game if(updateState!= null) updateState(time); // Renders the game if(renderState!= null) renderState(time); graphics.flush(); window.viewport.SwapBuffers(); if(camera!= null) camera.update(); Input.update(); }