diff --git a/src/libprojectM/ProjectM.cpp b/src/libprojectM/ProjectM.cpp index fedc405a3..3efa4664c 100644 --- a/src/libprojectM/ProjectM.cpp +++ b/src/libprojectM/ProjectM.cpp @@ -94,9 +94,7 @@ auto ProjectM::WriteConfig(const std::string& configurationFilename, const class config.add("Window Height", settings.windowHeight); config.add("Smooth Preset Duration", settings.softCutDuration); config.add("Preset Duration", settings.presetDuration); - config.add("Preset Path", settings.presetURL); - config.add("Title Font", settings.titleFontURL); - config.add("Menu Font", settings.menuFontURL); + config.add("Preset Path", settings.presetPath); config.add("Hard Cut Sensitivity", settings.beatSensitivity); config.add("Aspect Correction", settings.aspectCorrection); config.add("Easter Egg Parameter", settings.easterEgg); @@ -130,34 +128,18 @@ void ProjectM::ReadConfig(const std::string& configurationFilename) m_settings.presetDuration = config.read("Preset Duration", 15); #ifdef __unix__ - m_settings.presetURL = config.read("Preset Path", "/usr/local/share/projectM/presets"); + m_settings.presetPath = config.read("Preset Path", "/usr/local/share/projectM/presets"); #endif #ifdef __APPLE__ /// @bug awful hardcoded hack- need to add intelligence to cmake wrt bundling - carm - m_settings.presetURL = config.read("Preset Path", "../Resources/presets"); + m_settings.presetPath = config.read("Preset Path", "../Resources/presets"); #endif #ifdef WIN32 - m_settings.presetURL = config.read("Preset Path", "/usr/local/share/projectM/presets"); + m_settings.presetPath = config.read("Preset Path", "/usr/local/share/projectM/presets"); #endif -#ifdef __APPLE__ - m_settings.titleFontURL = config.read("Title Font", "../Resources/fonts/Vera.tff"); - m_settings.menuFontURL = config.read("Menu Font", "../Resources/fonts/VeraMono.ttf"); -#endif - -#ifdef __unix__ - m_settings.titleFontURL = config.read("Title Font", "/usr/local/share/projectM/fonts/Vera.tff"); - m_settings.menuFontURL = config.read("Menu Font", "/usr/local/share/projectM/fonts/VeraMono.tff"); -#endif - -#ifdef WIN32 - m_settings.titleFontURL = config.read("Title Font", projectM_FONT_TITLE); - m_settings.menuFontURL = config.read("Menu Font", projectM_FONT_MENU); -#endif - - m_settings.shuffleEnabled = config.read("Shuffle Enabled", true); m_settings.easterEgg = config.read("Easter Egg Parameter", 0.0); @@ -202,11 +184,9 @@ void ProjectM::ReadSettings(const class Settings& settings) m_settings.presetDuration = settings.presetDuration; m_settings.softCutRatingsEnabled = settings.softCutRatingsEnabled; - m_settings.presetURL = settings.presetURL; - m_settings.titleFontURL = settings.titleFontURL; - m_settings.menuFontURL = settings.menuFontURL; + m_settings.presetPath = settings.presetPath; m_settings.shuffleEnabled = settings.shuffleEnabled; - m_settings.datadir = settings.datadir; + m_settings.dataPath = settings.dataPath; m_settings.easterEgg = settings.easterEgg; @@ -414,14 +394,18 @@ void ProjectM::Initialize() m_beatDetect = std::make_unique(m_pcm); // Create texture search path list - if (!m_settings.presetURL.empty()) + if (!m_settings.presetPath.empty()) { - m_textureSearchPaths.emplace_back(m_settings.presetURL); + m_textureSearchPaths.emplace_back(m_settings.presetPath); } - if (!m_settings.datadir.empty()) + if (!m_settings.texturePath.empty()) { - m_textureSearchPaths.emplace_back(m_settings.datadir + pathSeparator + "presets"); - m_textureSearchPaths.emplace_back(m_settings.datadir + pathSeparator + "textures"); + m_textureSearchPaths.emplace_back(m_settings.texturePath); + } + if (!m_settings.dataPath.empty()) + { + m_textureSearchPaths.emplace_back(m_settings.dataPath + pathSeparator + "presets"); + m_textureSearchPaths.emplace_back(m_settings.dataPath + pathSeparator + "textures"); } this->m_renderer = std::make_unique(m_settings.windowWidth, @@ -492,7 +476,7 @@ auto ProjectM::InitializePresetTools() -> void std::string url; if ((m_flags & Flags::DisablePlaylistLoad) != Flags::DisablePlaylistLoad) { - url = Settings().presetURL; + url = Settings().presetPath; } m_presetLoader = std::make_unique(m_settings.meshX, m_settings.meshY, url); diff --git a/src/libprojectM/ProjectM.hpp b/src/libprojectM/ProjectM.hpp index ef8d752b3..029f34dce 100644 --- a/src/libprojectM/ProjectM.hpp +++ b/src/libprojectM/ProjectM.hpp @@ -95,10 +95,9 @@ public: size_t textureSize{512}; size_t windowWidth{512}; size_t windowHeight{512}; - std::string presetURL; - std::string titleFontURL; - std::string menuFontURL; - std::string datadir; + std::string presetPath; + std::string texturePath; + std::string dataPath; double presetDuration{15.0}; double softCutDuration{10.0}; double hardCutDuration{60.0}; diff --git a/src/libprojectM/ProjectMCWrapper.cpp b/src/libprojectM/ProjectMCWrapper.cpp index 79a0873ec..aef2adde7 100644 --- a/src/libprojectM/ProjectMCWrapper.cpp +++ b/src/libprojectM/ProjectMCWrapper.cpp @@ -98,10 +98,9 @@ void projectm_free_settings(const projectm_settings* settings) { if (settings) { - projectm_free_string(settings->preset_url); - projectm_free_string(settings->title_font_url); - projectm_free_string(settings->menu_font_url); - projectm_free_string(settings->data_dir); + projectm_free_string(settings->preset_path); + projectm_free_string(settings->texture_path); + projectm_free_string(settings->data_path); } delete settings; @@ -131,10 +130,9 @@ projectm_handle projectm_create_settings(const projectm_settings* settings, int cppSettings.textureSize = settings->texture_size; cppSettings.windowWidth = settings->window_width; cppSettings.windowHeight = settings->window_height; - cppSettings.presetURL = settings->preset_url ? settings->preset_url : ""; - cppSettings.titleFontURL = settings->title_font_url ? settings->title_font_url : ""; - cppSettings.menuFontURL = settings->menu_font_url ? settings->menu_font_url : ""; - cppSettings.datadir = settings->data_dir ? settings->data_dir : ""; + cppSettings.presetPath = settings->preset_path ? settings->preset_path : ""; + cppSettings.texturePath = settings->texture_path ? settings->texture_path : ""; + cppSettings.dataPath = settings->data_path ? settings->data_path : ""; cppSettings.softCutDuration = settings->soft_cut_duration; cppSettings.presetDuration = settings->preset_duration; cppSettings.hardCutEnabled = settings->hard_cut_enabled; @@ -329,25 +327,19 @@ size_t projectm_get_fps(projectm_handle instance) const char* projectm_get_preset_path(projectm_handle instance) { auto projectMInstance = handle_to_instance(instance); - return projectm_alloc_string_from_std_string(projectMInstance->Settings().presetURL); + return projectm_alloc_string_from_std_string(projectMInstance->Settings().presetPath); } -const char* projectm_get_title_font_filename(projectm_handle instance) +const char* projectm_get_texture_path(projectm_handle instance) { auto projectMInstance = handle_to_instance(instance); - return projectm_alloc_string_from_std_string(projectMInstance->Settings().titleFontURL); + return projectm_alloc_string_from_std_string(projectMInstance->Settings().texturePath); } -const char* projectm_get_menu_font_filename(projectm_handle instance) +const char* projectm_get_data_path(projectm_handle instance) { auto projectMInstance = handle_to_instance(instance); - return projectm_alloc_string_from_std_string(projectMInstance->Settings().menuFontURL); -} - -const char* projectm_get_data_dir_path(projectm_handle instance) -{ - auto projectMInstance = handle_to_instance(instance); - return projectm_alloc_string_from_std_string(projectMInstance->Settings().datadir); + return projectm_alloc_string_from_std_string(projectMInstance->Settings().dataPath); } void projectm_set_aspect_correction(projectm_handle instance, bool enabled) @@ -432,10 +424,9 @@ projectm_settings* projectm_get_settings(projectm_handle instance) settingsStruct->texture_size = settings.textureSize; settingsStruct->window_width = settings.windowWidth; settingsStruct->window_height = settings.windowHeight; - settingsStruct->preset_url = projectm_alloc_string_from_std_string(settings.presetURL); - settingsStruct->title_font_url = projectm_alloc_string_from_std_string(settings.titleFontURL); - settingsStruct->menu_font_url = projectm_alloc_string_from_std_string(settings.menuFontURL); - settingsStruct->data_dir = projectm_alloc_string_from_std_string(settings.datadir); + settingsStruct->preset_path = projectm_alloc_string_from_std_string(settings.presetPath); + settingsStruct->texture_path = projectm_alloc_string_from_std_string(settings.texturePath); + settingsStruct->data_path = projectm_alloc_string_from_std_string(settings.dataPath); settingsStruct->soft_cut_duration = settings.softCutDuration; settingsStruct->preset_duration = settings.presetDuration; settingsStruct->hard_cut_enabled = settings.hardCutEnabled; @@ -459,10 +450,9 @@ void projectm_write_config(const char* config_file, const projectm_settings* set cppSettings.textureSize = settings->texture_size; cppSettings.windowWidth = settings->window_width; cppSettings.windowHeight = settings->window_height; - cppSettings.presetURL = settings->preset_url ? settings->preset_url : ""; - cppSettings.titleFontURL = settings->title_font_url ? settings->title_font_url : ""; - cppSettings.menuFontURL = settings->menu_font_url ? settings->menu_font_url : ""; - cppSettings.datadir = settings->data_dir ? settings->data_dir : ""; + cppSettings.presetPath = settings->preset_path ? settings->preset_path : ""; + cppSettings.texturePath = settings->texture_path ? settings->texture_path : ""; + cppSettings.dataPath = settings->data_path ? settings->data_path : ""; cppSettings.softCutDuration = settings->soft_cut_duration; cppSettings.presetDuration = settings->preset_duration; cppSettings.hardCutEnabled = settings->hard_cut_enabled; diff --git a/src/libprojectM/projectM.h b/src/libprojectM/projectM.h index 77bb02467..b81aeb20c 100644 --- a/src/libprojectM/projectM.h +++ b/src/libprojectM/projectM.h @@ -56,10 +56,9 @@ typedef struct PROJECTM_EXPORT projectm_settings_s int texture_size; //!< Size of the render texture. Must be a power of 2. int window_width; //!< Width of the rendering viewport. int window_height; //!< Height of the rendering viewport. - char* preset_url; //!< Path to a preset playlist in XML format to be loaded. Use FLAG_DISABLE_PLAYLIST_LOAD to skip loading a playlist. - char* title_font_url; //!< Path to the "title" font that is used to render the preset name. - char* menu_font_url; //!< Path to the "menu" font that is used to render the built-in on-screen menu. - char* data_dir; //!< Path to data files like default fonts and presets. + char* preset_path; //!< Path with preset files to be loaded into the playlist. Use FLAG_DISABLE_PLAYLIST_LOAD to skip automatic loading of presets. + char* texture_path; //!< Additional path with texture files for use in presets. + char* data_path; //!< Path to data files like default textures and presets. double preset_duration; //!< Display duration for each preset in seconds. double soft_cut_duration; //!< Blend-over duration between two presets in seconds. double hard_cut_duration; //!< Minimum time in seconds a preset is displayed before a hard cut can happen. @@ -526,25 +525,18 @@ PROJECTM_EXPORT size_t projectm_get_fps(projectm_handle instance); PROJECTM_EXPORT const char* projectm_get_preset_path(projectm_handle instance); /** - * @brief Returns the path and filename of the font used to render the title overlay text. + * @brief Returns the search path for additional textures. * @param instance The projectM instance handle. - * @return The path and filename of the title text font. + * @return The path used to search for additional textures. */ -PROJECTM_EXPORT const char* projectm_get_title_font_filename(projectm_handle instance); - -/** - * @brief Returns the path and filename of the font used to render the menu overlay text. - * @param instance The projectM instance handle. - * @return The path and filename of the menu text font. - */ -PROJECTM_EXPORT const char* projectm_get_menu_font_filename(projectm_handle instance); +PROJECTM_EXPORT const char* projectm_get_texture_path(projectm_handle instance); /** * @brief Returns the path projectM uses to search for additional data. * @param instance The projectM instance handle. * @return The data dir path. */ -PROJECTM_EXPORT const char* projectm_get_data_dir_path(projectm_handle instance); +PROJECTM_EXPORT const char* projectm_get_data_path(projectm_handle instance); /** * @brief Enabled or disables aspect ratio correction in presets that support it.