'SDL2 Window not rendering
OS: MacOS 12.0.1
#include <iostream>
#include <SDL2/SDL.h>
int main(int argc, char* argv[])
{
SDL_Window *window;
SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow("Will You Ball?", 0, 0, 700, 700, 0);
if(window == NULL)
{
std::cout << "FAILED TO OPEN WINDOW";
return 1;
}
SDL_Surface *screen = SDL_GetWindowSurface(window);
// Draw Square
SDL_Rect rect = { 0, 0, 70, 70 };
SDL_FillRect(screen, &rect, SDL_MapRGB(screen -> format, 0x00, 0x00, 0x00));
SDL_Delay(10000);
return 0;
}
The app runs and compiles without any errors however the window never opens. Is this a problem with MacOS or my code?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
