1
0
Fork 0

Describe ambiguous arguments

This commit is contained in:
Gregory Eremin 2015-09-29 14:27:26 +03:00
parent 73b0f932ea
commit 58cfcc1e4a
No known key found for this signature in database
GPG Key ID: 5EFA427EEC26E86C
1 changed files with 24 additions and 6 deletions

View File

@ -2,21 +2,39 @@
#include <unistd.h> #include <unistd.h>
#include "SDL2/SDL.h" #include "SDL2/SDL.h"
int main(int argc, char const *argv[]) int main(int argc, char const *argv[]) {
{ if (SDL_Init(SDL_INIT_VIDEO) != 0) {
if (SDL_Init(SDL_INIT_VIDEO) != 0){
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl; std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1; return 1;
} }
SDL_Window *win = SDL_CreateWindow("Hello World!", 100, 100, 640, 480, SDL_WINDOW_SHOWN); SDL_Window *window = SDL_CreateWindow(
if (win == nullptr) { "Breakout", // Title
100, 100, // X, Y
640, 480, // Width, Height
SDL_WINDOW_SHOWN // Visibility
);
if (window == nullptr) {
std::cout << "SDL_CreateWindow Error: " << SDL_GetError() << std::endl; std::cout << "SDL_CreateWindow Error: " << SDL_GetError() << std::endl;
SDL_Quit(); SDL_Quit();
return 1; return 1;
} }
usleep(10000000); SDL_Renderer *renderer = SDL_CreateRenderer(
window, // Window
-1, // Video driver. -1 means "any compatible"
SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC // Options
);
if (renderer == nullptr) {
SDL_DestroyWindow(window);
std::cout << "SDL_CreateRenderer Error: " << SDL_GetError() << std::endl;
SDL_Quit();
return 1;
}
std::cout << "Sleeping for a second..." << std::endl;
usleep(1000000);
std::cout << "Exiting nicely" << std::endl;
return 0; return 0;
} }