speartip
2017-02-13 16:15:07 UTC
Hi, wanted to know how to code for an error state in the following code. I am new to SDL. I simply want a true to some value if a window was successfully created. I've made this window generation a subroutine:
Code:
#include <SDL.h>
#include "make_Window.h"
void make_Window(int horizontal, int vertical) //SDL_Window *window)
{
SDL_Init(SDL_INIT_EVERYTHING);
// Create a Window in the middle of the screen
SDL_Window *window = 0;
window = SDL_CreateWindow("Hello World!",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
horizontal, vertical,
SDL_WINDOW_SHOWN);
// Delay so that we can see the window appear
SDL_Delay(2000);
}
Code:
#include <SDL.h>
#include "make_Window.h"
void make_Window(int horizontal, int vertical) //SDL_Window *window)
{
SDL_Init(SDL_INIT_EVERYTHING);
// Create a Window in the middle of the screen
SDL_Window *window = 0;
window = SDL_CreateWindow("Hello World!",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
horizontal, vertical,
SDL_WINDOW_SHOWN);
// Delay so that we can see the window appear
SDL_Delay(2000);
}