I need to check if the game's SDL Window is open before I can start rendering graphics, normally I would know how to this, but the problem is the window is created in the main class, and I need to check if the window is open in the menu class. How do I check if the window is open in an entirely different class?
|
You dont specify if you are using SDL 1.2, or SDL 2. I will explain it with SDL 1.2. When yo do a
to create the window, you set the pointer of the window created in your SDL_Surface* SDL variable. The function has two returns. If has been executed successfully, it will return the pointer of the window. If has NOT been executed successfully, it will return 'NULL'; So, yo need to check if the windows was created checking that pointer. I will copy a segment of my code in SDL:
Try to read the documentation for each function. Its not hard. Docs for SDL 1.2: https://www.libsdl.org/release/SDL-1.2.15/docs/ for SDL 2: https://wiki.libsdl.org/ And if you are using different functions you have 2 choices, make the variable of the window Global, or, passing by parameter to all your functions. PD: Sorry for my english! |
|||
|