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

Improve MacOS default image #2791

Closed
3 tasks done
Starbuck5 opened this issue Oct 24, 2021 · 9 comments · Fixed by #2858
Closed
3 tasks done

Improve MacOS default image #2791

Starbuck5 opened this issue Oct 24, 2021 · 9 comments · Fixed by #2858

Comments

@Starbuck5
Copy link
Contributor

Starbuck5 commented Oct 24, 2021

Currently, on MacOS, the default image isn't exactly pretty on the eyes
dock

I did some investigating, and we have explicit code to put in a much higher resolution image, but it is overridden by the default call to SDL_SetWindowIcon.

On Windows, that puts the image in the top left corner of the window. A tiny space, where pygame_icon.bmp (32x32) is appropriate.

However, on Mac, the icon goes to the dock at the bottom of the screen, which has more screen real estate. So it should get pygame_icon.tiff (128x128).

The pygame code actually tries to give out pygame_icon.tiff on Mac! base.c calls VideoAutoInit in macosx.py, which calls _NSBundleApplication to set the ApplicationIconImage with the bytes of pygame_icon.tiff. But then this is quickly overridden by the SDL_SetWindowIcon in display.set_mode(), I believe.

Tasks

  • figure out if this is a regression from 1.9.6. It is. (Maybe the logic in set_mode changed, because SDL_SetWindowIcon still seems to work the same way when called with display.set_icon)

regression

  • change default icon (in display.c, I believe) to point to the higher res one on Mac
  • remove macosx.py and _InstallNSApplication (sdlmain_osx.m)?
@rethanon
Copy link
Contributor

rethanon commented Oct 27, 2021

Setting pygame to use the 128 x 128 pygame_icon.tiff file doesn't seem to work on my system. instead the icon for the python launcher is used. However if I convert the .tiff file to .bmp of the same size (128 x 128) it works just fine. I can open the .tiff file on my Mac independently to view it, just doesn't work setting it as the icon. Is there a reason a .tiff file wouldn't work on Mac? Anyone else able to verify?

Using the .tiff icon file:
Screenshot 2021-10-27 at 22 27 18

Using same file converted to .bmp:
Screenshot 2021-10-27 at 22 30 20

@Starbuck5
Copy link
Contributor Author

The icon appears in a complete pygame program: it needs a screen and an event queue to be handled. Just making sure you’ve got that consistently—

Are you changing the c code right now, or trying to call display.set_icon with the tiff?

@rethanon
Copy link
Contributor

Yeah I tested running a full program with event queue etc. I was changing the c code. Using pygame.display.set_icon(pygame.image.load('pygame_icon.tiff')) works fine.

@Starbuck5
Copy link
Contributor Author

If you sent me a branch or a patch or something for the C code I could test locally. But this seems like more of a human error thing, since it uses the same code path as set_icon, just internally.

@TomSchimansky
Copy link

I just saw this issue while searching for something else, and I thought why don't pygame uses a standard squircle shape icon. It's standard since macOS 11 and nearly every other app uses it. I think it looks much better. So I simply put the .svg file from this repository onto the standard icon shape provided by apple, and tried two different background Colors:

pygame icons screenshot

I think the white one looks better, so if you want to use this for pygame I exported it in a few formats (png, svg, tiff, icns):
pygame macOS icons.zip

@Starbuck5
Copy link
Contributor Author

It's standard since macOS 11

You answered your own question there 😄

Jokes aside these are quite cool. I'm down to use em.

Do you know what pixel size is conventional? 1024x1024 looks great, but it will never use that level of detail on the dock.

@TomSchimansky
Copy link

I think 1024x1024 is standard for icons and all programs and websites to create an .icns file scale the image up to 1024 but I created an .icns manually with a max resolution of 256x256 which should be enough and uses 230KB of memory, so not very much:
pygame icon 256px.zip

@Starbuck5
Copy link
Contributor Author

Man, this looks so much nicer!

Screen Shot 2021-11-19 at 1 38 19 AM

I do think that this is an outdated snake head design though. It's slightly squarer and has a lighter yellow color than the newer design. Also it seems very aliased for what it is... did you scale it down directly from the 1024x1024 one?

@Mega-JC recently updated some of our logos with higher definition versions, the best versions are all sitting in docs/. (Although they might get moved soon, they're there for now).

If you're nice enough to whip up a 256x256 icns and tiff file, I think it will be pretty easy for me to add as the default icon on macOS.

@TomSchimansky
Copy link

TomSchimansky commented Nov 19, 2021

You're right the version in the docs is newer and looks better, so here it is with the new one:
pygame macOS icons 256px.zip

Oh and yes, the edges looked a bit aliased, now it is better.

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

Successfully merging a pull request may close this issue.

3 participants