This commit is contained in:
zy 2024-12-29 19:25:51 +01:00
parent dd4edcd397
commit 2514d4da7b
5 changed files with 12 additions and 4 deletions

1
TODO
View file

@ -8,3 +8,4 @@ TODO mlx_exit()
TODO hook functions should be compatible again TODO hook functions should be compatible again
TODO mlx_init: use GSP_RGBA8_OES, and change mlx_get_data_addr accordingly TODO mlx_init: use GSP_RGBA8_OES, and change mlx_get_data_addr accordingly
TODO use GSPGPU

View file

@ -34,6 +34,6 @@
/// NULL if failed. /// NULL if failed.
t_mlx mlx_init(void); // TODO should call this before REALLY anything else? t_mlx mlx_init(void); // TODO should call this before REALLY anything else?
// TODO mlx_end() or something? mlx_destroy_display()? // TODO mlx_end() or something? mlx_destroy_display()? (with C2D_Fini())
#endif #endif

View file

@ -10,6 +10,7 @@
#include "mlx_internal.h" #include "mlx_internal.h"
#include <stdlib.h> #include <stdlib.h>
#include "3ds.h" #include "3ds.h"
#include <citro2d.h>
static t_internal_mlx g_internal_mlx; static t_internal_mlx g_internal_mlx;
@ -18,9 +19,9 @@ t_mlx mlx_init(void)
if (g_internal_mlx.is_init_called) if (g_internal_mlx.is_init_called)
mlx3ds_internal_fatalerror("mlx_init() must be called only once"); mlx3ds_internal_fatalerror("mlx_init() must be called only once");
g_internal_mlx.is_init_called = true; g_internal_mlx.is_init_called = true;
gfxInitDefault(); gfxInit(FRAMEBUFFER_FORMAT, FRAMEBUFFER_FORMAT, false);
gfxSetDoubleBuffering(GFX_TOP, false);
gfxSetDoubleBuffering(GFX_BOTTOM, false);
consoleInit(GFX_BOTTOM, NULL); consoleInit(GFX_BOTTOM, NULL);
C2D_Init(SIZE_MAX); // TODO C2D use SIZE_MAX?
C2D_Prepare(); // TODO C2D overrides gfxInit??
return (&g_internal_mlx); return (&g_internal_mlx);
} }

View file

@ -16,6 +16,10 @@
# include "3ds.h" # include "3ds.h"
# include "mlx_events.h" # include "mlx_events.h"
# define FRAMEBUFFER_FORMAT GSP_RGBA8_OES // GSPGPU_FramebufferFormat
# define FRAMEBUFFER_BPP 32 // must be coherent with above
# define FRAMEBUFFER_ENDIAN 0 // ??? // must be coherent with above
/// @brief Write an error message and exit the program. /// @brief Write an error message and exit the program.
/// ///
/// @param msg Message to write. Must use less than 38 colons. /// @param msg Message to write. Must use less than 38 colons.

View file

@ -6,3 +6,5 @@ How to change a original MinilibX project to a 3DS one:
- main must be main(void) - main must be main(void)
- new inputs - new inputs
- use assets instead of files - use assets instead of files
- change big malloc/free to linearAlloc/linearFree
- change color format and adapt everything