47 lines
		
	
	
		
			833 B
		
	
	
	
		
			C
		
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			833 B
		
	
	
	
		
			C
		
	
	
| //#if !defined (__APPLE__)
 | |
| #include <SDL/SDL.h>
 | |
| //#endif
 | |
| 
 | |
| #include "sdl.h"
 | |
| #include "../main.h"
 | |
| #include "../common.h"
 | |
| 
 | |
| int interfaceInit() {
 | |
|   // Load it up!
 | |
|   SDL_Init(SDL_INIT_EVERYTHING);
 | |
|   // Set up our SDL Window
 | |
|   if ((screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE)) == NULL) {
 | |
|     return ERROR;
 | |
| 	}
 | |
|   SDL_WM_SetCaption(NAME, NULL);
 | |
| 
 | |
|   // Fill our screen w/ black
 | |
|   SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
 | |
|   // Update!
 | |
|   SDL_Flip(screen);
 | |
| 
 | |
|   return SUCCESS;
 | |
| }
 | |
| 
 | |
| void interfaceLoop() {
 | |
|   while (SDL_PollEvent(&event)) {
 | |
|     switch(event.type) {
 | |
|       case SDL_QUIT:
 | |
|         is_running = 0;
 | |
|         break;
 | |
|       case SDL_KEYDOWN:
 | |
|         if (event.key.keysym.sym == SDLK_q)
 | |
|           is_running = 0;
 | |
|         break;
 | |
|     }
 | |
|   }
 | |
| }
 | |
| 
 | |
| void interfaceDraw() {
 | |
|   
 | |
| }
 | |
| 
 | |
| void interfaceClose() {
 | |
|   SDL_Quit();
 | |
| }
 |