public void draw(GameTime time, RenderWindow window) { foreach (Screen s in screens) { if (s.IsDrawn) s.draw(time, window); if (s.ChildScreens != null) { foreach (Screen cs in s.ChildScreens) if (cs.IsDrawn) cs.draw(time, window); } } }
public void run() { createWindow(videoMode,title, style, context); intialize(Window); loadContent(); GameTime time = new GameTime(); long timeSnap = 0; while (Window.IsOpen) { Window.DispatchEvents(); time.frameTime = (time.gameTime.ElapsedTime.AsMicroseconds() - (float)timeSnap) / 1000000; timeSnap = time.gameTime.ElapsedTime.AsMicroseconds(); update(time); draw(time, Window); } unloadContent(); }
public void update(GameTime time) { foreach (Screen s in removeQueue) { s.Dispose(); screens.Remove(s); } removeQueue.Clear(); foreach (Screen s in addQueue) screens.Add(s); addQueue.Clear(); foreach (Screen s in screens) { if (s.IsUpdated) s.update(time); if (s.ChildScreens != null) { foreach (Screen cs in s.ChildScreens) if (cs.IsUpdated) cs.update(time); } } }
/// <summary> /// Update the screen /// </summary> /// <param name="time"></param> public abstract void update(GameTime time);
/// <summary> /// Draw the screen to the window /// </summary> /// <param name="time"></param> /// <param name="window"></param> public abstract void draw(GameTime time, RenderWindow window);
public override void update(GameTime time) { contentManager.update(time); lightLayer.update(contentManager); #region DeleteBlocks if (Mouse.IsButtonPressed(Mouse.Button.Right)) { Vector2i pos = Game1.getMousePosition(); MouseButtonEvent e = new MouseButtonEvent(); e.Button = Mouse.Button.Right; e.X = pos.X; e.Y = pos.Y; this.handleMouseButton(new MouseButtonEventArgs(e)); } #endregion this.guide.update(Game1.getMousePosition()); }
public override void draw(GameTime time, RenderWindow window) { window.SetView(view); if (showGrid) drawGrid(window); contentManager.draw(time, window); if (lightLayerEnabled) lightLayer.draw(window); guide.draw(window); }
public virtual void update(GameTime time) { }
public virtual void draw(GameTime time, RenderWindow window) { }