os_version(3alleg4)

πŸ’– os_version, os_revision πŸ’–

okay bestie, so this is the Allegro game programming library manual page for os_version and os_revision β€” literally the two little ints that tell you which Operating System you're vibing on rn. it's from the Allegro manual, section 3, and it's about to be your new fave πŸ¦‹


✨ SYNOPSIS ✨

like, the whole vibe in code form:

#include <allegro.h>

extern int os_version;

extern int os_revision;

yes bestie, just two extern ints. that's it. that's the whole API. no cap.


🌸 DESCRIPTION 🌸

so os_version and os_revision hold the major and minor version of the Operating System that's currently running. iconic behavior tbh πŸ‘‘

they get set for you by allegro_init(), so you don't have to lift a finger β€” Allegro does it automatically the moment you call it. main character energy fr fr πŸ’…

ngl, sometimes it just doesn't work out. if Allegro for some reason was not able to retrieve the version of the Operating System, then os_version and os_revision will both be set to -1. so if you see a -1 in there, that's the "bestie I tried but I couldn't" flag 😭

okay for example β€” and this is literally the example from the original, so stay with me: under Win98 SE (v4.10.2222), os_version will be set to 4 and os_revision to 10. see how it just grabs the first two numbers? the 2222 is doing its own thing, we don't talk about her πŸ™ˆ


πŸ‘€ SEE ALSO πŸ‘€

go read these next, they're literally the sibling pages:


and that's the whole page, bestie!! πŸ’–βœ¨ you understood it, you slayed it, periodt πŸŽ€

this was brought to you by <strong>Allegro, version 4.4.3</strong> β€” she's an icon, she's a legend, and she is the moment 🌈