-
Notifications
You must be signed in to change notification settings - Fork 1
/
CWindow.cpp
61 lines (49 loc) · 1.84 KB
/
CWindow.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// Created by igoryan on 15.04.15.
//
#include "CWindow.h"
CWindow::CWindow() : SCREEN_WIDTH(640), SCREEN_HEIGHT(480) {
mWindow = SDL_CreateWindow("no name", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
if (mWindow == nullptr) {
CMyErrorShow::show_error("SDL_CreateWindow");
}
mScreen = SDL_GetWindowSurface(mWindow);
if (mScreen == nullptr) {
CMyErrorShow::show_error("SDL_GetWindowSurface");
}
mRender = SDL_CreateRenderer(mWindow, -1, SDL_RENDERER_ACCELERATED);
if (mRender == nullptr) {
CMyErrorShow::show_error("SDL_CreateRenderer");
}
}
CWindow::CWindow(std::string title, int Width, int Height, Uint32 flags) : SCREEN_WIDTH(Width), SCREEN_HEIGHT(Height) {
mWindow = SDL_CreateWindow(title.c_str(), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, flags);
if (mWindow == nullptr) {
CMyErrorShow::show_error("SDL_CreateWindow");
}
mScreen = SDL_GetWindowSurface(mWindow);
if (mScreen == nullptr) {
CMyErrorShow::show_error("SDL_GetWindowSurface");
}
mRender = SDL_CreateRenderer(mWindow, -1, SDL_RENDERER_ACCELERATED);
if (mRender == nullptr) {
CMyErrorShow::show_error("SDL_CreateRenderer");
}
}
CWindow::CWindow(std::string title, int x, int y, int width, int height, Uint32 flags) :
SCREEN_WIDTH(width), SCREEN_HEIGHT(height) {
mWindow = SDL_CreateWindow(title.c_str(), x, y, SCREEN_WIDTH, SCREEN_HEIGHT, flags);
if (mWindow == nullptr) {
CMyErrorShow::show_error("SDL_CreateWindow");
}
mScreen = SDL_GetWindowSurface(mWindow);
if (mScreen == nullptr) {
CMyErrorShow::show_error("SDL_GetWindowSurface");
}
mRender = SDL_CreateRenderer(mWindow, -1, SDL_RENDERER_ACCELERATED);
if (mRender == nullptr) {
CMyErrorShow::show_error("SDL_CreateRenderer");
}
}
CWindow::~CWindow() {
}