call SDL_SetVideoMode(); working, but crashing on exit

This commit is contained in:
Josh Holtrop 2013-02-02 21:27:56 -05:00
parent 7c6fc41c2e
commit 34223e9403
2 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,6 @@
TARGET := sdl_opengl_bare TARGET := sdl_opengl_bare
DFLAGS := -I/usr/local/include/d DFLAGS := -I/usr/local/include/d -g
LDFLAGS := -lDerelictSDL -lDerelictUtil -ldl LDFLAGS := -lDerelictSDL -lDerelictUtil -ldl
all: $(TARGET) all: $(TARGET)

View File

@ -1,6 +1,9 @@
import std.stdio; import std.stdio;
import derelict.sdl.sdl; import derelict.sdl.sdl;
enum int WIDTH = 800;
enum int HEIGHT = 600;
int main(char[][] args) int main(char[][] args)
{ {
DerelictSDL.load(); DerelictSDL.load();
@ -11,5 +14,15 @@ int main(char[][] args)
return 1; return 1;
} }
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_Surface *screen;
if ((screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32, SDL_OPENGL)) == null)
{
printf("Failed to set video mode!\n");
SDL_Quit();
return 2;
}
return 0; return 0;
} }