Macbook Pro's Touch Bar + Love2D... how do I start?

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.
Post Reply
Ivan.Dionízio
Prole
Posts: 8
Joined: Sat Jul 31, 2021 12:46 am

Macbook Pro's Touch Bar + Love2D... how do I start?

Post by Ivan.Dionízio »

Hi, i'd like to know how do I access macbook's touch bar to work with love2d? Is it possible? I think we could make a good use of it on our games.

I've researched a lot about how to use it on games and there are some options such as:
- Apple's Spritekit on XCode;
- MonoGame or FNA + Xamarin: https://github.com/xamarin/mac-samples/ ... BarExample
- QT + QT Touch Bar: https://github.com/KDAB/KDMacTouchBar
- Electron + Electron TouchBar (doesn't require XCode): https://github.com/pahund/electron-touch-bar
- SDL: https://github.com/joncampbell123/dosbox-x/issues/967

Regarding the SDL way, joncampbell123 user said "There is no need, and no API, for your app to know whether or not there is a Touch Bar available. Whether your app is running on a machine that supports the Touch Bar or not, your app’s onscreen user interface (UI) appears and behaves the same way. That's nice, so instead of creating a touch bar object only if one is present, applications have to create one and set it (and waste memory on systems that don't have one!) at all times.", then, "I am only able to add touch bar support to SDL1 builds because adding touch bar support requires modifying the NSApplication and NSWindow objects inside the SDL1 library. I do not modify the SDL2 library because the goal is to keep DOSBox-X compatible with the actively developed main SDL2 project. SDL1 builds have touch bar support, SDL2 builds do not."

Plus I found this: https://www.rderewianko.com/detecting-a-touchbar-mac/

So, there are lots of info, but what I really wanna know is, can anyone help me or at least give me a clue on how to start making a working touchbar library for love2d? For Mac users who wanna help, you can use a Touch Bar Simulator, it doesn't require XCode and works in any Mac: https://github.com/sindresorhus/touch-bar-simulator.

I really appreciate your help, if possible :) Thank you!
User avatar
ReFreezed
Party member
Posts: 421
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Macbook Pro's Touch Bar + Love2D... how do I start?

Post by ReFreezed »

You probably have to access this kind of system functionality through the FFI library, i.e. by calling C functions, unless you wanna/need to dive into LÖVE's C++ code to make the desired changes and compile everything from scratch.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
Ivan.Dionízio
Prole
Posts: 8
Joined: Sat Jul 31, 2021 12:46 am

Re: Macbook Pro's Touch Bar + Love2D... how do I start?

Post by Ivan.Dionízio »

Hmm.. this FFI library can give me at least a chance to make the touchbar work with löve through C functions. Neat. I will try that from now on. From all the options I mentioned above, the electron way was the easiest. But I think dealing with javascript would be very hard, so I think I'll stick with C for now. Thanks
User avatar
Jasoco
Inner party member
Posts: 3716
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Macbook Pro's Touch Bar + Love2D... how do I start?

Post by Jasoco »

The TouchBar is sadly (or not sadly) being phased out so I wouldn't put too much effort into it. New high-end MBPs don't have them anymore and the lower ones that do will definitely lose them with the next revision.
Ivan.Dionízio
Prole
Posts: 8
Joined: Sat Jul 31, 2021 12:46 am

Re: Macbook Pro's Touch Bar + Love2D... how do I start?

Post by Ivan.Dionízio »

Jasoco wrote: Fri May 06, 2022 5:47 pm The TouchBar is sadly (or not sadly) being phased out so I wouldn't put too much effort into it. New high-end MBPs don't have them anymore and the lower ones that do will definitely lose them with the next revision.
Funny thing is I found out about that just one day after creating this topic :ultrahappy: (crying inside). It had a lot of potential, though. I was having fun with some open-source little games projects on github. Guess it's time to move on. Thank you all! :vamp:
User avatar
Jasoco
Inner party member
Posts: 3716
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Macbook Pro's Touch Bar + Love2D... how do I start?

Post by Jasoco »

Ivan.Dionízio wrote: Sat May 14, 2022 11:18 am Funny thing is I found out about that just one day after creating this topic :ultrahappy: (crying inside). It had a lot of potential, though. I was having fun with some open-source little games projects on github. Guess it's time to move on. Thank you all! :vamp:
Well, I mean people still develop for old consoles. The technology exists now even if it's on its way out. So feel free to try. Just remember it's not going to be something a lot of people can use anymore. It'd be like developing for the gyroscope tilt sensors Apple used to put in pre-Retina MacBooks that they used to park the HDD heads to save from damage. It was a cool technology to play with for a while, but it was gone before you could really use its full potential because there was no reason to keep it around once they switched to all flash storage.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 7 guests