emilib
gl_lib_sdl.hpp
1 // By Emil Ernerfeldt 2013-2016
2 // LICENSE:
3 // This software is dual-licensed to the public domain and under the following
4 // license: you are granted a perpetual, irrevocable license to copy, modify,
5 // publish, and distribute this file as you see fit.
6 
7 #pragma once
8 
9 #include <SDL2/SDL.h>
10 
11 namespace emilib {
12 namespace sdl {
13 
14 struct Params
15 {
16  const char* window_name = "emilib";
17 
18  size_t width_points = 1024;
19  size_t height_points = 768;
20 
21  int depth_buffer = 0;
22  int stencil_buffer = 0;
23  int msa = 0;
24 
25  // Enable high-dpi screens.
26  bool high_dpi = true;
27 };
28 
29 struct InitResult
30 {
31  SDL_Window* window;
32  SDL_GLContext gl_context;
33  size_t width_points;
34  size_t height_points;
35  size_t width_pixels;
36  size_t height_pixels;
37  float pixels_per_point;
38 };
39 
41 InitResult init(const Params& params);
42 
43 } // namespace sdl
44 } // namespace emilib
Definition: gl_lib_sdl.hpp:14
int stencil_buffer
e.g. 8
Definition: gl_lib_sdl.hpp:22
Definition: gl_lib_sdl.hpp:29
int msa
e.g. 8 for 8-point anti-aliasing.
Definition: gl_lib_sdl.hpp:23
int depth_buffer
e.g. 24
Definition: gl_lib_sdl.hpp:21
Definition: coroutine.hpp:18