#include #include "viewport.h" #include "logging.h" struct viewport * init_viewport(Uint16 width, Uint16 height, int bpp) { struct viewport *vp; vp = malloc(sizeof(*vp)); if (vp == NULL) { err(1, "Failed to allocate viewport"); } vp->x = 0; vp->y = 0; vp->w= width; vp->h= height; debug("Setting video mode..."); vp->screen = SDL_SetVideoMode(width, height, bpp, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_HWPALETTE); if (vp->screen == NULL) { err(1, "Failed to set video mode (%s)", SDL_GetError()); } return vp; }