pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

complexity: display.c@pg_set_mode (2316)

Open GalacticEmperor1 opened this issue 2 years ago • 1 comments
trafficstars

Issue №2316 opened by illume at 2020-11-11 07:58:21

WIP: this issue is a work in progress.

The display.set_mode function is too complex. See Complexity of C code issue on how to measure complexity.

There's quite a few issues with pygame.display.set_mode, including: # 212, # 993, # 2100, # 2186 and # 2132 A bunch of the features are not tested or documented. There's perhaps new functionality wanted including for setting window size. Additionally it is not well encapsulated.

What's needed is a slow process of refactoring to reduce complexity. Smaller functions, documentation and testing.


Comments

# # robertpfeiffer commented at 2020-11-16 15:52:11

  1. Some of the linked issues are problems in SDL2 itself
  2. Some of the complexity in set_mode and toggle_fullscreen is due to bugs in older versions of SDL2
  3. Many currently open feature requests are likely to require adding more complexity to set_mode (like fast size changing)

# # MyreMylar commented at 2020-11-16 19:30:12

I suspect just breaking it down into a bunch of sub-functions would help a lot.


# # eebop commented at 2020-12-08 16:29:04

I'm going to clear up a little bit. (Adding comments and so forth)


# # eebop commented at 2020-12-11 19:38:36

Well, I looked at it and it doesn't make any sense. I can add comments after somebody splits it up, though. Sorry!

GalacticEmperor1 avatar Feb 12 '23 13:02 GalacticEmperor1