Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tweaking version getters for sdl modules and freetype#3379

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Starbuck5 merged 14 commits intopygame:mainfromoddbookworm:getters
Nov 5, 2022

Conversation

@oddbookworm
Copy link
Contributor

@oddbookwormoddbookworm commentedAug 7, 2022
edited
Loading

I've worked on syncing up the version getterspygame.get_sdl_version,pygame.mixer.get_sdl_mixer_version,pygame.font.get_sdl_ttf_version,pygame.freetype.get_version, andpygame.image.get_sdl_image_version. Now they all accept a keyword arg to change whether they return the linked version of the indicated module or the compiled version.

By default,pygame.get_sdl_version,pygame.mixer.get_sdl_mixer_version, andpygame.font.get_sdl_ttf_version all return the linked version and use thelinked boolean keyword to toggle which version number is grabbed.linked=False will grab the compiled version.

By default,pygame.freetype.get_version, andpygame.image.get_sdl_image_version all return the compiled version and use thecompiled boolean keyword to toggle which version number is grabbed.compiled=False will grab the linked version.

This is behavior that already existed for some of these functions, and for those that I had to introduce the keyword toggle, I kept the old behavior as the default. Ideally, all 5 of them would use the same keyword and default behavior for simplicity, but that would come at the cost of changing the default behavior for a few of the methods listed here.

Question: should they be left as-is to avoid the (slight) break of changing the default behavior for some methods or should they all be made consistent across the board for simplicity?

This is intended toclose#3087

returnNULL;
}

if (!compiled) {
Copy link
Contributor

@andrewhong04andrewhong04Aug 11, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think it'll be neater to switch these around; not a big issue though.

if (compiled) {}else {}

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The reason I left it like this for now is that if it's decided to give everything the same default behavior and the same keyword, I only have to change some stuff in 2 or 3 of them, and sincelinked is kinda the opposite ofcompiled, leaving practically the same structure eliminates some intermediate confusion at the moment

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I believe the commit I just pushed resolves this

Copy link
Contributor

@ankith26ankith26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

For some initial consistency, I believe all functions should have the same keyword, regardless of whether that defaults toTrue orFalse. Now changing the default value needs more discussion

@Starbuck5
Copy link
Contributor

I think the linked version is what should be reported.

If pygame was built with SDL 2.0.14 but it's running on a Linux system and sees a newer libsdl, say SDL 2.0.20, it will use that version instead. This could be significant for joystick support, for instance, where we've frequently seen SDL versions be the entire difference "100% working" and "0% working."

For the runtime behavior, the linked version is more important. This is why the existing functions that have this argument use linked=True.

This is a change in behavior, but it should have very minimal backwards compatibility implications.

  • These functions are not very commonly used (exception being in the pygame display prompt, but that behavior could be preserved)
  • Most pygame installs use the SDL they come with anyways, so linked version == compiled version. (Every windows install, most Mac and Linux installs?)
  • I can't see any games ending with an exception due to this.

@MyreMylar
Copy link
Contributor

I agree, return the linked version by default for everything to synch them up. It is a v. minor change that I doubt will affect anyone and is easily resolved if it does.

@dr0id
Copy link
Contributor

I think "returning the linked version by default for everything" is reasonable, increases consistency and won't hurt. Of course it should be documented accordingly and be mentioned in the change log I guess.

Copy link
Contributor

@MyreMylarMyreMylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

As I wrote in the comment. I think we should just havelinked=True for all these getters. Could add a smallversion changed note in the docs for the two where this is a change.

@MyreMylar
Copy link
Contributor

Looks good to me 👍

@illumeillume added this to the2.1.4 milestoneSep 12, 2022
@illume
Copy link
Member

Thanks-very-cool. Note pygame.font.get_sdl_ttf_version isn't in this PR but is mentioned in the description. There's going to be a change shortly for 2.1.3 to rename it from pygame.font.get_ttf_version, so maybe wait for that to be merged first.

@Starbuck5
Copy link
Contributor

Thanks-very-cool. Note pygame.font.get_sdl_ttf_version isn't in this PR but is mentioned in the description. There's going to be a change shortly for 2.1.3 to rename it from pygame.font.get_ttf_version, so maybe wait for that to be merged first.

Sorry for the confusion because of the misnamed PR, get_sdl_ttf_version is currently implemented.

@oddbookworm
Copy link
ContributorAuthor

Note pygame.font.get_sdl_ttf_version isn't in this PR but is mentioned in the description.

This is because it's already correct and there's nothing to do in this PR. I was just addressing that they are all of the same form now.

@ankith26
Copy link
Contributor

This PR is missing unit tests though, maybe a follow up PR to add some basic unit tests would be nice?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nthykiernthykiernthykier approved these changes

+3 more reviewers

@andrewhong04andrewhong04andrewhong04 left review comments

@ankith26ankith26ankith26 left review comments

@MyreMylarMyreMylarMyreMylar approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

2.2.0

Development

Successfully merging this pull request may close these issues.

Unify version getters

8 participants

@oddbookworm@Starbuck5@MyreMylar@dr0id@illume@ankith26@nthykier@andrewhong04

[8]ページ先頭

©2009-2025 Movatter.jp