Now that we have basic window management, we can get started with drawing pixels to the window.
To do so you can use mlx_pixel_put by giving it your mlx pointer, your window pointer, coordinates where to draw it and its color (see colors to learn about mlx_color):
You can use it to draw as much pixels as you want
By including mlx_extended.h you also get access to mlx_pixel_put_array and mlx_pixel_put_region.
The first one lets you put an array of pixels contiguously. The second one lets you put a squared region of pixels.
🏙️ Drawing images
The MacroLibX is also capable of loading and rendering images from disk. It accepts PNGs, JPEGs, and BMPs.
The difference with put pixel is that the image is a resource and must be destroyed when it is no longer needed.
We’ll see later how we can create empty images and how to manipulate them.
By including mlx_extended.h you also get access to mlx_put_transformed_image_to_window.
This one lets you put an image to a window and transform how it appears by scaling it or rotating it.