MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / d3d_SetPreferredState

Function d3d_SetPreferredState

legacy/renderer/Direct3D.cpp:2943–2974  ·  view source on GitHub ↗

Sets up a some global preferences for D3D

Source from the content-addressed store, hash-verified

2941
2942// Sets up a some global preferences for D3D
2943int d3d_SetPreferredState(renderer_preferred_state *pref_state) {
2944 int retval = 1;
2945 renderer_preferred_state old_state = D3D_preferred_state;
2946 mprintf(0, "In D3d_SetPreferredState\n");
2947
2948 D3D_preferred_state = *pref_state;
2949
2950 if (D3D_state.initted) {
2951 int reinit = 0;
2952
2953 // Change gamma if needed
2954 if (pref_state->width != D3D_state.screen_width || pref_state->height != D3D_state.screen_height ||
2955 pref_state->bit_depth != old_state.bit_depth)
2956 reinit = 1;
2957
2958 if (reinit) {
2959 d3d_Close();
2960 retval = d3d_Init(ParentApplication, &D3D_preferred_state);
2961 } else {
2962 if (old_state.gamma != pref_state->gamma) {
2963 d3d_SetGammaValue(pref_state->gamma);
2964 }
2965
2966 if (old_state.mipping != pref_state->mipping) {
2967 d3d_SetMipState(pref_state->mipping);
2968 }
2969 }
2970 } else
2971 D3D_preferred_state = *pref_state;
2972
2973 return retval;
2974}
2975
2976// Sets the resolution that D3D uses
2977void d3d_SetResolution(int width, int height) {

Callers 1

rend_SetPreferredStateFunction · 0.85

Calls 4

d3d_CloseFunction · 0.85
d3d_InitFunction · 0.85
d3d_SetGammaValueFunction · 0.85
d3d_SetMipStateFunction · 0.85

Tested by

no test coverage detected