Add SDL to CMake
							parent
							
								
									60673a5283
								
							
						
					
					
						commit
						2b0b5e7b4f
					
				| @ -0,0 +1,39 @@ | ||||
| #include "robomaster.h" | ||||
| #include "SDL2/SDL.h" | ||||
| 
 | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| 
 | ||||
| int main(int argc, char* argv[]) { | ||||
|     if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) < 0) { | ||||
|         fprintf(stderr, "%s", SDL_GetError()); | ||||
| 	return 1; | ||||
|     } | ||||
|     SDL_Window* win = SDL_CreateWindow( | ||||
| 		    "Robomaster", | ||||
| 		    SDL_WINDOWPOS_UNDEFINED, | ||||
| 		    SDL_WINDOWPOS_UNDEFINED, | ||||
| 		    800, 300, | ||||
| 		    SDL_WINDOW_RESIZABLE ); | ||||
|     if(!win) { | ||||
|         fprintf(stderr, "%s", SDL_GetError()); | ||||
| 	return 1; | ||||
|     } | ||||
| 
 | ||||
|     bool quit = false; | ||||
|     while(!quit) { | ||||
|         SDL_Event event; | ||||
|         while(SDL_PollEvent(&event)) { | ||||
|             switch(event.type) { | ||||
|                 case SDL_WINDOWEVENT: | ||||
|                     if(event.window.event != SDL_WINDOWEVENT_CLOSE) break; | ||||
|                 case SDL_QUIT: | ||||
|                     quit = true; | ||||
| 	    } | ||||
| 	} | ||||
|     } | ||||
| 
 | ||||
|     SDL_Quit(); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
					Loading…
					
					
				
		Reference in New Issue