Created
January 23, 2024 02:10
-
-
Save thecoder08/1cc17aeeba037db8cf401bae735439f3 to your computer and use it in GitHub Desktop.
List SDL2 video and audio drivers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SDL2/SDL.h> | |
#include <stdio.h> | |
int main() { | |
puts("Available video drivers:"); | |
int numVideoDrivers = SDL_GetNumVideoDrivers(); | |
for (int i = 0; i < numVideoDrivers; i++) { | |
puts(SDL_GetVideoDriver(i)); | |
} | |
puts("Available audio drivers:"); | |
int numAudioDrivers = SDL_GetNumAudioDrivers(); | |
for (int i = 0; i < numAudioDrivers; i++) { | |
puts(SDL_GetAudioDriver(i)); | |
} | |
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO); | |
printf("Currently using audio driver %s\n", SDL_GetCurrentAudioDriver()); | |
printf("Currently using video driver %s\n", SDL_GetCurrentVideoDriver()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment