public bool Construct(uint width, uint height, uint cellX, uint cellY, string title, Color clearColor, bool fullscreen) { Title = title; this.fullscreen = fullscreen; resolution = new Vector2i((int)width, (int)height); this.cellX = (int)cellX; this.cellY = (int)cellY; backBuffer = new Pixel[width / cellX, height / cellY]; backBuffer.Populate(new Pixel().Construct(clearColor, cellX, cellY)); this.clearColor = clearColor; input = new InputHandler(); graphics = new GrapeGraphics(ref backBuffer); screen = new ScreenBuffer(backBuffer.GetLength(0), backBuffer.GetLength(1), (int)cellX, (int)cellY, ref backBuffer); vecGraph = new VertexGraphics(ref screen.vertexArr, backBuffer.GetLength(0), backBuffer.GetLength(1)); thread = new Thread(new ThreadStart(Start)); thread.Start(); return(true); }
public bool Construct(uint width, uint height, uint cellX, uint cellY, string title, Color clearColor, bool fullscreen) { Title = title; if (fullscreen) { window = new RenderWindow(VideoMode.FullscreenModes[0], title, Styles.Fullscreen); } else { window = new RenderWindow(new VideoMode(width, height), title); } this.cellX = (int)cellX; this.cellY = (int)cellY; backBuffer = new Pixel[window.Size.X / cellX, window.Size.Y / cellY]; backBuffer.Populate(new Pixel().Construct(clearColor, cellX, cellY)); this.clearColor = clearColor; input = new InputHandler(); graphics = new GrapeGraphics(ref backBuffer); window.KeyPressed += input.KeyPress; window.KeyReleased += input.KeyRelease; window.Closed += Window_Closed; screen = new ScreenBuffer(backBuffer.GetLength(0), backBuffer.GetLength(1), (int)cellX, (int)cellY, ref backBuffer); vecGraph = new VertexGraphics(ref screen.vertexArr, backBuffer.GetLength(0), backBuffer.GetLength(1)); OnCreate(); Loop(); return(true); }