renpy / pygame_sdl2

Reimplementation of portions of the pygame API using SDL2.
GNU Lesser General Public License v2.1
326 stars 64 forks source link

SOP Questions... #103

Closed Remusforte closed 3 months ago

Remusforte commented 6 years ago

This is not an "issue" per se, but I am working on a pygame_sdl2 implementation and have some SOP questions:

First: Is there a Forum or other place more suited to "questions" like this vs. "code issues"? If so, I'll move this there.

Second: Please see the following code snip from a sample pygame_sdl2 program elsewhere on github -

`# Allow pygame_sdl2 to be imported as pygame. import pygame_sdl2 pygame_sdl2.import_as_pygame()

import pygame import os

...(later)...

def main(): pygame.init()`

My SOP questions are: (a) Why import pygame when pygame_sdl2 has already been imported? My impression was that pygame_sdl2 was supposed to be a complete replacement for pygame, so doesn't this subsequent import create problems? Or is this necessary because there are actually missing pygame modules in the pygame_sdl2 import package?

(b) That said, I thought the call to "pygame_sdl2.import_as_pygame()" intercepts pygame calls and attempts to do them as pygame_sdl2 instead. So isn't the import pygame line going to effectively result in a duplicate call of import pygame_sdl2?

(c) Later on, the command "pygame.init()" is used, rather than "pygame_sdl2.init()". Why? What is the SOP for which init() to use when (or does it matter)?

Finally, though not shown in this code snip, what is the best way to import pygame locals? Use "from pygame.locals import " or "from pygame_sdl2.locals import " or does it matter (given the "import_as..." call up top in the code)?

Thanks!