This commit is contained in:
zy 2024-12-29 19:19:38 +01:00
parent 714d9a8187
commit 5a116fa904
25 changed files with 3176 additions and 0 deletions

View file

@ -2,6 +2,8 @@
#include <iostream>
#include "utilsconsole.hpp"
#include "graphics.hpp"
#include <citro2d.h>
#include <citro3d.h>
#include <string.h>
using namespace std;
@ -370,9 +372,41 @@ static void mode_3d_moving_square() {
}
}
static void mode_citro2d() {
uc_pause();
C2D_Prepare();
uc_pause();
C2D_Image img;
uc_pause();
img.tex = new C3D_Tex;
uc_pause();
C3D_TexInitVRAM(img.tex, 200, 100, GPU_RGBA8);
uc_pause();
img.subtex = NULL;
uc_pause();
C3D_RenderTarget* top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT);
uc_pause();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
uc_pause();
C2D_TargetClear(top, C2D_Color32(255, 128, 192, 0));
uc_pause();
C3D_FrameEnd(0);
uc_pause();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
uc_pause();
C2D_SceneBegin(top);
uc_pause();
C2D_DrawImageAt(img, 50, 30, 32);
uc_pause();
C3D_FrameEnd(0);
uc_pause();
}
int main(void) {;
gfxInitDefault();
consoleInit(GFX_BOTTOM, NULL);
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
C2D_Init(C2D_DEFAULT_MAX_OBJECTS);
while (aptMainLoop()) {
static const int menu_size = 9;
@ -385,6 +419,7 @@ int main(void) {;
{"ugly 3D rainbow", false, NULL, 0, 0},
{"yellue", false, NULL, 0, 0},
{"3D moving square", false, NULL, 0, 0},
{"citro2d", false, NULL, 0, 0},
{"quit", false, NULL, 0, 0},
};
static auto menuVec = vector<s_uc_menu_element>(menu, menu + menu_size);
@ -408,8 +443,11 @@ int main(void) {;
if (ans == 7)
mode_3d_moving_square();
if (ans == 8)
mode_citro2d();
if (ans == 9)
break;
gfxSet3D(false);
}
gfxExit();
C2D_Fini();
}