szotp / swift-sfml-wrapper

Mostly generated Swift wrapper for SFML2 game library
MIT License
2 stars 0 forks source link

Swift 3.0 ? #1

Open ghost opened 8 years ago

ghost commented 8 years ago

Hello

I just tried to build a hello world but 'Extras' and 'Generated' gives me lot of errors with Swift 3.0

Do you plan to update it?

ghost commented 8 years ago

Sure, I will check, maybe over the weekend. It will be on separate branch because 3.0 is not released yet.

2016-06-06 0:45 GMT+02:00 Scellow notifications@github.com:

Hello

I just tried to build a hello world but 'Extras' and 'Generated' gives me lot of errors with Swift 3.0

Do you plan to update it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/krzat/swift-sfml-wrapper/issues/1, or mute the thread https://github.com/notifications/unsubscribe/AF6q1gsC1ZmRRAz_uX68fPmH96IjQhzNks5qI1F1gaJpZM4Iud5K .

ghost commented 8 years ago

Awesome thanks a lot!

ghost commented 8 years ago

Ok i tried to do it myself, it looks like you just generated the binding using a tool, i manually fixed the generated file

There is only 2 error i'm unable to solve: SoundRecorder and Thread class, other than that, it works fine

Some info:

COpaquePoint has been renamed to OpaquePointer only

If you want to call pointer() you need to specify the name of the argument

ex: pointer(value: &states)

i removed the assert and the nil check from OpaqueWrapper, debugger told me it's not necessary

I made the UnsafePointer from the function pointer optional -> UnsafePointer? so we can return nil

https://gist.github.com/Scellow/bfd6bee0c993dda9abd2f2fe21496a94

I'm still new to Swift, so i'm not sure about these changes, but it works fine with Swift 3.0

ghost commented 8 years ago

Another thing, i think it would be better if you split the different sfml packages graphics, system etc.. and put them in separate git repo, so it'll be easier to use them with the packagemanager

ex:

import PackageDescription

let package = Package (
name: "Client",
        dependencies: [
                .Package(url: "https://github.com/Scellow/swsfml_graphics.git", majorVersion:1),
                .Package(url: "https://github.com/Scellow/swsfml_system.git", majorVersion:1),
                .Package(url: "https://github.com/Scellow/swsfml_window.git", majorVersion:1),
                .Package(url: "https://github.com/Scellow/swsfml_audio.git", majorVersion:1),
                .Package(url: "https://github.com/Scellow/swsfml_network.git", majorVersion:1),
        ]
)

You can check the repo to see how i did that

One last thing, i had issues building it using the command swift build, it wasn't able to find the headers of SFML

I fixed it by using: swift build -Xcc -fblocks -Xswiftc -I/usr/local/include -Xlinker -L/usr/local/lib

I can't remenber if i had to do that for 2.x

ghost commented 8 years ago

My goal is to generate as much as possible, so I don't know how to separate all of this into packages.

Regarding update, I found out that ClangWrapper repo I used has not been updated for new Swift. I will wait a while, perhaps it will be easier to update with new Xcode, which should be released soon.