Skip to content

Debug code behind compile-time flag - #48

Merged
MichaelFisher1997 merged 5 commits into
stagefrom
opencode/issue29-20251224044148
Dec 24, 2025
Merged

Debug code behind compile-time flag#48
MichaelFisher1997 merged 5 commits into
stagefrom
opencode/issue29-20251224044148

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

The implementation is complete. Let me provide a summary:

Changes made to src/game/app.zig:

  1. Added compile-time debug_build constant using Zig's builtin mode detection
  2. Created DebugState packed struct to hold debug toggle state (lines 6-9)
  3. Added debug_state: DebugState field to App struct (line 34)
  4. Updated key handlers for 'u' (toggle shadows) and 'k' (cycle cascade) to use self.debug_state (lines 194, 198)
  5. Wrapped debug shadow map visualization with if (debug_build) (line 357)
  6. Wrapped debug stats UI (FPS, position, chunks, time, sun intensity) with if (debug_build) (lines 371-405)
  7. Wrapped console debug output with if (debug_build) (lines 457-464)

Acceptance Criteria Status:

  • Debug rendering code behind compile-time flag
  • Release builds don't include debug code (all debug code is within if (debug_build) blocks)
  • Debug builds still have full functionality

Closes #29

New%20session%20-%202025-12-24T04%3A41%3A47.887Z
opencode session  |  github run

Co-authored-by: MichaelFisher1997 <MichaelFisher1997@users.noreply.github.com>
@MichaelFisher1997

Copy link
Copy Markdown
Collaborator

/oc can you fix this, it fail to build in the runner

@opencode-agent

Copy link
Copy Markdown
Contributor Author

Fixed the build failure by wrapping the debug key handlers (u and k keys) with if (debug_build). This prevents the debug_state fields from being accessed in release builds where they would be unused, causing compiler warnings/errors.

New%20session%20-%202025-12-24T04%3A47%3A23.375Z
opencode session  |  github run

@MichaelFisher1997
MichaelFisher1997 changed the base branch from main to stage December 24, 2025 21:47
@MichaelFisher1997
MichaelFisher1997 force-pushed the opencode/issue29-20251224044148 branch from af72398 to c870e58 Compare December 24, 2025 22:09
@MichaelFisher1997
MichaelFisher1997 force-pushed the opencode/issue29-20251224044148 branch from c870e58 to 3bfe1de Compare December 24, 2025 22:09
@MichaelFisher1997
MichaelFisher1997 merged commit 18e8c55 into stage Dec 24, 2025
1 check passed
@MichaelFisher1997
MichaelFisher1997 deleted the opencode/issue29-20251224044148 branch February 10, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add debug_build flag to gate debug rendering code

1 participant