From: tcsullivan Date: Sun, 25 Aug 2019 19:00:53 +0000 (-0400) Subject: missing error return; added documentation X-Git-Tag: v0.1-alpha~43 X-Git-Url: https://code.bitgloo.com/bitgloo/alee-forth/bitgloo/alee-forth/git?a=commitdiff_plain;h=a3009ec0079769837dcbd690b0fb1ba54d379a85;p=clyne%2Fgamedev2.git missing error return; added documentation --- 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;