Skip to content

Commit ab38f07

Browse files
committed
Samples update
All this commit does is make the swkbd and erreula samples roughly equivalent in function For example when closing the error viewer, `SYSLaunchMenu()` will be called to cause ProcUI to exit, just like how it is in swkbd. Also this adds sound effects for the erreula sample, much like what swkbd has already had for some time now.
1 parent b7d6d95 commit ab38f07

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

samples/cmake/erreula/main.cpp

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <coreinit/filesystem.h>
22
#include <coreinit/memdefaultheap.h>
3-
#include <gx2/surface.h>
43
#include <nn/erreula.h>
54
#include <sndcore2/core.h>
65
#include <sysapp/launch.h>
@@ -50,10 +49,6 @@ main(int argc, char **argv)
5049
appearArg.errorArg.errorTitle = u"Title";
5150
nn::erreula::AppearErrorViewer(appearArg);
5251

53-
// Get WHBGfx's colour buffers for proper erreula rendering
54-
GX2ColorBuffer *cbTV = WHBGfxGetTVColourBuffer();
55-
GX2ColorBuffer *cbDRC = WHBGfxGetDRCColourBuffer();
56-
5752
WHBLogPrintf("Begin rendering...");
5853
while (WHBProcIsRunning()) {
5954
// Read vpad for erreula::Calc
@@ -72,39 +67,20 @@ main(int argc, char **argv)
7267

7368
if (nn::erreula::IsDecideSelectButtonError()) {
7469
nn::erreula::DisappearErrorViewer();
70+
// Cause ProcUI to exit.
7571
SYSLaunchMenu();
7672
}
7773

7874
WHBGfxBeginRender();
7975

8076
WHBGfxBeginRenderTV();
8177
WHBGfxClearColor(0.0f, 0.0f, 1.0f, 1.0f);
82-
// Set our colour buffer's surface format to SRGB for correct rendering of erreula
83-
GX2SurfaceFormat fTV = cbTV->surface.format;
84-
cbTV->surface.format = GX2_SURFACE_FORMAT_SRGB_R8_G8_B8_A8;
85-
GX2InitColorBufferRegs(cbTV);
86-
GX2SetColorBuffer(cbTV, GX2_RENDER_TARGET_0);
87-
8878
nn::erreula::DrawTV();
89-
90-
// Set our colour buffer's surface format back to what it was before.
91-
cbTV->surface.format = fTV;
92-
GX2InitColorBufferRegs(cbTV);
93-
GX2SetColorBuffer(cbTV, GX2_RENDER_TARGET_0);
9479
WHBGfxFinishRenderTV();
9580

9681
WHBGfxBeginRenderDRC();
9782
WHBGfxClearColor(1.0f, 0.0f, 1.0f, 1.0f);
98-
GX2SurfaceFormat fDRC = cbDRC->surface.format;
99-
cbDRC->surface.format = GX2_SURFACE_FORMAT_SRGB_R8_G8_B8_A8;
100-
GX2InitColorBufferRegs(cbDRC);
101-
GX2SetColorBuffer(cbDRC, GX2_RENDER_TARGET_0);
102-
10383
nn::erreula::DrawDRC();
104-
105-
cbDRC->surface.format = fDRC;
106-
GX2InitColorBufferRegs(cbDRC);
107-
GX2SetColorBuffer(cbDRC, GX2_RENDER_TARGET_0);
10884
WHBGfxFinishRenderDRC();
10985

11086
WHBGfxFinishRender();

samples/cmake/swkbd/main.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ main(int argc, char **argv)
4545
return -1;
4646
}
4747

48-
// Get WHBGfx's colour buffers for proper swkbd rendering
49-
GX2ColorBuffer *cbTV = WHBGfxGetTVColourBuffer();
50-
GX2ColorBuffer *cbDRC = WHBGfxGetDRCColourBuffer();
51-
5248
WHBLogPrintf("Begin rendering...");
5349
while (WHBProcIsRunning()) {
5450
// Read vpad for swkbd::Calc
@@ -83,32 +79,12 @@ main(int argc, char **argv)
8379

8480
WHBGfxBeginRenderTV();
8581
WHBGfxClearColor(0.0f, 0.0f, 1.0f, 1.0f);
86-
// Set our colour buffer's surface format to SRGB for correct rendering of swkbd
87-
GX2SurfaceFormat fTV = cbTV->surface.format;
88-
cbTV->surface.format = GX2_SURFACE_FORMAT_SRGB_R8_G8_B8_A8;
89-
GX2InitColorBufferRegs(cbTV);
90-
GX2SetColorBuffer(cbTV, GX2_RENDER_TARGET_0);
91-
9282
nn::swkbd::DrawTV();
93-
94-
// Set our colour buffer's surface format back to what it was before.
95-
cbTV->surface.format = fTV;
96-
GX2InitColorBufferRegs(cbTV);
97-
GX2SetColorBuffer(cbTV, GX2_RENDER_TARGET_0);
9883
WHBGfxFinishRenderTV();
9984

10085
WHBGfxBeginRenderDRC();
10186
WHBGfxClearColor(1.0f, 0.0f, 1.0f, 1.0f);
102-
GX2SurfaceFormat fDRC = cbDRC->surface.format;
103-
cbDRC->surface.format = GX2_SURFACE_FORMAT_SRGB_R8_G8_B8_A8;
104-
GX2InitColorBufferRegs(cbDRC);
105-
GX2SetColorBuffer(cbDRC, GX2_RENDER_TARGET_0);
106-
10787
nn::swkbd::DrawDRC();
108-
109-
cbDRC->surface.format = fDRC;
110-
GX2InitColorBufferRegs(cbDRC);
111-
GX2SetColorBuffer(cbDRC, GX2_RENDER_TARGET_0);
11288
WHBGfxFinishRenderDRC();
11389

11490
WHBGfxFinishRender();

0 commit comments

Comments
 (0)