28 lines
654 B
C++
28 lines
654 B
C++
#include "../init.h"
|
|
|
|
#include <iostream>
|
|
#include <SDL.h>
|
|
|
|
SDL_Window *window;
|
|
|
|
namespace System {
|
|
void init() {
|
|
if (SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER ) < 0) {
|
|
std::cerr << "Error initializing SDL: " << SDL_GetError() << std::endl;
|
|
abort();
|
|
}
|
|
|
|
window = SDL_CreateWindow("game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1280, 800, SDL_WINDOW_SHOWN);
|
|
if (!window) {
|
|
std::cerr << "Error creating SDL window: " << SDL_GetError() << std::endl;
|
|
abort();
|
|
}
|
|
}
|
|
|
|
void terminate() {
|
|
SDL_DestroyWindow(window);
|
|
SDL_Quit();
|
|
}
|
|
}
|
|
|