blob: 1a6e9dcd44c8d42e88c0ac03c2fd947ec021ef5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <SDL.h>
#include "viewport.h"
#include "logging.h"
struct viewport *
init_viewport(int width, int 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_ANYFORMAT);
if (vp->screen == NULL) {
err(1, "Failed to set video mode (%s)", SDL_GetError());
}
return vp;
}
|