love.platform

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

love.platform

Post by BlackBulletIV »

Just a suggestion, it might be nice to make a love.platform variable inside of the love module. This could be set based in the headers set in the config header file.

It might be set to the string "Windows", "Mac" (OS9 and under), "OSX", or "Linux", appended with "32" or "64" based on whether it's 32 or 64 bit.

Example:

Code: Select all

if love.platform == "OSX32" or love.platform == "OSX64" then
    print("Sweet computer.")
end
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: love.platform

Post by Taehl »

What do we need it for? Personally, I would be happy if Love games remained blind to the OS they're on. Most importantly, that would encourage Lovers to use different code depending on the platform the game is on, which can only culminate in bad, bad programming practices. But secondly, I see this happening:

Code: Select all

 if string.sub(love.platform, 0,3) == "OSX" then score = score*2 end 
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: love.platform

Post by Robin »

The only exception I could see is allowing the game to check if it's on a device that can do less (or more) than vanilla LÖVE.
Help us help you: attach a .love.
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: love.platform

Post by bartoleo »

I think it's not Essential, but It could be useful in the future (handeld... mobile...)
Bartoleo
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: love.platform

Post by kikito »

Robin wrote:The only exception I could see is allowing the game to check if it's on a device that can do less (or more) than vanilla LÖVE.
In that case, I'd suggest adding capability detection instead of computer id detection; for example, love.can.saveFiles instead of love.os.name.
When I write def I mean function.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: love.platform

Post by Taehl »

I find kikito's proposal MUCH better. Harder to abuse the feature, and easier to be put to its intended purpose.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: love.platform

Post by BlackBulletIV »

Hmmmm, I never thought of people abusing the feature. Yeah, it's probably not a good idea.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: love.platform

Post by tentus »

kikito wrote: In that case, I'd suggest adding capability detection instead of computer id detection; for example, love.can.saveFiles instead of love.os.name.
love.can.hasCheeseBurger?

But seriously, it would be nice to know if someone is using, say, a touchscreen or something. I've been tripped up by Wacom users before.
Kurosuke needs beta testers
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: love.platform

Post by bmelts »

The one thing I can think of off the top of my head that platform detection would be useful for (beyond what's been mentioned in this thread already) is key modifiers, e.g. binding quit to Control-Q on Windows and Command-Q on Macs. On the other hand, that sort of thing might be more easily fixed with a special "modifier" key constant that's bound to the appropriate key on each OS.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: love.platform

Post by Robin »

But Alt+F4 is a more standard close/quit key for Windows and Linux and already enabled by default. Dunno about OSX.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: No registered users and 209 guests