/// <summary> /// Renders your user contents to the screen. /// Before running this, make sure that <see cref="Direct2DRenderMethod"/> is assigned. /// </summary> public void DirectXRender() { lock (RenderLock) { // If the window/surface we are rendering on is correctly set up and ready. if (Direct2DSetupComplete) { // Begin Drawing! Direct2DWindowTarget.BeginDraw(); // Clear everything drawn previously. ClearScreen(0, 0, 0, 0); // Call our own rendering methods assigned to the delegate. Direct2DRenderMethod?.Invoke(Direct2DWindowTarget); // Run any of our own assigned code to be run after rendering occurs... safely try { Direct2DOnframeDelegate?.Invoke(); } catch (Exception ex) { Bindings.PrintWarning?.Invoke("[libReloaded] Exception thrown in user code ran on Window " + "overlay frame render, let the mod/application developer know he screwed up | " + ex.Message); } // End Drawing Direct2DWindowTarget.EndDraw(); } } }
/// <summary> /// Draws over the entire form/window with RGBA(0,0,0,0). /// This clears the entire screen of any previously drawn graphics. /// </summary> public void DirectXClearScreen() { lock (RenderLock) { // If the window/surface we are rendering on is correctly set up and ready. if (Direct2DSetupComplete) { // Begin Drawing! Direct2DWindowTarget.BeginDraw(); // Clears everything drawn previously. ClearScreen(0, 0, 0, 0); // End Drawing! Direct2DWindowTarget.EndDraw(); } } }