call SDL_SetVideoMode(); working, but crashing on exit
This commit is contained in:
parent
7c6fc41c2e
commit
34223e9403
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
||||
|
||||
TARGET := sdl_opengl_bare
|
||||
DFLAGS := -I/usr/local/include/d
|
||||
DFLAGS := -I/usr/local/include/d -g
|
||||
LDFLAGS := -lDerelictSDL -lDerelictUtil -ldl
|
||||
|
||||
all: $(TARGET)
|
||||
|
@ -1,6 +1,9 @@
|
||||
import std.stdio;
|
||||
import derelict.sdl.sdl;
|
||||
|
||||
enum int WIDTH = 800;
|
||||
enum int HEIGHT = 600;
|
||||
|
||||
int main(char[][] args)
|
||||
{
|
||||
DerelictSDL.load();
|
||||
@ -11,5 +14,15 @@ int main(char[][] args)
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user