-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCsdl.cpp
More file actions
executable file
·31 lines (26 loc) · 936 Bytes
/
Csdl.cpp
File metadata and controls
executable file
·31 lines (26 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "Csdl.h"
bool Csdl::init() {
if (SDL_Init(SDL::INIT_ARGUMENT) < 0) {
fprintf(stderr, "Could not start SDL: %s.\n", SDL_GetError());
return false;
}
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 8);
SDL_WM_SetCaption(SDL::WINDOW_TITLE, SDL::WINDOW_ICON_TITLE);
return true;
}
bool Csdl::create_window(SDL_Surface* icon) {
if (SDL_SetVideoMode(SDL::WINDOW_WIDTH, SDL::WINDOW_HEIGHT, SDL::WINDOW_BPP, SDL_OPENGL) == NULL) {
fprintf(stderr, "Could not set video mode: %s.\n", SDL_GetError());
return false;
}
SDL_WM_SetIcon(icon, NULL);
return true;
}
void Csdl::end() {
fprintf(stdout, "Stopping sdl.\n");
SDL_Quit();
}