def __init__(self):
super().__init__()<EOL>self.window_closing = False<EOL>self.tmp_size_x = c_int()<EOL>self.tmp_size_y = c_int()<EOL>print("<STR_LIT>", self.get_library_version())<EOL>if sdl2.SDL_Init(sdl2.SDL_INIT_VIDEO) != <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>sdl2.video.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_MAJOR_VERSION, self.gl_version.major)<EOL>sdl2.video.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_MINOR_VERSION, self.gl_version.minor)<EOL>sdl2.video.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_PROFILE_MASK, sdl2.SDL_GL_CONTEXT_PROFILE_CORE)<EOL>sdl2.video.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG, <NUM_LIT:1>)<EOL>sdl2.video.SDL_GL_SetAttribute(sdl2.SDL_GL_DOUBLEBUFFER, <NUM_LIT:1>)<EOL>sdl2.video.SDL_GL_SetAttribute(sdl2.SDL_GL_DEPTH_SIZE, <NUM_LIT>)<EOL>sdl2.SDL_ShowCursor(sdl2.SDL_ENABLE if self.cursor else sdl2.SDL_DISABLE)<EOL>if self.samples > <NUM_LIT:1>:<EOL><INDENT>sdl2.video.SDL_GL_SetAttribute(sdl2.SDL_GL_MULTISAMPLEBUFFERS, <NUM_LIT:1>)<EOL>sdl2.video.SDL_GL_SetAttribute(sdl2.SDL_GL_MULTISAMPLESAMPLES, self.samples)<EOL><DEDENT>flags = sdl2.SDL_WINDOW_OPENGL<EOL>if self.fullscreen:<EOL><INDENT>flags |= sdl2.SDL_WINDOW_FULLSCREEN_DESKTOP<EOL><DEDENT>else:<EOL><INDENT>if self.resizable:<EOL><INDENT>flags |= sdl2.SDL_WINDOW_RESIZABLE<EOL><DEDENT><DEDENT>self.window = sdl2.SDL_CreateWindow(<EOL>self.title.encode(),<EOL>sdl2.SDL_WINDOWPOS_UNDEFINED,<EOL>sdl2.SDL_WINDOWPOS_UNDEFINED,<EOL>self.width,<EOL>self.height,<EOL>flags<EOL>)<EOL>if not self.window:<EOL><INDENT>raise ValueError("<STR_LIT>", sdl2.SDL_GetError())<EOL><DEDENT>self.context = sdl2.SDL_GL_CreateContext(self.window)<EOL>sdl2.video.SDL_GL_SetSwapInterval(<NUM_LIT:1> if self.vsync else <NUM_LIT:0>)<EOL>self.ctx = moderngl.create_context(require=self.gl_version.code)<EOL>context.WINDOW = self<EOL>self.fbo = self.ctx.screen<EOL>self.set_default_viewport()<EOL>
Initializes sdl2, sets up key and mouse events and
creates a ``moderngl.Context`` using the context sdl2 createad.

Using the sdl2 window requires sdl binaries and PySDL2.