mlx3ds/source/mlx_init.c
Zy 13b93106ee part: implement some functions (windows & display)
part:
- remove mlx3ds_3dskey.h, instead use hid.h
- add definitions of:
  - mlx_init()
  - mlx_new_window()
  - mlx_clear_window()
  - mlx_destroy_window()
  - mlx_pixel_put()
  - mlx_new_image()
  - mlx_get_data_addr()
  - mlx_put_image_to_window()
  - mlx_destroy_image()

dev:
- Makefile: add rule check_headers
- Makefile: add variable FLAGS
    (call 'make rule FLAGS=flags'
	to add flags to compilation)
- add /dev/norm.sh: nicer norminette
- add tester in main(), and related utilsconsole.*

docs:
- make clear mlx_get_data_addr() docs
2024-10-06 16:53:59 +02:00

29 lines
624 B
C

/**
* mlx_init.c
* for the project "MinilibX for 3DS"
* by Zy
* at https://github.com/frzysk/mlx3ds
*/
#include "mlx_init.h"
#include "mlx_internal.h"
#include <stdlib.h>
#include "3ds.h"
static t_internal_mlx g_internal_mlx = {
.is_init_called = false,
.top_window = NULL,
};
t_mlx mlx_init(void)
{
if (g_internal_mlx.is_init_called)
mlx3ds_internal_fatalerror("mlx_init() must be called only once");
g_internal_mlx.is_init_called = true;
gfxInitDefault();
gfxSetDoubleBuffering(GFX_TOP, false);
gfxSetDoubleBuffering(GFX_BOTTOM, false);
consoleInit(GFX_BOTTOM, NULL);
return (&g_internal_mlx);
}