Ejemplo n.º 1
0
        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);
                }
            }
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Update the screen
 /// </summary>
 /// <param name="time"></param>
 public abstract void update(GameTime time);
Ejemplo n.º 5
0
 /// <summary>
 /// Draw the screen to the window
 /// </summary>
 /// <param name="time"></param>
 /// <param name="window"></param>
 public abstract void draw(GameTime time, RenderWindow window);
Ejemplo n.º 6
0
        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());
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 public virtual void update(GameTime time)
 {
 }
Ejemplo n.º 9
0
 public virtual void draw(GameTime time, RenderWindow window)
 {
 }