#include "cube3d.h" static int pxl_out_limits(t_game *game, int x, int y) { int xmax; int ymax; xmax = game->sizel / (game->bpp / 8); ymax = game->win_size_y; if (x < 0 || y < 0 || x > xmax || y > ymax) return (1); return (0); } static void draw_pixel(t_game *game, int x, int y, int color) { unsigned int position; if (pxl_out_limits(game, x, y)) return ; position = y * game->sizel + x * (game->bpp / 8); *(unsigned int*)(game->img_data + position) = color; } void draw(t_game *game) { // temp, draw a map of points int x; int y; int x_size; // unsigned int screen_size; x_size = game->sizel / (game->bpp / 8); // screen_size = x_size * game->win_size_y / 5; x = 0; y = 0; while (y <= game->win_size_y) { // y = x % x_size * 5; draw_pixel(game, x, y, 0x00999999); x += 5; if (x > x_size) { x = 0; y += 5; } } // temp draw_pixel(game, game->plr_x, game->plr_y, 0x0000FF00); mlx_put_image_to_window(game->mlx_ptr, game->win_ptr, game->img_ptr, 0, 0); }