select_mouse_cursor(3alleg4)
β¨ select_mouse_cursor β¨
okay bestie, welcome to the select_mouse_cursor(3alleg4) page from the Allegro manual π this one is short, sweet, and lowkey iconic β it's all about whose mouse cursor you're looking at: the OS's own sparkly native one, or Allegro's homemade one. Let's get into it π
πΈ NAME πΈ
select_mouse_cursor β tells Allegro to select software or hardware cursor drawing.
π¦ SYNOPSIS π¦
#include <allegro.h>
void select_mouse_cursor(int cursor);
π DESCRIPTION π
So here's the vibe: this function lets you use the operating system's native mouse cursors instead of some custom cursor you cooked up yourself. That's the main character energy right there π«Ά
But β and this is important β you have to turn that functionality on first by calling enable_hardware_cursor() beforehand. Like, you can't just walk in and expect the native cursor to show up. Enable it first, bestie.
If the operating system doesn't support this whole native-cursor thing, or if you never enabled it, then Allegro will just substitute its own cursor images instead. No drama, it just does its own thing. And if you wanna change those substitute images, you can do that with set_mouse_cursor_bitmap() β¨
Heads up: the effects of this function are not apparent until you callshow_mouse(). So don't sit there staring at your screen wondering why nothing changed β you forgot theshow_mouse()call, bestie π
And if you wanna know whether you're actually getting the operating system's native cursor or whether Allegro made a substitution, you can check the GFX_SYSTEM_CURSOR flag inside gfx_capabilities β but only after you've called show_mouse(). Timing matters, fr fr.
The cursor argument picks which type of cursor gets displayed:
MOUSE_CURSOR_NONEβ selects an invisible mouse cursor. So like, in that sense it's basically the same as callingshow_mouse(NULL)π»MOUSE_CURSOR_ALLEGROβ selects the custom Allegro cursor, i.e. the one you set withset_mouse_sprite().MOUSE_CURSOR_ARROWβ the operating system's default arrow cursor. classic. the original. πMOUSE_CURSOR_BUSYβ the operating system's defaultbusycursor (hourglass). you know, the "girl help I'm working on it" one β³MOUSE_CURSOR_QUESTIONβ the operating system's defaultquestioncursor (arrow with question mark). it's giving confused π§MOUSE_CURSOR_EDITβ the operating system's defaulteditcursor (vertical bar). text-entry realness βοΈ
Example time, periodt:
/* initialize mouse sub-system */
install_mouse();
enable_hardware_cursor();
/* Set busy pointer */
select_mouse_cursor(MOUSE_CURSOR_BUSY);
show_mouse(screen);
/* Initialize stuff */
...
/* Set normal arrow pointer */
select_mouse_cursor(MOUSE_CURSOR_ARROW);
π₯ SEE ALSO π₯
install_mouse(3alleg4)show_mouse(3alleg4)set_mouse_sprite(3alleg4)gfx_capabilities(3alleg4)enable_hardware_cursor(3alleg4)set_mouse_cursor_bitmap(3alleg4)show_os_cursor(3alleg4)exsyscur(3alleg4)
and that's the whole page, bestie π this was Allegro version 4.4.3, and the original footer was all like select_mouse_cursor(3alleg4) β so go forth, pick your cursor, and slay β¨π
π¦ 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