Skip to content

Commit f8530ae

Browse files
committed
chapter 4 edits
1 parent a7d3c48 commit f8530ae

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

articles/tutorials/advanced/2d_shaders/04_debug_ui/index.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,21 @@ Each instance of `Material` is going to draw a custom debug window. The window w
7878

7979
Currently however, the control is not fully bound to the the `Saturation` parameter of the `greyscale` shader, inputs will always be overridden because the `GameScene` itself keeps setting the value. In order to solve this, we introduce a custom property in the `Material` class that causes the debug UI to override the various `SetParameter()` methods.
8080

81-
2. Next, add this new boolean to the `Material` class:
81+
2. Add the following `using` statements to the top of the `Material.cs` file:
82+
83+
```csharp
84+
using ImGuiNET;
85+
```
86+
87+
3. Next, add this new boolean to the `Material` class:
8288

8389
[!code-csharp[](./snippets/snippet-4-08.cs)]
8490

85-
3. Then, modify all of the `SetParameter()` methods (float, matrix, vector2, etc) to exit early when the `DebugOverride` variable is set to `true`:
91+
4. Then, modify all of the `SetParameter()` methods (float, matrix, vector2, etc) to exit early when the `DebugOverride` variable is set to `true`:
8692

8793
[!code-csharp[](./snippets/snippet-4-09.cs?highlight=3)]
8894

89-
4. Then, in the `DebugDraw()` method, after the `LastUpdated` field gets drawn, add this following:
95+
5. Then, in the `DebugDraw()` method, after the `LastUpdated` field gets drawn, add this following:
9096

9197
[!code-csharp[](./snippets/snippet-4-10.cs?highlight=14-17)]
9298

@@ -122,9 +128,9 @@ We will keep track of all the `Material` instances to draw as a [`static`](https
122128
```
123129

124130
> [!TIP]
125-
> TO keep things clean, you can also remove the old `using ImGuiNET;` as you will see it is now greyed out because it is not used anymore since we removed the test `ImGui` drawing code.
131+
> To keep things clean, you can also remove the old `using ImGuiNET;` as you will see it is now greyed out because it is not used anymore since we removed the test `ImGui` drawing code.
126132

127-
6. Finally, in order to render the debug UI for the `_grayscaleEffect`, just enable the `IsDebugVisible` property to `true` in the `LoadCOntent` method of the `GameScreen` class:
133+
6. Finally, in order to render the debug UI for the `_grayscaleEffect`, just enable the `IsDebugVisible` property to `true` in the `LoadContent` method of the `GameScreen` class:
128134

129135
[!code-csharp[](./snippets/snippet-4-15.cs?highlight=3)]
130136

articles/tutorials/advanced/2d_shaders/04_debug_ui/snippets/snippet-4-12.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public bool IsDebugVisible
99
}
1010
set
1111
{
12-
if (IsDebugVisible)
12+
if (!value)
1313
{
1414
s_debugMaterials.Remove(this);
1515
}

0 commit comments

Comments
 (0)