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); }
private RendererFactory() { // TODO: Add version choosing Version glVersion = new Version(GL.GetString(StringName.Version).Substring(0, 3)); //if (glVersion.Major == 2) rendererImpl = new GL2_Renderer(); //else }
private RendererFactory() { // TODO: Add version choosing Version glVersion = new Version(GL.GetString(StringName.Version).Substring(0, 3)); switch (glVersion.Major) { case 2: rendererImpl = new GL2_Renderer(); break; } }
public Renderer(RendererType type) { Type = type; switch (Type) { case RendererType.DirectX: _rendererImpl = new RendererDirectX(); break; case RendererType.Vulcan: _rendererImpl = new RendererVulcan(); break; default: Debug.LogError($"Can't create renderer with {Type}"); break; } }
public AbstractMenu(float menuWidth, float menuHeight) { this.menuWidth = menuWidth; this.menuHeight = menuHeight; renderer = RendererFactory.Instance.CreateRenderer(); }