private void RenderScreen(NamelessGame game, Screen screen, GameSettings settings) { effect.Parameters["tileAtlas"].SetValue(tileAtlas); var projectionMatrix = //Matrix.CreateOrthographic(game.getActualWidth(),game.getActualHeight(),0,1); Matrix.CreateOrthographicOffCenter(0, game.GetActualWidth(), game.GetActualHeight(), 0, 0, 2); effect.Parameters["xViewProjection"].SetValue(projectionMatrix); effect.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; effect.GraphicsDevice.BlendState = BlendState.AlphaBlend; var device = game.GraphicsDevice; Stopwatch s = Stopwatch.StartNew(); for (int y = 0; y < settings.GetHeightZoomed(); y++) { for (int x = 0; x < settings.GetWidthZoomed(); x++) { DrawTile(game.GraphicsDevice, game, x, y, x * settings.GetFontSizeZoomed(), y * settings.GetFontSizeZoomed(), characterToTileDictionary[screen.ScreenBuffer[y, x].Char], screen.ScreenBuffer[y, x].CharColor, screen.ScreenBuffer[y, x].BackGroundColor, foregroundModel, backgroundModel ); } } s.Stop(); var tileModel = backgroundModel; effect.CurrentTechnique = effect.Techniques["Background"]; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); device.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, tileModel.Vertices, 0, tileModel.Vertices.Length, tileModel.Indices.ToArray(), 0, 2, this.VertexDeclaration); } effect.CurrentTechnique = effect.Techniques["Point"]; tileModel = foregroundModel; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); device.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, tileModel.Vertices, 0, tileModel.Vertices.Length, tileModel.Indices.ToArray(), 0, tileModel.Indices.Count() / 3, this.VertexDeclaration); } }