Example #1
0
        private void OnUpdate(object sender, EventArgs e)
        {
            Input.Update();
            player.DefaultSettings();
            // Default settings

            foreach (Slime slime in Slimes)
            {
                slime.DefaultSettings();
            }
            foreach (Item item in Items)
            {
                item.DefaultSettings();
            }

            // Update Settings
            foreach (Wall wall in Walls)
            {
                wall.Update(player, Slimes);
            }

            foreach (Slime slime in Slimes.ToList())
            {
                slime.Update(player);
                if (slime.hit)
                {
                    RemoveSlime(slime);
                }
            }

            foreach (Item item in Items.ToList())
            {
                item.Update(player);
                if (item.hit)
                {
                    RemoveItem(item);
                }
            }

            player.Update();
        }
Example #2
0
        private static void MainGameLoop()
        {
            Gl.ClearColor(1, 1, 1, 1);
            Gl.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            ErrorCode error = Gl.GetError();

            Debug.Assert(error == ErrorCode.NoError);

            GameTime.Update();
            CooldownTimer.Update();

            if (Mode == ProgramMode.Game)
            {
                GameGuiRenderer.RenderBackground();
                GameRenderer.Render();
                GameLogic.Update();
            }
            Gui.Render();
            Gui.Update();

            Input.Update();
            Glut.glutSwapBuffers();
        }