-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
70 lines (47 loc) · 1.28 KB
/
Copy pathmain.c
File metadata and controls
70 lines (47 loc) · 1.28 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
#include "Display.h"
SDL_Window* window;
SDL_Renderer* renderer;
bool is_running;
uint32_t* color_buffer;
SDL_Texture* color_buffer_texture;
int window_width;
int window_height;
int z;
void process_input() {
SDL_Event event;
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
is_running = false;
break;
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_ESCAPE)
is_running = false;
break;
}
}
}
void update() {}
void myrenderer(void) {
SDL_SetRenderDrawColor(renderer, 1, 225, 0, 255);
SDL_RenderClear(renderer);
draw_rect(25, 25, 100, 65, 0xFFA23211);
render_color_buffer();
setting_colorbuffer(0xFFFFFF000);
SDL_RenderPresent(renderer);
}
void setup() {
color_buffer = (uint32_t*) malloc(sizeof(uint32_t) * window_width * window_height);
color_buffer_texture = SDL_CreateTexture(renderer,SDL_PIXELFORMAT_ARGB8888,SDL_TEXTUREACCESS_STREAMING,window_width,window_height);
}
int main(int argc ,char* args[]) {
is_running = init_Window();
setup();
while (is_running) {
process_input();
update();
myrenderer();
}
destroy();
return 0;
}