From a3009ec0079769837dcbd690b0fb1ba54d379a85 Mon Sep 17 00:00:00 2001 From: tcsullivan Date: Sun, 25 Aug 2019 15:00:53 -0400 Subject: missing error return; added documentation --- src/main.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9b88994..bd53101 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,25 +29,27 @@ constexpr int height = 480; int main([[maybe_unused]] int argc, [[maybe_unused]] char *argv[]) { - std::cout << "Hello, world!" << std::endl; - + // Initialize SDL if (SDL_Init(SDL_INIT_VIDEO) != 0) { - std::cerr << "SDL failed to initialize: " << SDL_GetError() << - std::endl; + std::cerr << "SDL failed to initialize: " << SDL_GetError() + << std::endl; return -1; } else { atexit(SDL_Quit); } + // Create our window std::unique_ptr window (SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, 0), SDL_DestroyWindow); if (window.get() == nullptr) { - std::cerr << "SDL window creation failed: " << SDL_GetError() << - std::endl; + std::cerr << "SDL window creation failed: " << SDL_GetError() + << std::endl; + return -1; } + // TODO game SDL_Delay(1000); return 0; -- cgit v1.2.3