Created
May 10, 2012 05:07
-
-
Save josephg/2651150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include "SDL.h" | |
#include "SDL_video.h" | |
enum Ingredients | |
{ | |
CARROT = 1, | |
CHEDDAR = 2, | |
CAPSICUM = 4, | |
FETTA = 8, | |
AVACADO = 0x10, | |
TOASTED = 0x20 | |
}; | |
bool has_capsicum(int ingredients) | |
{ | |
return ingredients & CAPSICUM; | |
} | |
int main(int argc, char *argv[]) | |
{ | |
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0) | |
{ | |
printf("Error initializing SDL: %s\n", SDL_GetError()); | |
} | |
SDL_Surface *surface; | |
surface = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE | SDL_ANYFORMAT | SDL_DOUBLEBUF); | |
bool running = true; | |
int x = 0, y = 0; | |
while(running) | |
{ | |
SDL_Event e; | |
while(SDL_PollEvent(&e)) | |
{ | |
switch(e.type) | |
{ | |
case SDL_KEYDOWN: | |
//e.key. | |
break; | |
case SDL_MOUSEMOTION: | |
x = e.motion.x; | |
y = e.motion.y; | |
break; | |
case SDL_QUIT: | |
running = false; | |
break; | |
default: /* Report an unhandled event */ | |
printf("I don't know what this event is!\n"); | |
} | |
} | |
SDL_FillRect(surface, NULL, 0); | |
SDL_Rect rect = {x, y, 100, 100}; | |
SDL_FillRect(surface, &rect, 0xff00ff); | |
SDL_Flip(surface); | |
} | |
SDL_Quit(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment