Move main.c to src directory
This commit is contained in:
		
							
								
								
									
										47
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								main.c
									
									
									
									
									
								
							| @@ -1,47 +0,0 @@ | |||||||
| #include <SDL2/SDL.h> |  | ||||||
| #include <SDL2/SDL_events.h> |  | ||||||
| #include <SDL2/SDL_render.h> |  | ||||||
| #include <SDL2/SDL_video.h> |  | ||||||
| #include <stdbool.h> |  | ||||||
|  |  | ||||||
| #define WINDOW_WIDTH 800 |  | ||||||
| #define WINDOW_HEIGHT 600 |  | ||||||
|  |  | ||||||
| int main(void) { |  | ||||||
|   SDL_Init(SDL_INIT_EVERYTHING); |  | ||||||
|  |  | ||||||
|   SDL_Window *window = |  | ||||||
|       SDL_CreateWindow("Window", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, |  | ||||||
|                        WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN); |  | ||||||
|  |  | ||||||
|   SDL_Renderer *renderer = SDL_CreateRenderer( |  | ||||||
|       window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); |  | ||||||
|  |  | ||||||
|   bool running = true; |  | ||||||
|  |  | ||||||
|   SDL_Event event = {}; |  | ||||||
|  |  | ||||||
|   while (running) { |  | ||||||
|     while (SDL_PollEvent(&event)) { |  | ||||||
|       switch (event.type) { |  | ||||||
|       case SDL_QUIT: |  | ||||||
|         running = false; |  | ||||||
|         break; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); |  | ||||||
|  |  | ||||||
|     SDL_RenderClear(renderer); |  | ||||||
|  |  | ||||||
|     SDL_RenderPresent(renderer); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   SDL_DestroyRenderer(renderer); |  | ||||||
|  |  | ||||||
|   SDL_DestroyWindow(window); |  | ||||||
|  |  | ||||||
|   SDL_Quit(); |  | ||||||
|  |  | ||||||
|   return 0; |  | ||||||
| } |  | ||||||
							
								
								
									
										31
									
								
								src/main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/main.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | |||||||
|  | #include "colour.h" | ||||||
|  | #include "drop_area.h" | ||||||
|  | #include "window.h" | ||||||
|  | #include <SDL2/SDL.h> | ||||||
|  | #include <SDL2/SDL_events.h> | ||||||
|  | #include <SDL2/SDL_render.h> | ||||||
|  | #include <SDL2/SDL_video.h> | ||||||
|  | #include <stdbool.h> | ||||||
|  | #include <stdlib.h> | ||||||
|  |  | ||||||
|  | #define WINDOW_WIDTH 1280 | ||||||
|  | #define WINDOW_HEIGHT 720 | ||||||
|  |  | ||||||
|  | int main(void) { | ||||||
|  |   window_t window = {0}; | ||||||
|  |  | ||||||
|  |   if (!open_window(&window, "Window", WINDOW_WIDTH, WINDOW_HEIGHT, | ||||||
|  |                    (colour_t){.abgr = 0xffffffff})) { | ||||||
|  |     return EXIT_FAILURE; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   drop_area_t area = {0}; | ||||||
|  |   init_drop_area(&window, &area, (render_rect_t){10, 10, 1260, 600}, | ||||||
|  |                  (colour_t){.abgr = 0xff000000}); | ||||||
|  |  | ||||||
|  |   run_window_loop(&window); | ||||||
|  |  | ||||||
|  |   close_window(&window); | ||||||
|  |  | ||||||
|  |   return EXIT_SUCCESS; | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user