mouse_on_screen(3alleg4)
β¨ mouse_on_screen β¨
okay bestie, welcome to the Allegro manual π this one's about mouse_on_screen, and it's from the Allegro game programming library. yes, that Allegro. the game programming one. iykyk π
SYNOPSIS πΈ
#include <allegro.h>
int mouse_on_screen();
that's it. one lil function. no args. no drama. she just tells you a thing π
DESCRIPTION π¦
so here's the vibe: mouse_on_screen() tells you whether the mouse pointer is currently on screen. that's the whole job. she's not complicated, she's just honest π«Ά
and lowkey she's so useful for the windowed mode girlies. like, if you're running your program in windowed mode and you're drawing the mouse pointer yourself, you do not want two mouse pointers chilling on screen at the same time. that's giving double-vision, not giving slay π so you use this function to prevent that. iconic behaviour honestly.
other possible uses, because she's versatile like that:
- pausing your game when the mouse goes off of the window β¨
- only scrolling the view when the pointer is near the edge of the window, but not while off of the window π
Example :
if (mouse_on_screen()) {draw_sprite(buffer , mouse_sprite , mouse_x , mouse_y);}
see how that works? mouse on screen β draw the sprite. mouse off screen β don't. the way that she's literally just doing her little job and eating every single time π
RETURN VALUE β
- Returns
0if the mouse pointer is off of the screen π - Returns non-zero otherwise πΈ
so basically: truthy = mouse is home π , falsy = mouse has left the building π§
no cap, that's the entire page. short, sweet, and she ate π
mwah, love u, bye π this lil page is from Allegro, version 4.4.3, and she's filed under mouse_on_screen(3alleg4). go draw some sprites, bestie πβ¨
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms