MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SDL_CreateRenderer

Function SDL_CreateRenderer

deps/SDL2/src/render/SDL_render.c:764–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

762}
763
764SDL_Renderer *
765SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
766{
767#if !SDL_RENDER_DISABLED
768 SDL_Renderer *renderer = NULL;
769 int n = SDL_GetNumRenderDrivers();
770 SDL_bool batching = SDL_TRUE;
771 const char *hint;
772
773#if defined(__ANDROID__)
774 Android_ActivityMutex_Lock_Running();
775#endif
776
777 if (!window) {
778 SDL_SetError("Invalid window");
779 goto error;
780 }
781
782 if (SDL_GetRenderer(window)) {
783 SDL_SetError("Renderer already associated with window");
784 goto error;
785 }
786
787 if (SDL_GetHint(SDL_HINT_RENDER_VSYNC)) {
788 if (SDL_GetHintBoolean(SDL_HINT_RENDER_VSYNC, SDL_TRUE)) {
789 flags |= SDL_RENDERER_PRESENTVSYNC;
790 } else {
791 flags &= ~SDL_RENDERER_PRESENTVSYNC;
792 }
793 }
794
795 if (index < 0) {
796 hint = SDL_GetHint(SDL_HINT_RENDER_DRIVER);
797 if (hint) {
798 for (index = 0; index < n; ++index) {
799 const SDL_RenderDriver *driver = render_drivers[index];
800
801 if (SDL_strcasecmp(hint, driver->info.name) == 0) {
802 /* Create a new renderer instance */
803 renderer = driver->CreateRenderer(window, flags);
804 if (renderer) {
805 batching = SDL_FALSE;
806 }
807 break;
808 }
809 }
810 }
811
812 if (!renderer) {
813 for (index = 0; index < n; ++index) {
814 const SDL_RenderDriver *driver = render_drivers[index];
815
816 if ((driver->info.flags & flags) == flags) {
817 /* Create a new renderer instance */
818 renderer = driver->CreateRenderer(window, flags);
819 if (renderer) {
820 /* Yay, we got one! */
821 break;

Callers 15

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 15

SDL_GetNumRenderDriversFunction · 0.85
SDL_SetErrorFunction · 0.85
SDL_GetRendererFunction · 0.85
SDL_GetHintFunction · 0.85
SDL_GetHintBooleanFunction · 0.85
SDL_strcasecmpFunction · 0.85
VerifyDrawQueueFunctionsFunction · 0.85
SDL_GetWindowSizeFunction · 0.85
SDL_GetWindowFlagsFunction · 0.85
SDL_SetWindowDataFunction · 0.85
SDL_RenderSetViewportFunction · 0.85

Tested by 13

mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
WatchGameControllerFunction · 0.68
WatchJoystickFunction · 0.68
WatchJoystickFunction · 0.68
InitCreateRendererFunction · 0.68
mainFunction · 0.68