0

Here's my code

#include <stdio.h>
#include <stdbool.h>
#include <SDL2/SDL.h>

int main(){
    if(SDL_Init(SDL_INIT_VIDEO) != 0){
        return -1;
    }

    SDL_Window *window = SDL_CreateWindow("test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE);

    if(window){
        SDL_Delay(3000);
        SDL_DestroyWindow(window);
    }
    SDL_Quit();
}

The window is created and I manage to get in the if statement, it just doesn't show the window.

I'm working on VSCode, on Ubuntu (which I installed today, so there might be components I'm missing for the window to show but as of right now I don't know).

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • 1
    Try adding an event loop (look up `SDL_PollEvents()`). – HolyBlackCat Mar 14 '23 at 18:59
  • Window is shown fine, but it is empty and transparent. It's not filled with anything. The only thing that displays is the window decoration painted by your window manager. – David C. Rankin Mar 14 '23 at 19:13
  • I already tried an event loop and it doesn't work. When I say the window doesn't show up it's because I tested it on another machine and it works fine (it shows a black window with nothing, but at least a window is shown), here it just doesn't show anything – HiraAkshay Mar 15 '23 at 08:17
  • have you tried `SDL_ShowWindow` ? – J. Doe Mar 16 '23 at 23:35
  • Yes I tried it even though it should already be shown with the SDL_WINDOW_SHOWN parameter in the SDL_CreateWindow function. Still doesn't show the window – HiraAkshay Mar 17 '23 at 10:07

0 Answers0