JuliaMultimedia / SimpleDirectMediaLayer.jl

SDL2
MIT License
81 stars 18 forks source link

TTF no longer works? #2

Closed NHDaly closed 2 years ago

NHDaly commented 6 years ago

Hi! So it seems that for some reason SDL_ttf no longer works... It crashes for me when executing SDL2.CreateTextureFromSurface(renderer,text). I assume for you as well, since you commented out the ttf code from SDL2.jl in daaee6c.

But it's strange, I can't figure out why it's broken! I tried reverting the changes in 68b1767 that removed the SDL_ prefix (imagining that maybe there's a name collision going on somehow), but that didn't fix it.

The reason I'm so surprised, is that I've been happily working with this package for a few weeks, and TTF has worked just fine that whole time... But I can't for the life of me tell what's different between HEAD and what I'd been messing around with! I've pushed all of my changes here: NHDaly/SDL2.jl/tree/outdated--custom_mods. Unfortunately, like I said, I forked really early, so the last commit we have in common is 7e0d03e ("initial commit").

$ git log --all --graph --decorate --oneline
* daaee6c (HEAD -> master, origin/master, SDL_mixer) windows build
* 02da3a1 test
* 804804d REQUIRE
* 667d499 Linux build
* 345c2bc updated README
* 716b0d8 event handling
* 7bc5f4e things
* 88c360a fix example
* 68b1767 build and removed SDL_ prefix
| * 00ca98f (nhdaly/outdated--custom_mods, outdated--custom_mods) Parking this branch! Contains a bunch of my edits.
| * 8ae739c Manually defined some macros that were skipped.
| * 04936f8 Move all global initializations into Init function.
| * e3f13b2 Added SDL2_mixer!
| * f5d2dfe (release-libs) Added pacakged libs for SDL2_mixer
| * fcac892 Switched to packaged libs
| * 052b036 NATHAN: added build script
| * 53967f3 Nathans Changes: SDL->SDL2 + portability
|/
* 7e0d03e initial commit
* 25b9f4b SDL.jl generated files.
* fac72db initial empty commit

So i'm trying to compare the two to see what's different, but haven't had any luck so far. Do you have any ideas? :) Once we figure this out, i can also send a separate PR to add SDL_mixer.

NHDaly commented 6 years ago

haha okay! So i found the problem. Sorry i pasted so much text up there. You can basically ignore all of that.

The issue was simply that we were using different versions of the SDL ttf library. :) Oops! Should be able to fix it with #4! :) Thanks again for this cool package!

jonathanBieler commented 6 years ago

The reason why I removed it is that I was trying the make the build work on windows, but the provided binaries don't work, I don't exactly remember why.

https://github.com/jonathanBieler/SDL2.jl/blob/master/deps/build.jl#L18

Does your PR works on windows and OS X?

Otherwise we could try to get a working dll somewhere and then distribute that with the package.

NHDaly commented 6 years ago

The reason why I removed it is that I was trying the make the build work on windows, but the provided binaries don't work, I don't exactly remember why.

Oh i see. Interesting. Well, either way, I think the change in #3 is a necessary change for mac/linux. Homebrew has two different repos for the SDL1 and SDL2 versions of SDL_ttf, and before #3 this code is using the older, SDL1 version:

$ brew info sdl_ttf
sdl_ttf: stable 2.0.11 (bottled)
Library for using TrueType fonts in SDL applications
https://www.libsdl.org/projects/SDL_ttf/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/sdl_ttf.rb
==> Dependencies
Build: pkg-config ✔
Required: sdl ✘, freetype ✔
$ brew info sdl2_ttf
sdl2_ttf: stable 2.0.14 (bottled)
Library for using TrueType fonts in SDL applications
https://www.libsdl.org/projects/SDL_ttf/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/sdl2_ttf.rb
==> Dependencies
Build: pkg-config ✔
Required: sdl2 ✘, freetype ✔

We want the second one, which PR #3 should fix. :)

NHDaly commented 6 years ago

As to the windows problem...

Does your PR works on windows and OS X?

Huh, i'm surprised it didn't work on windows, because the line you linked above is actually correct! It was only the mac/linux versions that have the wrong-version problem. I've set up an appveyor account so i can test on windows (since i don't have access to a windows machine.)

I'm playing with trying to fix the windows build in this PR: https://github.com/NHDaly/SDL2.jl/pull/1

(It looks like the appveyor config is out of date so i'm gonna try to fix that first and then try turning on SDL_ttf again) If i can figure it out, i'll send a PR over here!! :)


Otherwise we could try to get a working dll somewhere and then distribute that with the package.

Yeah, if for some reason it's the binary that's the problem, I think that would work, yeah!

jonathanBieler commented 6 years ago

The issue I had is when BinDeps tests the library (it opens it and test that it works), but I'm not sure what the issue was exactly, maybe I messed something up.

NHDaly commented 6 years ago

:/ yeah okay i see what you mean. It's the same for me.

But it's weird, because when I tried just manually creating the deps/deps.jl file myself, and listing the correct binary path for SDL2_ttf.dll, it seems like the actual example1_cairo.jl file works correctly! So idk why BinDeps complains about it...


I opened #5 so that we can have a successful windows build to compare with.

NHDaly commented 4 years ago

Is TTF finally working correctly on windows, now, after #41? :)

giordano commented 4 years ago

There are tests for ttf that are passing on Windows on AppVeyor, but maybe @aviks can tell more about actual use rather than a CI service.

aviks commented 2 years ago

This should be closed, TTF works, it's used in Gamezero now certainly.