LibGame v0.4.0
The LG Game Engine - Copyright (C) 2024-2026 ETMSoftware
Loading...
Searching...
No Matches
lg_env.h
1/*
2 * LibGame - Copyright (C) Emmanuel Thomas-Maurin 2011-2026
3 * All rights reserved
4 */
5
6#ifndef LG_ENV_H
7#define LG_ENV_H
8
26typedef 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 -> now 3.1
43 */
44 SDL_Window *gl_win; /* Top SDL/GL win */
45 SDL_GLContext gl_context;
46 /*
47 * Opengl ES version >= 2.0 -> now 3.1
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 *app_cache; /* Sub-dir of app_wr_dir */
85 /*
86 * Mouse support
87 */
88 zboolean enable_mouse;
89 /*
90 * OpenGL ES extensions support
91 */
92 zboolean oes_vao_extension;
93 void (*glGenVertexArraysOES)(GLsizei, GLuint *);
94 void (*glBindVertexArrayOES)(GLuint);
95 void (*glDeleteVertexArraysOES)(GLsizei, const GLuint *);
96 void (*glIsVertexArrayOES)(GLuint);
97 zboolean oes_element_index_uint_extension;
98 zboolean ext_draw_instanced_extension;
99 zboolean ext_texcompr_s3tc_extension;
100 zboolean oes_texcompr_etc1_rgb8_extension;
101 zboolean khr_texcompr_astc_ldr_extension;
102 /*zboolean khr_texcompr_astc_hdr_extension;
103 zboolean ext_texcompr_astc_decode_mode_extension;*/
104 /*
105 * Other stuff
106 */
107 LG_ErrorContext last_error_context;
108 float luminosity_k;
109 LG_Sound **sounds;
110
111} LG_Env;
112
113#endif /* LG_ENV_H */
Definition lg_vertex.h:111
Definition lg_env.h:26
Definition lg_error.h:40
Definition lg_audio.h:42
Definition lg_textures.h:45
Definition lg_gr_func.h:49