this is no urgent question, but I was just wondering about a few things while getting in touch with SDL.
So, I started to read this tutorial and implemented the following code snippet:
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Delay(2000);
SDL_Quit();
In the tutorial, it is said, that a console window should open and cloase after the 2 seconds. I am using eclipse and while running nothing happens. This seems to be a problem like this one, but in contrast I am using Linux. And the other thing is, that I can run it from the console and it happens nothing too. After that, I read the other tutorial from the question and inserted the following lines to create a window:
SDL_Window *window = 0;
window = SDL_CreateWindow("Hello World!",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
640, 480,
SDL_WINDOW_SHOWN);
This changed nothing regarding my problem, that no window is shown, but If I write the output of SDL_Init()
to the console it returns '0' (success) while running from eclipse and '-1' (some error code) while running from the terminal. I started both with optirun (eclipse and in the terminal the final program).
After that, I just tried to implement the rest of the tutorial and created an OpenGL window with SDL and so on. I changed nothing else, but it works with eclipse and within the terminal and the window is shown, now.
Has anybody an idea why this works now and why there was the difference between eclipse and the terminal?