adventskalender-2009/src/draw.c
Aaron Mueller e12b581fc8 Build a initial structure to build the game
This includes:
  * Change the Makefile so we can build the source with SDL
  * Create a config file for all global variables
  * Initialize a simple game loop to see something on the screen
  * Stub for building a drawing lib
  * Modify the README a little bit
2009-12-07 16:57:30 +01:00

18 lines
362 B
C

#include "SDL.h"
#include "draw.h"
#include "config.h"
void drawPixel(int x, int y, int color) {
unsigned int *p = (unsigned int*)screen->pixels;
int lineOffset = y * (screen->pitch/4);
p[lineOffset+x] = color;
}
void drawScreen() {
Uint32 black = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff);
drawPixel(SCREEN_WIDTH/2, SCREEN_HEIGHT/2, black);
}