obs-text: Change default size of text to 256

This commit is contained in:
Clayton Groeneveld 2020-01-15 02:18:33 -08:00 committed by jp9000
parent b5d2d26b5b
commit 6a282360f0

View File

@ -1035,12 +1035,41 @@ static obs_properties_t *get_properties(void *data)
return props;
}
static void defaults(obs_data_t *settings, int ver)
{
obs_data_t *font_obj = obs_data_create();
obs_data_set_default_string(font_obj, "face", "Arial");
obs_data_set_default_int(font_obj, "size", ver == 1 ? 36 : 256);
obs_data_set_default_obj(settings, S_FONT, font_obj);
obs_data_set_default_string(settings, S_ALIGN, S_ALIGN_LEFT);
obs_data_set_default_string(settings, S_VALIGN, S_VALIGN_TOP);
obs_data_set_default_int(settings, S_COLOR, 0xFFFFFF);
obs_data_set_default_int(settings, S_OPACITY, 100);
obs_data_set_default_int(settings, S_GRADIENT_COLOR, 0xFFFFFF);
obs_data_set_default_int(settings, S_GRADIENT_OPACITY, 100);
obs_data_set_default_double(settings, S_GRADIENT_DIR, 90.0);
obs_data_set_default_int(settings, S_BKCOLOR, 0x000000);
obs_data_set_default_int(settings, S_BKOPACITY, 0);
obs_data_set_default_int(settings, S_OUTLINE_SIZE, 2);
obs_data_set_default_int(settings, S_OUTLINE_COLOR, 0xFFFFFF);
obs_data_set_default_int(settings, S_OUTLINE_OPACITY, 100);
obs_data_set_default_int(settings, S_CHATLOG_LINES, 6);
obs_data_set_default_bool(settings, S_EXTENTS_WRAP, true);
obs_data_set_default_int(settings, S_EXTENTS_CX, 100);
obs_data_set_default_int(settings, S_EXTENTS_CY, 100);
obs_data_set_default_int(settings, S_TRANSFORM, S_TRANSFORM_NONE);
obs_data_release(font_obj);
};
bool obs_module_load(void)
{
obs_source_info si = {};
si.id = "text_gdiplus";
si.type = OBS_SOURCE_TYPE_INPUT;
si.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW;
si.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW |
OBS_SOURCE_CAP_OBSOLETE;
si.get_properties = get_properties;
si.icon_type = OBS_ICON_TYPE_TEXT;
@ -1057,33 +1086,7 @@ bool obs_module_load(void)
si.get_height = [](void *data) {
return reinterpret_cast<TextSource *>(data)->cy;
};
si.get_defaults = [](obs_data_t *settings) {
obs_data_t *font_obj = obs_data_create();
obs_data_set_default_string(font_obj, "face", "Arial");
obs_data_set_default_int(font_obj, "size", 36);
obs_data_set_default_obj(settings, S_FONT, font_obj);
obs_data_set_default_string(settings, S_ALIGN, S_ALIGN_LEFT);
obs_data_set_default_string(settings, S_VALIGN, S_VALIGN_TOP);
obs_data_set_default_int(settings, S_COLOR, 0xFFFFFF);
obs_data_set_default_int(settings, S_OPACITY, 100);
obs_data_set_default_int(settings, S_GRADIENT_COLOR, 0xFFFFFF);
obs_data_set_default_int(settings, S_GRADIENT_OPACITY, 100);
obs_data_set_default_double(settings, S_GRADIENT_DIR, 90.0);
obs_data_set_default_int(settings, S_BKCOLOR, 0x000000);
obs_data_set_default_int(settings, S_BKOPACITY, 0);
obs_data_set_default_int(settings, S_OUTLINE_SIZE, 2);
obs_data_set_default_int(settings, S_OUTLINE_COLOR, 0xFFFFFF);
obs_data_set_default_int(settings, S_OUTLINE_OPACITY, 100);
obs_data_set_default_int(settings, S_CHATLOG_LINES, 6);
obs_data_set_default_bool(settings, S_EXTENTS_WRAP, true);
obs_data_set_default_int(settings, S_EXTENTS_CX, 100);
obs_data_set_default_int(settings, S_EXTENTS_CY, 100);
obs_data_set_default_int(settings, S_TRANSFORM,
S_TRANSFORM_NONE);
obs_data_release(font_obj);
};
si.get_defaults = [](obs_data_t *settings) { defaults(settings, 1); };
si.update = [](void *data, obs_data_t *settings) {
reinterpret_cast<TextSource *>(data)->Update(settings);
};
@ -1094,7 +1097,15 @@ bool obs_module_load(void)
reinterpret_cast<TextSource *>(data)->Render();
};
obs_source_info si_v2 = si;
si_v2.id = "text_gdiplus_v2";
si_v2.output_flags &= ~OBS_SOURCE_CAP_OBSOLETE;
si_v2.get_defaults = [](obs_data_t *settings) {
defaults(settings, 2);
};
obs_register_source(&si);
obs_register_source(&si_v2);
const GdiplusStartupInput gdip_input;
GdiplusStartup(&gdip_token, &gdip_input, nullptr);