Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dunai-examples: Convert examples from SDL1 to SDL2 #446

Open
ivanperez-keera opened this issue Nov 2, 2024 · 13 comments
Open

dunai-examples: Convert examples from SDL1 to SDL2 #446

ivanperez-keera opened this issue Nov 2, 2024 · 13 comments

Comments

@ivanperez-keera
Copy link
Owner

ivanperez-keera commented Nov 2, 2024

SDL 1 is deprecated. It seems to no longer compile well with modern versions of GHC.

Porting the examples to SDL 2 would make them more relevant to current developers, and keep our CI infrastructure working well.

@ivanperez-keera
Copy link
Owner Author

ivanperez-keera commented Nov 2, 2024

Help is sought for this. There are four modules that use SDL:

dunai-examples/bouncingball/BouncingBall.hs
dunai-examples/classicfrp/GTest.hs
dunai-examples/classicfrp/Test.hs
dunai-examples/list/BouncingBall.hs

If someone is able to work on this, please do the following:

  • Send a PR that references this issue.
  • Add one commit to upgrade each of the examples. Make sure each of those commits updates both the Haskell code and the corresponding cabal file.
  • For each commit, add the following commit message, adjusting <NAME_OF_EXAMPLE> to the example you are modifying:
dunai-examples: Upgrade example to use SDL2. Refs #446.

SDL 1 is deprecated, and no longer maintained. To keep the example
working with more modern versions of packages in the Haskell ecosystem,
this commit ports <NAME_OF_EXAMPLE> to use SDL2.
dunai: Upgrade CI script to use SDL2. Refs #446.

SDL 1 is deprecated, and no longer maintained. All examples have consequently
been upgraded to use SDL2. This commit updates the CI installation script to
install the SDL2 development libraries instead of the SDL 1.2 version, to keep
the job working.

EDIT: Two more steps added to upgrade the travis file too.

@mchav
Copy link
Contributor

mchav commented Nov 4, 2024

Thanks for the clear instructions. I'll start working on the bouncing ball example to start.

@ivanperez-keera
Copy link
Owner Author

Great! Feel free to send a PR when you have something you want me to take a look at, or just ask any questions you have.

mchav added a commit to mchav/dunai that referenced this issue Nov 4, 2024
SDL 1 is deprecated, and no longer maintained. To keep the example
working with more modern versions of packages in the Haskell ecosystem,
this commit ports bouncingball to use SDL2.
mchav added a commit to mchav/dunai that referenced this issue Nov 4, 2024
SDL 1 is deprecated, and no longer maintained. All examples have consequently
been upgraded to use SDL2. This commit updates the CI installation script to
install the SDL2 development libraries instead of the SDL 1.2 version, to keep
the job working.
mchav added a commit to mchav/dunai that referenced this issue Nov 4, 2024
SDL 1 is deprecated, and no longer maintained. To keep the example
working with more modern versions of packages in the Haskell ecosystem,
this commit ports bouncingball to use SDL2.
mchav added a commit to mchav/dunai that referenced this issue Nov 4, 2024
SDL 1 is deprecated, and no longer maintained. To keep the example
working with more modern versions of packages in the Haskell ecosystem,
this commit ports bouncingball to use SDL2.
mchav added a commit to mchav/dunai that referenced this issue Nov 4, 2024
SDL 1 is deprecated, and no longer maintained. To keep the example
working with more modern versions of packages in the Haskell ecosystem,
this commit ports bouncingball to use SDL2.
mchav added a commit to mchav/dunai that referenced this issue Nov 4, 2024
SDL 1 is deprecated, and no longer maintained. To keep the example
working with more modern versions of packages in the Haskell ecosystem,
this commit ports bouncingball to use SDL2.
mchav added a commit to mchav/dunai that referenced this issue Nov 4, 2024
SDL 1 is deprecated, and no longer maintained. To keep the example
working with more modern versions of packages in the Haskell ecosystem,
this commit ports BouncingBall to use SDL2.
@mchav
Copy link
Contributor

mchav commented Nov 4, 2024

The example dunai-examples/list/BouncingBall.hs doesn't seem to work.

  1. You can't cabal run in the directory because it's not part of cabal.project.
  2. It doesn't compile unless you remove the type signatures
BouncingBall.hs:31:15: error:
    • Couldn't match type ‘Identity’ with ‘IO’
      Expected: bearriver-0.14.11:FRP.BearRiver.InternalCore.SF
                  IO (Float, Float, Bool, Bool) [(Float, Float)]
        Actual: MSF
                  (ClockInfo Identity) (Float, Float, Bool, Bool) [(Float, Float)]
  1. Even after all this the example freezes on mouse press.

Will fix this example as I port it.

@ivanperez-keera
Copy link
Owner Author

mchav added a commit to mchav/dunai that referenced this issue Nov 5, 2024
SDL 1 is deprecated, and no longer maintained. To keep the example
working with more modern versions of packages in the Haskell ecosystem,
this commit ports BouncingBall-list to use SDL2.
@ivanperez-keera
Copy link
Owner Author

ivanperez-keera commented Nov 5, 2024

I think sometimes the CI build job is not completing for this reason:

haskell-game/sdl2#310

@mchav
Copy link
Contributor

mchav commented Nov 5, 2024

Thanks for addressing that.

Figured out the cause of 3. We have to use notYet here to delay the switching event. Is this the right intuition or am I missing something here?

@ivanperez-keera
Copy link
Owner Author

Hmm. Does that happen also with SDL1?

@mchav
Copy link
Contributor

mchav commented Nov 5, 2024

Yes. The example as is doesn't work. Both in SDL1 and when ported to SDL2. There seems to be an infinite loop when switching.

@ivanperez-keera
Copy link
Owner Author

ivanperez-keera commented Nov 5, 2024

Ok. Let me try and reproduce that.

In the meantime, I've sent a patch to the sdl2 project to get sdl2 compiling with older versions of GHC: haskell-game/sdl2#311. That should partly address the issue compiling in the CI server.

@ivanperez-keera
Copy link
Owner Author

The sdl2 patch has now been merged.

I don't know when the sdl2 project plans to make a new release, but we can for now use the github repo to test that everything works.

@mchav
Copy link
Contributor

mchav commented Nov 9, 2024

Did you manage to reproduce 3?

@ivanperez-keera
Copy link
Owner Author

Just to document things here too: I was able to reproduce (3) and we created a separate issue to track that error (#457 ), which @mchav just fixed (#458) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants