예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            GL.ClearColor(Color.Black);

            Spritebatch.Begin(this.Width, this.Height);
        }
예제 #2
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            base.OnRenderFrame(e);

            GL.Clear(ClearBufferMask.ColorBufferBit);

            foreach (GameObject gameObject in gameObjects)
            {
                if (textures.ContainsKey(gameObject))
                {
                    Spritebatch.Draw(textures[gameObject],
                                     gameObject.Transform);
                }
            }

            SwapBuffers();
        }
예제 #3
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            base.OnRenderFrame(e);
            GL.Clear(ClearBufferMask.ColorBufferBit);
            GL.ClearColor(Color.CornflowerBlue);

            Spritebatch.Begin(this.Width, this.Height);
            view.ApplyTranform();

            for (int i = -960; i < 960; i += 48) //земля
            {
                Spritebatch.Draw(textures[3], new Vector2(i, 0), new Vector2(3f, 3f), Color.Transparent, new Vector2(0, 0));
                for (int j = 48; j < 480; j += 48) //земля
                {
                    Spritebatch.Draw(textures[2], new Vector2(i, j), new Vector2(3f, 3f), Color.Transparent, new Vector2(0, 0));
                }
            }
            Spritebatch.Draw(textures[0], new Vector2(-96, 0), new Vector2(3f, 3f), Color.Transparent, new Vector2(0, 0));
            Spritebatch.Draw(textures[0], new Vector2(240, 0), new Vector2(3f, 3f), Color.Transparent, new Vector2(0, 0));

            for (int i = -48; i < 240; i += 48)
            {
                for (int j = -144; j < 0; j += 48)
                {
                    Spritebatch.Draw(textures[1], new Vector2(i, j), new Vector2(3f, 3f), Color.DarkGray, new Vector2(0, 0));
                }
            }
            Spritebatch.Draw(textures[1], new Vector2(-96, -48), new Vector2(3f, 3f), Color.DarkGray, new Vector2(0, 0));
            Spritebatch.Draw(textures[1], new Vector2(-96, -96), new Vector2(3f, 3f), Color.DarkGray, new Vector2(0, 0));
            Spritebatch.Draw(textures[1], new Vector2(240, -48), new Vector2(3f, 3f), Color.DarkGray, new Vector2(0, 0));
            Spritebatch.Draw(textures[1], new Vector2(240, -96), new Vector2(3f, 3f), Color.DarkGray, new Vector2(0, 0));

            for (int i = -48; i < 240; i += 48)
            {
                Spritebatch.Draw(textures[1], new Vector2(i, 0), new Vector2(3f, 3f), Color.Transparent, new Vector2(0, 0));
            }

            for (int i = -96; i < 288; i += 48)
            {
                Spritebatch.Draw(textures[0], new Vector2(i, -192), new Vector2(3f, 3f), Color.Transparent, new Vector2(0, 0));
            }
            Spritebatch.Draw(textures[0], new Vector2(-96, -144), new Vector2(3f, 3f), Color.Transparent, new Vector2(0, 0));
            Spritebatch.Draw(textures[0], new Vector2(240, -144), new Vector2(3f, 3f), Color.Transparent, new Vector2(0, 0));

            SwapBuffers();
        }