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

SDL2: examples/overlay.py not working #1199

Closed
1 of 4 tasks
charlesej opened this issue Jul 26, 2019 · 5 comments
Closed
1 of 4 tasks

SDL2: examples/overlay.py not working #1199

charlesej opened this issue Jul 26, 2019 · 5 comments
Labels
examples moderate An intermediate challenge to solve SDL2

Comments

@charlesej
Copy link
Contributor

charlesej commented Jul 26, 2019

The examples/overlay.py code is not working. The main issue appears to be that SDL_Overlay support has been removed in SDL2.0.

To Do

  • python 3 execution has a str/bytes issue,
  • the opened file not being closed.
  • Unit tests for overlay module.
  • overlay module working on SDL2.

The following code runs the overlay example code. Different versions of python and pygame were tested with the results shown below. The overlay example code works using python 2.7.10 and pygame 1.9.4 and fails with the other combinations.

# Filename: overlay_examples_issue.py
import os

import pygame
import pygame.examples
import pygame.examples.overlay as overlay

# Run the overlay example code.
DATA_DIR = os.path.join(os.path.split(pygame.examples.__file__)[0], 'data')
overlay.main(os.path.join(DATA_DIR, 'yuv_1.pgm'))

Output with python 3.7.2 and pygame 2.0.0.dev3.

pygame 2.0.0.dev3 (SDL 2.0.9, python 3.7.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
Unknown format( len 2 ). Exiting...

Output with python 2.7.10 and pygame 2.0.0.dev3.

pygame 2.0.0.dev3 (SDL 2.0.9, python 2.7.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "overlay_examples_issue.py", line 10, in <module>
    overlay.main(os.path.join(DATA_DIR, 'yuv_1.pgm'))
  File "C:\Program Files\Python27\lib\site-packages\pygame-2.0.0.dev3-py2.7-win-amd64.egg\pygame\examples\overlay.py", line 52, in main
    vPlayer(fname)
  File "C:\Program Files\Python27\lib\site-packages\pygame-2.0.0.dev3-py2.7-win-amd64.egg\pygame\examples\overlay.py", line 36, in vPlayer
    ovl= pygame.Overlay(pygame.YV12_OVERLAY, (w,h))
AttributeError: 'module' object has no attribute 'YV12_OVERLAY'

Output with python 3.7.2 and pygame 1.9.4.

pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Unknown format( len 2 ). Exiting...

Output with python 2.7.10 and pygame 1.9.4. The overlay code works in this instance.

pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html

System details:

  • os: windows 10 (64bit)
  • python: 3.7.2 (64bit) and 2.7.10 (64bit)
  • pygame: 1.9.4 and 2.0.0.dev3 (SDL: 2.0.9) at c8c9e82

Related Docs: https://www.pygame.org/docs/ref/overlay.html

@MyreMylar
Copy link
Contributor

@MyreMylar
Copy link
Contributor

The str/bytes issue has now been fixed.

@ThanhChinhBK
Copy link
Contributor

Hello, i would like to work on this issue. Can I investigate it and create a PR in like a week?

@Starbuck5
Copy link
Contributor

I think we've given up on the overlay module. It's an SDL1 thing that's not present in SDL2. I just removed the last code remnants of it in a recent PR. If the example is still around it should be removed as well.

@MyreMylar
Copy link
Contributor

The example is now gone as well. Overlay is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples moderate An intermediate challenge to solve SDL2
Projects
None yet
Development

No branches or pull requests

4 participants