create SDL window and GL context
This commit is contained in:
parent
6a76f25210
commit
6dddceb533
38
source/app.d
38
source/app.d
@ -1,6 +1,40 @@
|
||||
import std.stdio;
|
||||
import derelict.sdl2.sdl;
|
||||
import derelict.opengl3.gl3;
|
||||
|
||||
void main()
|
||||
int main()
|
||||
{
|
||||
writeln("Edit source/app.d to start your project.");
|
||||
DerelictSDL2.load();
|
||||
|
||||
DerelictGL3.load();
|
||||
|
||||
if (SDL_Init(SDL_INIT_EVERYTHING))
|
||||
{
|
||||
writeln("Failed to initialize SDL!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Window * window = SDL_CreateWindow("d-dub-derelict-sdl2-gl3-demo",
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
800,
|
||||
600,
|
||||
SDL_WINDOW_OPENGL);
|
||||
SDL_GLContext context = SDL_GL_CreateContext(window);
|
||||
|
||||
if (window == null)
|
||||
{
|
||||
writeln("Failed to create SDL window!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
DerelictGL3.reload();
|
||||
|
||||
SDL_Delay(2000);
|
||||
|
||||
SDL_DestroyWindow(window);
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user