Difference between revisions of "love.(underscore)os"
m (→love._os) |
|||
(One intermediate revision by the same user not shown) | |||
Line 11: | Line 11: | ||
Other good example is that if a device is known for having trouble running your game warn the user of such problems, a more shady use of this example is blocking/filtering/redirecting a device from an online service/feature that the game has, either because it gives too much advantage or makes problems on your server where you host it (a.k.a separating mobile/desktop/console users from each other unless they want to compete with other platforms or a platform does ''*not*'' meet your standards being blocked right away, either by processing power or unfair advantage) | Other good example is that if a device is known for having trouble running your game warn the user of such problems, a more shady use of this example is blocking/filtering/redirecting a device from an online service/feature that the game has, either because it gives too much advantage or makes problems on your server where you host it (a.k.a separating mobile/desktop/console users from each other unless they want to compete with other platforms or a platform does ''*not*'' meet your standards being blocked right away, either by processing power or unfair advantage) | ||
− | This variable can *Officialy* have | + | This variable can *Officialy* have 6 outcomes that most of the time are self explanatory "Windows" "Android" "OS X" "Linux". Also take note that the ports can make use of this variable making them unreliable on non official supported platforms ports. |
+ | |||
+ | The official outcomes as shown in the source of v11.5 (/src/modules/system/Sytem.cpp:65) are: | ||
+ | |||
+ | MacOS: "OS X" | ||
+ | IOS: "iOS" | ||
+ | Windows universal windows package: "UWP" | ||
+ | Windows binary executable: "Windows" | ||
+ | Android: "Android" | ||
+ | Linux based systems: "Linux" | ||
+ | |||
+ | In official builds of love when none of this are the platform being run on it returns "Unknown" |
Latest revision as of 00:47, 13 January 2024
love._os
This is an platform dependent string that tells your game in what platform is running on.
This is useful when trying to make a multi-platform game where you can account on the capabilities of such device A good example of this is when a game detects that is running on mobile it'll show the on-screen gamepad if no physical input devices like a gamepad or mouse & keyboard are present.
Another good example is being a perfectionist and following theming rules of the device like accent color and dark mode, since there's no internal *generic* API call that love could provide us like lets *make stuff up* an so we call love.graphics.getSystemTheme() or something, we have to implement it ourselves and this depends of the platform: on windows is a registry key, on android we have to call a C++ function or something along those lines, on linux is even harder it depends on the window manager, desktop enviroment and what distro is the user running on, And for mac and iphone honestly it is not in my realm of knowledge.
Other good example is that if a device is known for having trouble running your game warn the user of such problems, a more shady use of this example is blocking/filtering/redirecting a device from an online service/feature that the game has, either because it gives too much advantage or makes problems on your server where you host it (a.k.a separating mobile/desktop/console users from each other unless they want to compete with other platforms or a platform does *not* meet your standards being blocked right away, either by processing power or unfair advantage)
This variable can *Officialy* have 6 outcomes that most of the time are self explanatory "Windows" "Android" "OS X" "Linux". Also take note that the ports can make use of this variable making them unreliable on non official supported platforms ports.
The official outcomes as shown in the source of v11.5 (/src/modules/system/Sytem.cpp:65) are:
MacOS: "OS X" IOS: "iOS" Windows universal windows package: "UWP" Windows binary executable: "Windows" Android: "Android" Linux based systems: "Linux"
In official builds of love when none of this are the platform being run on it returns "Unknown"