Example #1
0
        public Game(int width, int height)
            : base(width, height, GraphicsMode.Default, windowName, GameWindowFlags.Default, DisplayDevice.Default, 2, 1, GraphicsContextFlags.Default)
        {
            renderer = RendererFactory.Instance.CreateRenderer();
            Keyboard.KeyRepeat = false;
            GL.Enable(EnableCap.Texture2D);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);

            m = new MainMenu(windowWidth, windowHeight);
            Keyboard.KeyDown += OnMenuControl;

            mapTextureList = new[]
                {
                    new Texture(new Bitmap(GraphicsLib.Properties.Resources.empty)),
                    new Texture(new Bitmap(GraphicsLib.Properties.Resources.brick)),
                    new Texture(new Bitmap(GraphicsLib.Properties.Resources.concrete)),
                    new Texture(new Bitmap(GraphicsLib.Properties.Resources.water)),
                    new Texture(new Bitmap(GraphicsLib.Properties.Resources.forest)),
                    new Texture(new Bitmap(GraphicsLib.Properties.Resources._base))
                };

            tankTextureList = new[]
                {
                    new Texture(new Bitmap(GraphicsLib.Properties.Resources.tankPlayerNormal))
                };

            WindowBorder = WindowBorder.Fixed;
            windowWidth = width;
            windowHeight = height;
            gameRenderer = new GameRenderer(windowWidth, windowHeight, mapTextureList, tankTextureList);
        }
Example #2
0
        public Game(int width, int height)
            : base(width, height, GraphicsMode.Default, windowName, GameWindowFlags.Default, DisplayDevice.Default, 4, 1, GraphicsContextFlags.Default)
        {
            renderer           = RendererFactory.Instance.CreateRenderer();
            Keyboard.KeyRepeat = false;
            GL.Enable(EnableCap.Texture2D);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);
            m = new MainMenu(windowWidth, windowHeight);
            Keyboard.KeyDown += new EventHandler <KeyboardKeyEventArgs>(MenuControl);

            m           = new MainMenu(windowWidth, windowHeight);
            textureList = new[]
            {
                new Texture(new Bitmap(GraphicsLib.Properties.Resources.empty)),
                new Texture(new Bitmap(GraphicsLib.Properties.Resources.brick)),
                new Texture(new Bitmap(GraphicsLib.Properties.Resources.concrete)),
                new Texture(new Bitmap(GraphicsLib.Properties.Resources.water)),
                new Texture(new Bitmap(GraphicsLib.Properties.Resources.forest)),
                new Texture(new Bitmap(GraphicsLib.Properties.Resources._base))
            };

            WindowBorder = WindowBorder.Fixed;
            windowWidth  = width;
            windowHeight = height;
            gameRenderer = new GameRenderer(windowWidth, windowHeight, textureList);
        }