clear_window¶
MiniLibX: mlx_clear_window
Fills the whole window with black.
Parameters¶
| Name | Type | Description |
|---|---|---|
mlx |
Mlx |
The connection from init |
win |
Window |
The window to clear |
Returns¶
None.
Raises¶
| Exception | When |
|---|---|
RuntimeError |
The window was closed: window is closed |
Notes¶
- Windows keep their pixels between frames. If things move, clear at the start of each frame in your loop hook, then redraw.
- If you draw a background image that covers the whole window every frame, you don't need to clear.
- Black is the only option. For another background color, put a full-window image filled with that color.
Example¶
def frame(st):
malibx.clear_window(mlx, win)
malibx.put_image_to_window(mlx, win, player, st["x"], st["y"])