UI: Add ability to style preview background color
This commit is contained in:
@@ -46,17 +46,22 @@ bool obs_display_init(struct obs_display *display,
|
||||
return false;
|
||||
}
|
||||
|
||||
display->background_color = 0x4C4C4C;
|
||||
display->enabled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
obs_display_t *obs_display_create(const struct gs_init_data *graphics_data)
|
||||
obs_display_t *obs_display_create(const struct gs_init_data *graphics_data,
|
||||
uint32_t background_color)
|
||||
{
|
||||
struct obs_display *display = bzalloc(sizeof(struct obs_display));
|
||||
|
||||
gs_enter_context(obs->video.graphics);
|
||||
|
||||
if (background_color)
|
||||
display->background_color = background_color;
|
||||
else
|
||||
display->background_color = 0x4c4c4c;
|
||||
|
||||
if (!obs_display_init(display, graphics_data)) {
|
||||
obs_display_destroy(display);
|
||||
display = NULL;
|
||||
@@ -227,6 +232,10 @@ bool obs_display_enabled(obs_display_t *display)
|
||||
|
||||
void obs_display_set_background_color(obs_display_t *display, uint32_t color)
|
||||
{
|
||||
if (display)
|
||||
display->background_color = color;
|
||||
if (display) {
|
||||
if (color)
|
||||
display->background_color = color;
|
||||
else
|
||||
display->background_color = 0x4c4c4c;
|
||||
}
|
||||
}
|
||||
|
@@ -748,7 +748,8 @@ EXPORT void obs_view_render(obs_view_t *view);
|
||||
* @return The new display context, or NULL if failed.
|
||||
*/
|
||||
EXPORT obs_display_t *obs_display_create(
|
||||
const struct gs_init_data *graphics_data);
|
||||
const struct gs_init_data *graphics_data,
|
||||
uint32_t backround_color);
|
||||
|
||||
/** Destroys a display context */
|
||||
EXPORT void obs_display_destroy(obs_display_t *display);
|
||||
|
Reference in New Issue
Block a user