add: main tester
This commit is contained in:
parent
8e9de2f977
commit
714d9a8187
1 changed files with 63 additions and 2 deletions
|
@ -317,12 +317,65 @@ void mode_yellue(void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void mode_3d_moving_square() {
|
||||
int ans = 0;
|
||||
int z = 0;
|
||||
gfxSet3D(true);
|
||||
while (aptMainLoop() && ans != 1) {
|
||||
static const int menu_size = 2;
|
||||
static const s_uc_menu_element menu[] = {
|
||||
{"z ", true, &z, -100, 100},
|
||||
{"back", false, NULL, 0, 0},
|
||||
};
|
||||
static auto menuVec = vector<s_uc_menu_element>(menu, menu + menu_size);
|
||||
|
||||
ans = uc_menu(menuVec);
|
||||
|
||||
gspWaitForVBlank();
|
||||
|
||||
static const u32 color_back = 0xFFFFFF;
|
||||
static const u32 color_square = 0xFFFF00;
|
||||
u16 width, height;
|
||||
t_color *frame;
|
||||
frame = (t_color *) gfxGetFramebuffer(
|
||||
GFX_TOP, GFX_LEFT, &height, &width);
|
||||
for (int i = 0; i < width * height; i++)
|
||||
{
|
||||
int x = i / height - z;
|
||||
if (x < 0 || x >= width)
|
||||
continue;
|
||||
int y = height - i % height - 1;
|
||||
if (x > 190 && x < 210 && y > 100 && y < 120)
|
||||
rgb_set(frame[i], color_square);
|
||||
else
|
||||
rgb_set(frame[i], color_back);
|
||||
}
|
||||
|
||||
frame = (t_color *) gfxGetFramebuffer(
|
||||
GFX_TOP, GFX_RIGHT, &height, &width);
|
||||
for (int i = 0; i < width * height; i++)
|
||||
{
|
||||
int x = i / height + z;
|
||||
if (x < 0 || x >= width)
|
||||
continue;
|
||||
int y = height - i % height - 1;
|
||||
if (x > 190 && x < 210 && y > 100 && y < 120)
|
||||
rgb_set(frame[i], color_square);
|
||||
else
|
||||
rgb_set(frame[i], color_back);
|
||||
}
|
||||
|
||||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {;
|
||||
gfxInitDefault();
|
||||
consoleInit(GFX_BOTTOM, NULL);
|
||||
|
||||
while (aptMainLoop()) {
|
||||
static const int menu_size = 7;
|
||||
static const int menu_size = 9;
|
||||
static const s_uc_menu_element menu[] = {
|
||||
{"ugly rainbow", false, NULL, 0, 0},
|
||||
{"direction", false, NULL, 0, 0},
|
||||
|
@ -331,9 +384,13 @@ int main(void) {;
|
|||
{"3D square", false, NULL, 0, 0},
|
||||
{"ugly 3D rainbow", false, NULL, 0, 0},
|
||||
{"yellue", false, NULL, 0, 0},
|
||||
{"3D moving square", false, NULL, 0, 0},
|
||||
{"quit", false, NULL, 0, 0},
|
||||
};
|
||||
static auto menuVec = vector<s_uc_menu_element>(menu, menu + menu_size);
|
||||
int ans = uc_menu(menuVec);
|
||||
switch (ans)
|
||||
{}
|
||||
if (ans == 0)
|
||||
mode_ugly_rainbow();
|
||||
if (ans == 1)
|
||||
|
@ -348,7 +405,11 @@ int main(void) {;
|
|||
mode_ugly_3d_rainbow();
|
||||
if (ans == 6)
|
||||
mode_yellue();
|
||||
if (ans == 7)
|
||||
mode_3d_moving_square();
|
||||
if (ans == 8)
|
||||
break;
|
||||
gfxSet3D(false);
|
||||
}
|
||||
gfxExit();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue