-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
75 lines (50 loc) · 1.37 KB
/
Copy pathmain.cpp
File metadata and controls
75 lines (50 loc) · 1.37 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
#include <iostream>
#include <SDL.h>
#include "src\graphics\Window.h"
/*
This type of main:
int main(int, char*) {}
should be used so that the application is compatible on many platform.
*/
int main(int argc, char* args[])
{
using namespace std;
using namespace exw;
using namespace graphics;
Window wnd;
// first create window;
SDL_Window* window = NULL;
// then create surface;
SDL_Surface* surface = NULL;
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
cout << "main(int, char*) -> SDL_Init() failed: " << SDL_GetError() << endl;
return 0;
}
//cout << "main(int, char*) -> SDL Initialize done." << endl;
const char* title = "Chessu";
int x = 100;
int y = 100;
int width = 800;
int height = 450;
window = SDL_CreateWindow(title, x, y, width, height, SDL_WINDOW_SHOWN);
if (window == NULL)
{
cout << "main(int, char*) -> SDL_CreateWindow() failed: " << SDL_GetError() << endl;
return 0;
}
surface = SDL_GetWindowSurface(window);
SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 120, 200, 100, 255));
SDL_UpdateWindowSurface(window);
SDL_Delay(2000);
bool quit = true;
while (!quit)
{
//SDL_UpdateWindowSurface(window);
}
SDL_DestroyWindow(window);
SDL_Quit();
//system("PAUSE");
return 0;
}