set_mouse_range(3alleg4)

✨ set_mouse_range ✨

okay bestie, welcome to the Allegro manual (that's 3alleg4 if you're keeping receipts) πŸ’– this one's a lil function that fences your mouse in, and honestly? iconic behavior.


πŸŽ€ NAME πŸŽ€

set_mouse_range β€” sets the area of the screen restricting mouse movement. it's giving Allegro game programming library ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

void set_mouse_range(int x1, int y1, int x2, int y2);

🌸 DESCRIPTION 🌸

so what this does is set the area of the screen within which the mouse can move. you pass it the top left corner and the bottom right corner β€” and yes bestie, those corners are inclusive, so the edges count, no sneaky extra pixel πŸ™ˆ

the way that this is basically a little playpen for your cursor... obsessed πŸ’…

and here's the tea: if you don't call this function, the range just defaults to (0, 0, SCREEN_W-1, SCREEN_H-1). so your mouse gets the whole screen by default, periodt ✨


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, iykyk 🫢


alright that's the whole page, no cap 🌈 this beauty came from Allegro, version 4.4.3, and yeah the manual itself calls it set_mouse_range(3alleg4) πŸ’œ mwah, slay, go trap that mouse 🐭✨