libobs: Add func to set display background color
This function sets the background color for a displaymaster
parent
1a9c512f38
commit
27a0749d8d
|
@ -41,6 +41,7 @@ bool obs_display_init(struct obs_display *display,
|
|||
return false;
|
||||
}
|
||||
|
||||
display->background_color = 0x4C4C4C;
|
||||
display->enabled = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -150,7 +151,9 @@ static inline void render_display_begin(struct obs_display *display)
|
|||
|
||||
gs_begin_scene();
|
||||
|
||||
vec4_set(&clear_color, 0.3f, 0.3f, 0.3f, 1.0f);
|
||||
vec4_from_rgba(&clear_color, display->background_color);
|
||||
clear_color.w = 1.0f;
|
||||
|
||||
gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH | GS_CLEAR_STENCIL,
|
||||
&clear_color, 1.0f, 0);
|
||||
|
||||
|
@ -199,3 +202,9 @@ bool obs_display_enabled(obs_display_t *display)
|
|||
{
|
||||
return display ? display->enabled : false;
|
||||
}
|
||||
|
||||
void obs_display_set_background_color(obs_display_t *display, uint32_t color)
|
||||
{
|
||||
if (display)
|
||||
display->background_color = color;
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ struct obs_display {
|
|||
bool size_changed;
|
||||
bool enabled;
|
||||
uint32_t cx, cy;
|
||||
uint32_t background_color;
|
||||
gs_swapchain_t *swap;
|
||||
pthread_mutex_t draw_callbacks_mutex;
|
||||
DARRAY(struct draw_callback) draw_callbacks;
|
||||
|
|
|
@ -625,6 +625,9 @@ EXPORT void obs_display_remove_draw_callback(obs_display_t *display,
|
|||
EXPORT void obs_display_set_enabled(obs_display_t *display, bool enable);
|
||||
EXPORT bool obs_display_enabled(obs_display_t *display);
|
||||
|
||||
EXPORT void obs_display_set_background_color(obs_display_t *display,
|
||||
uint32_t color);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Sources */
|
||||
|
|
Loading…
Reference in New Issue