// Main draw caller private void DrawCaller() { lock (GameApplication.GameWindow.Canvas.RazorLock) // Set lock for resize or etc. { while (IsRunning) { // Clear light buffer //LightBufferDrawer.Clear(Color.Black); // Set interpolation mode MainBufferDrawer.InterpolationMode = TextureInterpolationMode; // If Current Scene not null if (GameApplication.GameWindow.CurrentScene != null) { // Clear Main buffer with scene color MainBufferDrawer.Clear(GameApplication.GameWindow.CurrentScene.BackgroundColor); // Draw background _drawBg(); // Draw gameobjects _drawGameObjects(); // Calculate and draw lights //_calcLighting(); // Draw UI controls _drawUiLayer(); } else { // Or if Current Scene is null just clear all window with base color MainBufferDrawer.Clear(GameApplication.GameWindow.BaseColor); } // Draw main buffer GameApplication.GameWindow.Canvas.RazorGFX.DrawImage(DrawBuffer, 0, 0); if (DrawDebugRects) // Draw debug rects if true { GameApplication.GameWindow.Canvas.RazorGFX.DrawRectangle(DebugCameraRectangleBoundings, GameApplication.GameWindow.CurrentScene.Camera.CameraBounds); GameApplication.GameWindow.Canvas.RazorGFX.DrawRectangle(DebugMousePointRectangleBoundings, GameApplication.GameWindow.MousePoint); } if (DrawDebugInfo) // Draw debug texts if true { GameApplication.GameWindow.Canvas.RazorGFX.DrawString($"craftersmine EtherEngine{Environment.NewLine}{Environment.NewLine}WindowSize: {GameApplication.GameWindow.Width}x{GameApplication.GameWindow.Height}{Environment.NewLine}DrawCall: {DrawCall} {Environment.NewLine}FPS: {Framerate}{Environment.NewLine}{AdditionalDebugInfo}", GameApplication.GameWindow.Font, FontBrush, 0, 0); } // Render GameApplication.GameWindow.Canvas.RazorPaint(); DrawCall++; // Increment draw call } } }