LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024-2025 ETMSoftware
lg_env.h
1 /*
2  * LibGame - Copyright (C) Emmanuel Thomas-Maurin 2011-2025
3  * All rights reserved
4  */
5 
6 #ifndef LG_ENV_H
7 #define LG_ENV_H
8 
26 typedef struct {
27  /*
28  * SDL display mode stuff
29  */
30  int sdl_display;
31  SDL_DisplayMode sdl_display_mode;
32  int sdl_convert_surf_format; /* For all SDL_ConvertSurfaceFormat() ops */
33  int sdl_create_rgb_surf_bitdepth; /* For all SDL_CreateRGBSurface() ops */
34  int r_size, g_size, b_size, a_size;
35  uint32_t r_mask, g_mask, b_mask, a_mask; /* SDL interprets each pixel as a 32-bit integer */
36  /*
37  * Screen dims
38  */
39  int screen_w;
40  int screen_h;
41  /*
42  * OpenGL ES 2.0 stuff
43  */
44  SDL_Window *gl_win; /* Top SDL/GL win */
45  SDL_GLContext gl_context;
46  /*
47  * Opengl ES version >= 2.0
48  */
49  int gles_maj_v;
50  int gles_min_v;
51  /*
52  * Top win dims are virtual/logical dims in fullscreen mode.
53  * In fullscreen mode, we compute an optimal viewport_rect (with letterboxing)
54  * and use scaling, keeping the same aspect ratio (like SDL2 with render logical size set).
55  * In windowed mode, viewport_rect and gl_win rect have the same size.
56  */
57  int top_win_logical_w; /* In fullscreen mode, logical w */
58  int top_win_logical_h; /* In fullscreen mode, logical h */
59  Rec2Di viewport_rect; /* THE DEFAULT VIEWPORT, COMPUTED DURING INIT, MUST *NOT* BE MODIFIED AFTERWARDS */
60  zboolean fullscreen; /* Should always be set to TRUE on Android ? Seems it's expected from SDL */
61  float fullscreen_scale; /* MIN(scale_x, scale_y), to keep aspect ratio */
62  /*
63  * Texture max values
64  */
65  int max_combined_texture_image_units;
66  int max_texture_size;
67  int max_cubemap_texture_size;
68  /*
69  * Background
70  */
71  LG_Texture *bg_uniq_tex;
72  LG_Color_u bg_color; /* Always set after a call to lg_clear_bg() */
73  int bg_shift_x; /* Not sure what the purpose was exactly */
74  int bg_shift_y; /* Not sure what the purpose was exactly */
75  /*
76  * App stuff
77  */
78  char *app_name;
79  char *app_cmd;
80  char *org_name_android; /* Android-specific */
81  char *app_name_android; /* Android-specific */
82  char *assets_dir; /* App data dir on Linux, app assets on Android */
83  char *app_wr_dir; /* App home dir on Linux, app-specific writable persistent dir on Android */
84  char *vbo_cache;
85  char *obj_cache;
86  /*
87  * Mouse support
88  */
89  zboolean enable_mouse;
90  /*
91  * OpenGL ES extensions support
92  */
93  zboolean oes_vao_extension;
94  void (*glGenVertexArraysOES)(GLsizei, GLuint *);
95  void (*glBindVertexArrayOES)(GLuint);
96  void (*glDeleteVertexArraysOES)(GLsizei, const GLuint *);
97  void (*glIsVertexArrayOES)(GLuint);
98  zboolean oes_element_index_uint_extension;
99  zboolean ext_draw_instanced_extension;
100  zboolean ext_texcompr_s3tc_extension;
101  zboolean oes_texcompr_etc1_rgb8_extension;
102  zboolean khr_texcompr_astc_ldr_extension;
103  /*zboolean khr_texcompr_astc_hdr_extension;
104  zboolean ext_texcompr_astc_decode_mode_extension;*/
105  /*
106  * Other stuff
107  */
108  LG_ErrorContext last_error_context;
109  float luminosity_k;
110  LG_Sound **sounds;
111 } LG_Env;
112 
113 #endif /* LG_ENV_H */
LG_Sound
Definition: lg_audio.h:40
LG_Env
Definition: lg_env.h:26
LG_Color_u
Definition: lg_vertex.h:111
LG_Texture
Definition: lg_textures.h:45
LG_ErrorContext
Definition: lg_error.h:40
Rec2Di
Definition: lg_gr_func.h:49