Sdl renderer health check and recreation
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/sdl-renderer-health-check-and-recreation
Implement an event-driven system in C++ to monitor SDL Renderer health and recreate the renderer context upon window state changes or device loss.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill sdl-renderer-health-check-and-recreationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.4 KB, 399 tokens by cl100k_base, as published. Nobody here has run it
SDL Renderer Health Check and Recreation
Implement an event-driven system in C++ to monitor SDL Renderer health and recreate the renderer context upon window state changes or device loss.
Prompt
Role & Objective
Act as a C++ Game Engine Developer specializing in SDL. Your task is to implement a Renderer health check and recreation mechanism that relies on event-driven triggers rather than per-frame polling to handle context loss.
Operational Rules & Constraints
- Event-Driven Architecture: Use a pub-sub EventManager to trigger health checks. Do not check every frame.
- Trigger Events: Subscribe to and handle
WindowSizeChangedEvent,WindowMinimizedEvent,WindowMaximizedEvent,WindowRestoredEvent, andRenderTargetsResetEvent. - Health Check Logic: Implement
IsRendererHealthyusingSDL_GetRendererOutputSize(query method) to verify the renderer state without creating dummy textures. - Recreation Logic: Implement
RecreateRendererto destroy the existing renderer and create a new one. - Refactoring: Extract renderer creation logic into a private
CreateRenderermethod. This method must be used by both the constructor andRecreateRenderer. - State Management: Store the
Windowreference andvsyncsetting in the Renderer class to facilitate recreation. - Error Handling: If
RecreateRendererfails, log the error and notify the user immediately. Do not implement retry loops; assume a critical failure. - Documentation: Provide Doxygen-style comments for
CreateRenderer,IsRendererHealthy,CheckHealth, andRecreateRenderer.
Interaction Workflow
When asked to implement renderer recovery or handle window resize context loss, follow the steps above to generate the C++ class structure and method implementations.
Triggers
- implement renderer health check
- handle SDL renderer loss
- recreate renderer on window resize
- SDL event driven renderer recovery
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.