sdl-opengl-bare-d/sdl_opengl_bare.d

31 lines
538 B
D

import std.stdio;
import derelict.sdl.sdl;
enum int WIDTH = 800;
enum int HEIGHT = 600;
int main(char[][] args)
{
DerelictSDL.load();
if (SDL_Init(SDL_INIT_EVERYTHING))
{
writefln("Failed to initialize SDL!");
return 1;
}
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_Surface *screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32, SDL_OPENGL);
if (screen == null)
{
printf("Failed to set video mode!\n");
SDL_Quit();
return 2;
}
SDL_Quit();
return 0;
}