mlx3ds/source/mlx_put.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

32 lines
713 B
C

/**
* mlx_put.c
* for the project "MinilibX for 3DS"
* by Zy
* at https://github.com/frzysk/mlx3ds
*/
#include "mlx_put.h"
#include "mlx_internal.h"
#include "mlx_inline.c"
int mlx_pixel_put(t_mlx mlx_ptr, t_win win_ptr, int x, int y, int color)
{
u8 *frame;
mlx3ds_internal_drawstart(mlx_ptr, win_ptr);
if (x < 0 || x >= ((t_internal_win *)win_ptr)->framebuffer_width
|| y < 0 || y >= ((t_internal_win *)win_ptr)->framebuffer_height)
return (0);
frame = ((t_internal_win *)win_ptr)->framebuffer;
mlx_inline_drawcolor(
frame + 3 * (
(x + 1) * ((t_internal_win *)win_ptr)->framebuffer_height - y - 1
),
(u8 *)&color);
mlx3ds_internal_drawend(mlx_ptr, win_ptr);
return (0);
}