python
import sdl2
import sdl2.ext
python
sdl2.ext.init()
python
window = sdl2.ext.Window("PySDL2 Multi-threaded Application", size=(640, 480))
renderer = sdl2.ext.Renderer(window)
python
import threading
def graphics_thread():
pass
def audio_thread():
pass
graphics_thread = threading.Thread(target=graphics_thread)
audio_thread = threading.Thread(target=audio_thread)
graphics_thread.start()
audio_thread.start()
python
running = True
while running:
for event in sdl2.ext.get_events():
if event.type == sdl2.SDL_QUIT:
running = False
renderer.clear()
renderer.present()
python
sdl2.ext.quit()
python
import sdl2
import sdl2.ext
import threading
def graphics_thread():
pass
def audio_thread():
pass
def main():
sdl2.ext.init()
window = sdl2.ext.Window("PySDL2 Multi-threaded Application", size=(640, 480))
renderer = sdl2.ext.Renderer(window)
graphics_thread = threading.Thread(target=graphics_thread)
audio_thread = threading.Thread(target=audio_thread)
graphics_thread.start()
audio_thread.start()
running = True
while running:
for event in sdl2.ext.get_events():
if event.type == sdl2.SDL_QUIT:
running = False
renderer.clear()
renderer.present()
sdl2.ext.quit()
if __name__ == "__main__":
main()
pip install Cython setuptools