Code:Main.cpp #include "CSDL.h" CSDL sdl; int main(int argc, char *argv[]) { SDL_Surface *screen; sdl.InitSDL(); sdl.SetVidMode(screen); sdl.FillRect(screen, 0, 0, _WIDTH, _HEIGHT, 45, 45, 45); sdl.UpdateScreen(screen); return 0; }I get a segmentation fault on calls to sdl.FillRect();Code:FillRect function //Fills a rect (x, y, w, h) with color (r, g, b) on screen (screen) void CSDL::FillRect(SDL_Surface *screen, int x, int y, int w, int h, Uint8 r, Uint8 g, Uint8 b) { dst.x = x; dst.y = y; dst.w = w; dst.h = h; SDL_FillRect(screen, &dst, SDL_MapRGB(screen->format, r, g, b)); return; }
Any ideas why?
Full Source:



LinkBack URL
About LinkBacks




