Live data from Hacker News

Swift and the Cute 2d game framework: Setting up a project with CMake

layer22.com

1–10 of 85 posts

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#2
Snap, I did something similar a few weeks ago (without the cool PoC) - github.com/davidrpiper/SwiftCmakeModulemapMVP

Now that Swift + SourceKit LSP + VS Code is a viable environment, and CMake supports C/C++ and Swift interop out-of-the-box, I'm keen to start using Swift for more cross-platform things.

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#4

Maybe a dumb question, but can this be used to make games for other platforms than MacOS & iOS? My (limited) understanding is that Swift is mostly used to make iOS apps.

Yep, I've been meaning to get a Swift + SDL project working.

The language itself is not limited to Apple platforms, and there are compilers for many others, but until now all the surrounding tooling (IDEs, Swift Package Manager, build toolchain(s), C/C++ interop) has been less than ideal for all non-Apple platforms. Arguably less than ideal on Apple platforms too in some cases ;)

There is still a big difference between "I have Xcode" and "I have VSCode + a large manual toolchain", but the gap is closing. CMake can also generate Xcode projects which is a nice touch when bringing cross-platform code back to Apple platforms.

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#6
post #5

Maybe a dumb question, but can this be used to make games for other platforms than MacOS & iOS? My (limited) understanding is that Swift is mostly used to make iOS apps.

https://www.swift.org/install macOS, Linux, Windoze

Thanks. It looks like CMake + SDL2(3) would add some gaming platforms like Nintendo, etc. (if that's important to you).

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#9

Maybe a dumb question, but can this be used to make games for other platforms than MacOS & iOS? My (limited) understanding is that Swift is mostly used to make iOS apps.

Yep, I've been meaning to get a Swift + SDL project working. The language itself is not limited to Apple platforms, and there are compilers for many others, but until now all the surrounding tooling (IDEs, Swift Package Manager, build toolchain(s), C/C++ interop) has been less than ideal for all non-Apple platforms. Arguably less than ideal on Apple platforms too in some cases ;) There is still a big difference betwe…

https://github.com/KevinVitale/SwiftSDL is a good starting point and already supports macOS and Linux out of the box.

Re: Swift and the Cute 2d game framework: Setting up a project with CMake

#10

Snap, I did something similar a few weeks ago (without the cool PoC) - github.com/davidrpiper/SwiftCmakeModulemapMVP Now that Swift + SourceKit LSP + VS Code is a viable environment, and CMake supports C/C++ and Swift interop out-of-the-box, I'm keen to start using Swift for more cross-platform things.

I'm wondering if there will be anything new and cool announced next week during the WWDC in regards to Swift inter-op and cross-platform.
Post reply on HN