public GameUpdater(int pFPS, UpdateEvent updateCall) { updateTimer= new GameClock(); update= updateCall; prevTime= DateTime.Now; time= new GameTime(DateTime.Now-prevTime); framesPerSecond= pFPS; Application.Idle+= appIdle; }
// Renders the gui control normally protected override void renderNormal(ref Game game, ref GameTime time) { game.graphics.renderRect(pBounds, pBGColors.normal); base.renderNormal(ref game, ref time); if(bHasSelection) { } }
// Called when the game has been updated protected virtual void onUpdate(GameTime time) { // Variables InputArgs args= GameInput.getInputArgs(); window.viewport.cls(); try { // Handles the input guiInputEvent(args); gsmInputEvent(args); }catch{} try { // Updates the game guiUpdateEvent(time); gsmUpdateEvent(time); }catch{} try { // Renders the game gsmRenderEvent(time); guiRenderEvent(time); }catch{} GL.Flush(); window.viewport.SwapBuffers(); }
// Renders the gui control when it is pressed down on protected override void renderPressed(ref Game game, ref GameTime time) { game.graphics.renderString(pText, pFont, location, pFGColors.pressed); }
// Renders the gui control normally protected override void renderNormal(ref Game game, ref GameTime time) { game.graphics.renderString(pText, pFont, location, pFGColors.normal); }
// Used to safely override and render without having to destroy the main render stuff protected override void innerRender(ref Game game, ref GameTime time) { }
// Renders the gui control when it is being pressed down on protected override void renderPressed(ref Game game, ref GameTime time) { game.graphics.renderRect(pBounds, pBGColors.pressed); game.graphics.renderString(pText, pFont, location, pFGColors.pressed); pBorder.render(game, pBounds, 3); }
// Renders the gui control normally protected override void renderNormal(ref Game game, ref GameTime time) { game.graphics.renderRect(pBounds, pBGColors.normal); game.graphics.renderString(pText, pFont, location, pFGColors.normal); pBorder.render(game, pBounds, 0); }
// Renders the progress bar private void renderProgressBar(ref Game game, ref GameTime time, Color baseColor, Color textColor, Color progColor, Color progLeftColor) { // Variables float p; if(pHorizontal) { p= width*pProgress; game.graphics.renderRect(pBounds, baseColor); if(p> 0) game.graphics.renderRect(new Rectangle(new Point2(x+1f, y+1f), new Size2(p-2f, height-2f)), progColor); else p= 1f; game.graphics.renderRect(new Rectangle(new Point2(x+p, y+1f), new Size2((width-p)-1f, height-2f)), progLeftColor); } else { // TODO: Change for vertical progress bar p= height*pProgress; game.graphics.renderRect(pBounds, baseColor); if(p> 0) game.graphics.renderRect(new Rectangle(new Point2(x+1f, y+1f), new Size2(width-2f, p-2f)), progColor); else p= 1f; game.graphics.renderRect(new Rectangle(new Point2(x+p, y+1f), new Size2(width-2f, (p-height)-1f)), progLeftColor); } if(pAutoLabel) { game.graphics.renderString(pText, pFont, location, textColor); } }
// Renders the gui control when it is pressed down on protected override void renderPressed(ref Game game, ref GameTime time) { renderProgressBar(ref game, ref time, pBGColors.pressed, pFGColors.pressed, pProgressColors.pressed, pProgressLeftColors.pressed); }
// Renders the gui control normally protected override void renderNormal(ref Game game, ref GameTime time) { renderProgressBar(ref game, ref time, pBGColors.normal, pFGColors.normal, pProgressColors.normal, pProgressLeftColors.disabled); }
// Renders the game state public override void render(GameTime time) { }
// Updates the gui public virtual void update(GameTime time) { for(int i= 0; i< actives.size; i++) csets.getViaIndex(actives.items[i]).update(ref game, ref time); }