Skip to content

Commit

Permalink
Fixed not clearing ImGui canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
Deseteral committed Sep 29, 2023
1 parent 77850ee commit 7b3ca7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ponczek",
"version": "1.1.1",
"version": "1.1.2",
"description": "Deep-fried game framework with sweet filling",
"author": "Deseteral <github.com/deseteral>",
"license": "MIT",
Expand Down
6 changes: 6 additions & 0 deletions src/imgui/imgui-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,12 @@ export function NewFrame(time: number): void {
}
}

export function ClearScreen(): void {
if (!gl) throw new Error();
gl.clearColor(0, 0, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT);
}

export function RenderDrawData(draw_data: ImGui.DrawData | null = ImGui.GetDrawData()): void {
const io = ImGui.GetIO();
if (draw_data === null) { throw new Error(); }
Expand Down
1 change: 1 addition & 0 deletions src/ponczek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export abstract class Ponczek {
if (Ponczek.renderImGui) {
ImGui.EndFrame();
ImGui.Render();
ImGuiImpl.ClearScreen();
ImGuiImpl.RenderDrawData(ImGui.GetDrawData());
}

Expand Down

0 comments on commit 7b3ca7f

Please sign in to comment.