0

I have this simple code to open a SDL window:

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

#define WIDTH 800
#define HEIGHT 600

int main (int argc, char **argv)
{
    SDL_Window *window = NULL;
    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
      fprintf(stderr, "SDL failed to initialise: %s\n", SDL_GetError());
      return 1;
    }
    window = SDL_CreateWindow("SDL Example",
                SDL_WINDOWPOS_UNDEFINED,
                SDL_WINDOWPOS_UNDEFINED, 
                WIDTH, 
                HEIGHT,
                0);
    printf("%s\n",SDL_GetError());
    SDL_Event e;
    unsigned int c = 0;
    while (1){
        while (SDL_PollEvent(&e)){
            if (e.type == SDL_QUIT){
                break;
            }
        }
    }
    /*return code */
    ...

I run this on Weston version 8.0.0 but no window showed up. It runs ok on GNOME wayland though. SDL_GetError() doesn't return any error. SDL2 version is 2.0.12 Any idea why ?

qand
  • 49
  • 1
  • 9

1 Answers1

1

I found out. It doesn't show up anything unless something is drawn, like using SDL_CreateRenderer.

qand
  • 49
  • 1
  • 9