]> code.bitgloo.com Git - clyne/gamedev2.git/commitdiff
missing error return; added documentation
authortcsullivan <tullivan99@gmail.com>
Sun, 25 Aug 2019 19:00:53 +0000 (15:00 -0400)
committertcsullivan <tullivan99@gmail.com>
Sun, 25 Aug 2019 19:00:53 +0000 (15:00 -0400)
src/main.cpp

index 9b88994ecdfce790e4c0d9ca72ccf1176dfe001c..bd531014c7f1f115dc76cd11e7fa73ded1aa753a 100644 (file)
@@ -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<SDL_Window, decltype(&SDL_DestroyWindow)> 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;