diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index 255b9362f..225e8faa8 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -3,10 +3,7 @@ add_library(projectM_api INTERFACE) target_sources(projectM_api PRIVATE "${PROJECTM_EXPORT_HEADER}" - include/libprojectM/event.h - include/libprojectM/lvtoprojectM.h include/libprojectM/projectM.h - include/libprojectM/sdltoprojectM.h ) set_target_properties(projectM_api PROPERTIES diff --git a/src/api/include/libprojectM/event.h b/src/api/include/libprojectM/event.h deleted file mode 100755 index 624589bf9..000000000 --- a/src/api/include/libprojectM/event.h +++ /dev/null @@ -1,153 +0,0 @@ -/** - * projectM -- Milkdrop-esque visualisation SDK - * Copyright (C)2003-2004 projectM Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * See 'LICENSE.txt' included within this release - * - */ -/** - * $Id: event.h,v 1.2 2004/10/08 10:54:27 cvs Exp $ - * - * projectM keycodes. Enables translation from various event schemes such as Win32, SDL - * &c. - * - * $Log: event.h,v $ - */ - -#pragma once - -typedef enum { - /** Event types */ - PROJECTM_KEYUP, - PROJECTM_KEYDOWN, - PROJECTM_VIDEORESIZE, - PROJECTM_VIDEOQUIT, - } projectMEvent; - -typedef enum { - /** Keycodes */ - PROJECTM_K_RETURN, - PROJECTM_K_RIGHT, - PROJECTM_K_LEFT, - PROJECTM_K_UP, - PROJECTM_K_DOWN, - PROJECTM_K_PAGEUP, - PROJECTM_K_PAGEDOWN, - PROJECTM_K_INSERT, - PROJECTM_K_DELETE, - PROJECTM_K_ESCAPE, - PROJECTM_K_LSHIFT, - PROJECTM_K_RSHIFT, - PROJECTM_K_CAPSLOCK, - PROJECTM_K_LCTRL, - PROJECTM_K_HOME, - PROJECTM_K_END, - PROJECTM_K_BACKSPACE, - PROJECTM_K_SLASH, - PROJECTM_K_BACKSLASH, - - PROJECTM_K_F1, - PROJECTM_K_F2, - PROJECTM_K_F3, - PROJECTM_K_F4, - PROJECTM_K_F5, - PROJECTM_K_F6, - PROJECTM_K_F7, - PROJECTM_K_F8, - PROJECTM_K_F9, - PROJECTM_K_F10, - PROJECTM_K_F11, - PROJECTM_K_F12, - - PROJECTM_K_0 = 48, - PROJECTM_K_1, - PROJECTM_K_2, - PROJECTM_K_3, - PROJECTM_K_4, - PROJECTM_K_5, - PROJECTM_K_6, - PROJECTM_K_7, - PROJECTM_K_8, - PROJECTM_K_9, - - PROJECTM_K_A = 65, - PROJECTM_K_B, - PROJECTM_K_C, - PROJECTM_K_D, - PROJECTM_K_E, - PROJECTM_K_F, - PROJECTM_K_G, - PROJECTM_K_H, - PROJECTM_K_I, - PROJECTM_K_J, - PROJECTM_K_K, - PROJECTM_K_L, - PROJECTM_K_M, - PROJECTM_K_N, - PROJECTM_K_O, - PROJECTM_K_P, - PROJECTM_K_Q, - PROJECTM_K_R, - PROJECTM_K_S, - PROJECTM_K_T, - PROJECTM_K_U, - PROJECTM_K_V, - PROJECTM_K_W, - PROJECTM_K_X, - PROJECTM_K_Y, - PROJECTM_K_Z, - - PROJECTM_K_a = 97, - PROJECTM_K_b, - PROJECTM_K_c, - PROJECTM_K_d, - PROJECTM_K_e, - PROJECTM_K_f, - PROJECTM_K_g, - PROJECTM_K_h, - PROJECTM_K_i, - PROJECTM_K_j, - PROJECTM_K_k, - PROJECTM_K_l, - PROJECTM_K_m, - PROJECTM_K_n, - PROJECTM_K_o, - PROJECTM_K_p, - PROJECTM_K_q, - PROJECTM_K_r, - PROJECTM_K_s, - PROJECTM_K_t, - PROJECTM_K_u, - PROJECTM_K_v, - PROJECTM_K_w, - PROJECTM_K_x, - PROJECTM_K_y, - PROJECTM_K_z, - PROJECTM_K_NONE, - PROJECTM_K_PLUS, - PROJECTM_K_MINUS, - PROJECTM_K_EQUALS - } projectMKeycode; - -typedef enum { - /** Modifiers */ - PROJECTM_KMOD_NONE = -1, - PROJECTM_KMOD_LSHIFT, - PROJECTM_KMOD_RSHIFT, - PROJECTM_KMOD_CAPS, - PROJECTM_KMOD_LCTRL, - PROJECTM_KMOD_RCTRL, - } projectMModifier; diff --git a/src/api/include/libprojectM/lvtoprojectM.h b/src/api/include/libprojectM/lvtoprojectM.h deleted file mode 100755 index 4215b8abe..000000000 --- a/src/api/include/libprojectM/lvtoprojectM.h +++ /dev/null @@ -1,156 +0,0 @@ -/** - * projectM -- Milkdrop-esque visualisation SDK - * Copyright (C)2003-2007 projectM Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * See 'LICENSE.txt' included within this release - * - */ -/** - * $Id: sdltoprojectM.hpp,v 1.1 2004/10/08 00:35:28 cvs Exp $ - * - * Translates SDL -> projectM variables - * - * $Log: sdltoprojectM.hpp,v $ - * Revision 1.1 2004/10/08 00:35:28 cvs - * Moved and imported - * - * Revision 1.1.1.1 2004/10/04 12:56:00 cvs - * Imported - * - */ - -#include - -projectMEvent lv2pmEvent( VisEventType event ) { - - switch ( event ) { - case VISUAL_EVENT_RESIZE: - return PROJECTM_VIDEORESIZE; - case VISUAL_EVENT_KEYUP: - return PROJECTM_KEYUP; - case VISUAL_EVENT_KEYDOWN: - return PROJECTM_KEYDOWN; - default: - return PROJECTM_KEYUP; - } - } -projectMKeycode lv2pmKeycode( VisKey keysym ) -{ - switch ( keysym ) - { - case VKEY_F1: - return PROJECTM_K_F1; - case VKEY_F2: - return PROJECTM_K_F2; - case VKEY_F3: - return PROJECTM_K_F3; - case VKEY_F4: - return PROJECTM_K_F4; - case VKEY_F5: - return PROJECTM_K_F5; - case VKEY_F6: - return PROJECTM_K_F6; - case VKEY_F7: - return PROJECTM_K_F7; - case VKEY_F8: - return PROJECTM_K_F8; - case VKEY_F9: - return PROJECTM_K_F9; - case VKEY_F10: - return PROJECTM_K_F10; - case VKEY_F11: - return PROJECTM_K_F11; - case VKEY_F12: - return PROJECTM_K_F12; - case VKEY_ESCAPE: - return PROJECTM_K_ESCAPE; - case VKEY_a: - return PROJECTM_K_a; - case VKEY_b: - return PROJECTM_K_b; - case VKEY_c: - return PROJECTM_K_c; - case VKEY_d: - return PROJECTM_K_d; - case VKEY_e: - return PROJECTM_K_e; - case VKEY_f: - return PROJECTM_K_f; - case VKEY_g: - return PROJECTM_K_g; - case VKEY_h: - return PROJECTM_K_h; - case VKEY_i: - return PROJECTM_K_i; - case VKEY_j: - return PROJECTM_K_j; - case VKEY_k: - return PROJECTM_K_k; - case VKEY_l: - return PROJECTM_K_l; - case VKEY_m: - return PROJECTM_K_m; - case VKEY_n: - return PROJECTM_K_n; - case VKEY_o: - return PROJECTM_K_o; - case VKEY_p: - return PROJECTM_K_p; - case VKEY_q: - return PROJECTM_K_q; - case VKEY_r: - return PROJECTM_K_r; - case VKEY_s: - return PROJECTM_K_s; - case VKEY_t: - return PROJECTM_K_t; - case VKEY_u: - return PROJECTM_K_u; - case VKEY_v: - return PROJECTM_K_v; - case VKEY_w: - return PROJECTM_K_w; - case VKEY_x: - return PROJECTM_K_x; - case VKEY_y: - return PROJECTM_K_y; - case VKEY_z: - return PROJECTM_K_z; - case VKEY_UP: - return PROJECTM_K_UP; - case VKEY_RETURN: - return PROJECTM_K_RETURN; - case VKEY_RIGHT: - return PROJECTM_K_RIGHT; - case VKEY_LEFT: - return PROJECTM_K_LEFT; - case VKEY_DOWN: - return PROJECTM_K_DOWN; - case VKEY_PAGEUP: - return PROJECTM_K_PAGEUP; - case VKEY_PAGEDOWN: - return PROJECTM_K_PAGEDOWN; - - - default: - return PROJECTM_K_NONE; - break; - } - } - -projectMModifier lv2pmModifier( int mod ) { - return mod && VKMOD_LSHIFT; - } diff --git a/src/api/include/libprojectM/projectM.h b/src/api/include/libprojectM/projectM.h index 878670c43..cce42b693 100644 --- a/src/api/include/libprojectM/projectM.h +++ b/src/api/include/libprojectM/projectM.h @@ -21,7 +21,6 @@ #pragma once -#include "libprojectM/event.h" #include "libprojectM/projectM_export.h" #include @@ -295,39 +294,6 @@ PROJECTM_EXPORT void projectm_render_frame(projectm_handle instance); */ PROJECTM_EXPORT unsigned int projectm_init_render_to_texture(projectm_handle instance); -/** - * @brief Key handler that processes user input. - * - *

This method can be used to send user input in the host application to projectM, for example - * to switch presets, display the help and search menus or change settings like beat sensitivity.

- * - *

All actions executed by the key handler can also be run programmatically if the host application - * is not able to redirect keyboard input to projectM.

- * - * @param instance The projectM instance handle. - * @param event The key event, valid are either PROJECTM_KEYUP or PROJECTM_KEYDOWN. - * @param keycode The key code, mapped to a value of the projectMKeycode enumeration. - * @param modifier The key modifier as a value from the projectMModifier. - */ -PROJECTM_EXPORT void projectm_key_handler(projectm_handle instance, projectMEvent event, - projectMKeycode keycode, projectMModifier modifier); - -/** - * @brief Default key handler that processes user input. - * - *

This method can be used to send user input in the host application to projectM, for example - * to switch presets, display the help and search menus or change settings like beat sensitivity.

- * - *

All actions executed by the key handler can also be run programmatically if the host application - * is not able to redirect keyboard input to projectM.

- * - * @param instance The projectM instance handle. - * @param event The key event, valid are either PROJECTM_KEYUP or PROJECTM_KEYDOWN. - * @param keycode The key code, mapped to a value of the projectMKeycode enumeration. - */ -PROJECTM_EXPORT void projectm_default_key_handler(projectm_handle instance, projectMEvent event, - projectMKeycode keycode); - /** * @brief Returns the size of the internal render texture. * @param instance The projectM instance handle. @@ -607,6 +573,13 @@ PROJECTM_EXPORT projectm_settings* projectm_get_settings(projectm_handle instanc */ PROJECTM_EXPORT void projectm_write_config(const char* config_file, const projectm_settings* settings); +/** + * @brief Returns whether the current preset is locked or not. + * @param instance The projectM instance handle. + * @return True if the preset lock is enabled, false otherwise. + */ +PROJECTM_EXPORT bool projectm_get_preset_locked(projectm_handle instance); + /** * @brief Locks or unlocks the current preset. * @@ -616,14 +589,7 @@ PROJECTM_EXPORT void projectm_write_config(const char* config_file, const projec * @param instance The projectM instance handle. * @param lock True to lock the current preset, false to enable automatic transitions. */ -PROJECTM_EXPORT void projectm_lock_preset(projectm_handle instance, bool lock); - -/** - * @brief Returns whether the current preset is locked or not. - * @param instance The projectM instance handle. - * @return True if the preset lock is enabled, false otherwise. - */ -PROJECTM_EXPORT bool projectm_is_preset_locked(projectm_handle instance); +PROJECTM_EXPORT void projectm_set_preset_locked(projectm_handle instance, bool lock); /** * @brief Returns the current viewport size in pixels. diff --git a/src/api/include/libprojectM/sdltoprojectM.h b/src/api/include/libprojectM/sdltoprojectM.h deleted file mode 100755 index 751ee0f48..000000000 --- a/src/api/include/libprojectM/sdltoprojectM.h +++ /dev/null @@ -1,223 +0,0 @@ -/** - * projectM -- Milkdrop-esque visualisation SDK - * Copyright (C)2003-2007 projectM Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * See 'LICENSE.txt' included within this release - * - */ -/** - * $Id: sdltoprojectM.hpp,v 1.1 2004/10/08 00:35:28 cvs Exp $ - * - * Translates SDL -> projectM variables - * - * $Log: sdltoprojectM.hpp,v $ - * Revision 1.1 2004/10/08 00:35:28 cvs - * Moved and imported - * - * Revision 1.1.1.1 2004/10/04 12:56:00 cvs - * Imported - * - */ - -#ifndef _SDLTOPROJECTM_H -#define _SDLTOPROJECTM_H - -#include "libprojectM/event.h" - -#ifdef _WIN32 -#include -#else -#include -#endif - -inline projectMEvent sdl2pmEvent(const SDL_Event *event ) { \ - - switch ( event->type ) { \ - case SDL_WINDOWEVENT_RESIZED: - return PROJECTM_VIDEORESIZE; \ - case SDL_KEYUP: \ - return PROJECTM_KEYUP; \ - case SDL_KEYDOWN: \ - return PROJECTM_KEYDOWN; \ - default: - return PROJECTM_KEYUP; \ - } \ - } \ - -inline projectMKeycode sdl2pmKeycode( SDL_Keycode keycode , SDL_Keymod mod ) { \ - switch ( keycode ) { \ - case SDLK_F1: \ - return PROJECTM_K_F1; \ - case SDLK_F2: \ - return PROJECTM_K_F2; \ - case SDLK_F3: \ - return PROJECTM_K_F3; \ - case SDLK_F4: \ - return PROJECTM_K_F4; \ - case SDLK_F5: \ - return PROJECTM_K_F5; \ - case SDLK_F6: \ - return PROJECTM_K_F6; \ - case SDLK_F7: \ - return PROJECTM_K_F7; \ - case SDLK_F8: \ - return PROJECTM_K_F8; \ - case SDLK_F9: \ - return PROJECTM_K_F9; \ - case SDLK_F10: \ - return PROJECTM_K_F10; \ - case SDLK_F11: \ - return PROJECTM_K_F11; \ - case SDLK_F12: \ - return PROJECTM_K_F12; \ - case SDLK_ESCAPE: \ - return PROJECTM_K_ESCAPE; - case SDLK_a: - if (mod & KMOD_SHIFT) - return PROJECTM_K_A; - return PROJECTM_K_a; - case SDLK_b: - if (mod & KMOD_SHIFT) - return PROJECTM_K_B; - return PROJECTM_K_b; - case SDLK_c: - if (mod & KMOD_SHIFT) - return PROJECTM_K_C; - return PROJECTM_K_c; - case SDLK_d: - if (mod & KMOD_SHIFT) - return PROJECTM_K_D; - return PROJECTM_K_d; - case SDLK_e: - if (mod & KMOD_SHIFT) - return PROJECTM_K_E; - return PROJECTM_K_e; - case SDLK_f: - if (mod & KMOD_SHIFT) - return PROJECTM_K_F; - return PROJECTM_K_f; - case SDLK_g: - if (mod & KMOD_SHIFT) - return PROJECTM_K_G; - return PROJECTM_K_g; - case SDLK_h: - if (mod & KMOD_SHIFT) - return PROJECTM_K_H; - return PROJECTM_K_h; - case SDLK_i: - if (mod & KMOD_SHIFT) - return PROJECTM_K_I; - return PROJECTM_K_i; - case SDLK_j: - if (mod & KMOD_SHIFT) - return PROJECTM_K_J; - return PROJECTM_K_j; - case SDLK_k: - if (mod & KMOD_SHIFT) - return PROJECTM_K_K; - return PROJECTM_K_k; - case SDLK_l: - if (mod & KMOD_SHIFT) - return PROJECTM_K_L; - return PROJECTM_K_l; - case SDLK_m: - if (mod & KMOD_SHIFT) - return PROJECTM_K_M; - return PROJECTM_K_m; - case SDLK_n: - if (mod & KMOD_SHIFT) - return PROJECTM_K_N; - return PROJECTM_K_n; - case SDLK_o: - if (mod & KMOD_SHIFT) - return PROJECTM_K_O; - return PROJECTM_K_o; - case SDLK_p: - if (mod & KMOD_SHIFT) - return PROJECTM_K_P; - return PROJECTM_K_p; - case SDLK_q: - if (mod & KMOD_SHIFT) - return PROJECTM_K_Q; - return PROJECTM_K_q; - case SDLK_r: - if (mod & KMOD_SHIFT) - return PROJECTM_K_R; - return PROJECTM_K_r; - case SDLK_s: - if (mod & KMOD_SHIFT) - return PROJECTM_K_S; - return PROJECTM_K_s; - case SDLK_t: - if (mod & KMOD_SHIFT) - return PROJECTM_K_T; - return PROJECTM_K_t; - case SDLK_u: - if (mod & KMOD_SHIFT) - return PROJECTM_K_U; - return PROJECTM_K_u; - case SDLK_v: - if (mod & KMOD_SHIFT) - return PROJECTM_K_V; - return PROJECTM_K_v; - case SDLK_w: - if (mod & KMOD_SHIFT) - return PROJECTM_K_W; - return PROJECTM_K_w; - case SDLK_x: - if (mod & KMOD_SHIFT) - return PROJECTM_K_X; - return PROJECTM_K_x; - case SDLK_y: - if (mod & KMOD_SHIFT) - return PROJECTM_K_Y; - return PROJECTM_K_y; - case SDLK_z: - if (mod & KMOD_SHIFT) - return PROJECTM_K_Z; - return PROJECTM_K_z; - case SDLK_UP: - return PROJECTM_K_UP; - case SDLK_RETURN: - return PROJECTM_K_RETURN; - case SDLK_SLASH: - return PROJECTM_K_SLASH; - case SDLK_BACKSLASH: - return PROJECTM_K_BACKSLASH; - case SDLK_RIGHT: - return PROJECTM_K_RIGHT; - case SDLK_LEFT: - return PROJECTM_K_LEFT; - case SDLK_DOWN: - return PROJECTM_K_DOWN; - case SDLK_PAGEUP: - return PROJECTM_K_PAGEUP; - case SDLK_PAGEDOWN: - return PROJECTM_K_PAGEDOWN; - case SDLK_HOME: - return PROJECTM_K_HOME; - case SDLK_END: - return PROJECTM_K_END; - default: \ - return PROJECTM_K_NONE; \ - } \ - } \ - -inline projectMModifier sdl2pmModifier( SDL_Keymod mod ) { \ - return PROJECTM_KMOD_LSHIFT; \ - } \ - -#endif /** _SDLTOPROJECTM_H */ diff --git a/src/libprojectM/CMakeLists.txt b/src/libprojectM/CMakeLists.txt index 294400c93..91670fad4 100644 --- a/src/libprojectM/CMakeLists.txt +++ b/src/libprojectM/CMakeLists.txt @@ -46,8 +46,6 @@ add_library(projectM_main OBJECT gltext.h HungarianMethod.hpp IdleTextures.hpp - KeyHandler.cpp - KeyHandler.hpp PCM.cpp PCM.hpp PipelineMerger.cpp diff --git a/src/libprojectM/KeyHandler.cpp b/src/libprojectM/KeyHandler.cpp deleted file mode 100755 index 4f567323c..000000000 --- a/src/libprojectM/KeyHandler.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/** - * projectM -- Milkdrop-esque visualisation SDK - * Copyright (C)2003-2004 projectM Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * See 'LICENSE.txt' included within this release - * - */ - -#include "ProjectM.hpp" -#include "Renderer.hpp" -#include "TimeKeeper.hpp" -#include "libprojectM/event.h" - -#include - - -class Preset; -void selectRandom(const bool hardCut); -void selectNext(const bool hardCut); -void selectPrevious(const bool hardCut); - -std::string round_float(float number) -{ - std::string num_text = std::to_string(number); - std::string rounded = num_text.substr(0, num_text.find(".")+3); - return rounded; -} - -void ProjectM::KeyHandler(projectMEvent event, - projectMKeycode keyCode, - projectMModifier modifier) -{ - switch (event) - { - case PROJECTM_KEYDOWN: - DefaultKeyHandler(event, keyCode); - break; - - default: - break; - } -} - -void ProjectM::DefaultKeyHandler(projectMEvent event, projectMKeycode keycode) { - - switch( event ) { - - case PROJECTM_KEYDOWN: - - switch (keycode) - { - - case PROJECTM_K_UP: - m_beatDetect->beatSensitivity += 0.01; - if (m_beatDetect->beatSensitivity > 5.0) - { - m_beatDetect->beatSensitivity = 5.0; - } - break; - case PROJECTM_K_DOWN: - m_beatDetect->beatSensitivity -= 0.01; - if (m_beatDetect->beatSensitivity < 0) - { - m_beatDetect->beatSensitivity = 0; - } - break; - - case PROJECTM_K_a: - m_renderer->correction = !m_renderer->correction; - break; - - case PROJECTM_K_l: - SetPresetLocked(!PresetLocked()); - break; - - default: - break; - } - default: - break; - - } -} diff --git a/src/libprojectM/KeyHandler.hpp b/src/libprojectM/KeyHandler.hpp deleted file mode 100755 index c15b225aa..000000000 --- a/src/libprojectM/KeyHandler.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * projectM -- Milkdrop-esque visualisation SDK - * Copyright (C)2003-2007 projectM Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * See 'LICENSE.txt' included within this release - * - */ -/** - * $Id: console_interface.h,v 1.1.1.1 2005/12/23 18:05:03 psperl Exp $ - * - * $Log$ - */ - -#ifndef _KEY_HANDLER_HPP -#define _KEY_HANDLER_HPP - -#include "libprojectM/event.h" - -class ProjectM; -void default_key_handler(ProjectM *PM, projectMEvent event, projectMKeycode keycode); -void refreshConsole(); -#if defined(__CPLUSPLUS) && !defined(MACOS) -extern "C" void key_handler(projectM *PM, projectMEvent event, projectMKeycode keycode, projectMModifier modifier ); -#else -extern void key_handler(ProjectM *PM, projectMEvent event, projectMKeycode keycode, projectMModifier modifier ); -#endif -#endif /** !_KEY_HANDLER_HPP */ diff --git a/src/libprojectM/ProjectM.cpp b/src/libprojectM/ProjectM.cpp index faf1599f2..577dca4d2 100644 --- a/src/libprojectM/ProjectM.cpp +++ b/src/libprojectM/ProjectM.cpp @@ -524,7 +524,7 @@ auto ProjectM::TextureSize() const -> size_t void ProjectM::SetBeatSensitivity(float sensitivity) { - m_beatDetect->beatSensitivity = sensitivity; + m_beatDetect->beatSensitivity = std::min(std::max(0.0f, sensitivity), 2.0f); } auto ProjectM::GetBeatSensitivity() const -> float diff --git a/src/libprojectM/ProjectM.hpp b/src/libprojectM/ProjectM.hpp index 74b5c3113..09c389fb7 100644 --- a/src/libprojectM/ProjectM.hpp +++ b/src/libprojectM/ProjectM.hpp @@ -25,8 +25,6 @@ #include "PresetFactoryManager.hpp" #include "fatal.h" -#include "libprojectM/event.h" - #ifdef _WIN32 #ifdef _MSC_VER @@ -140,10 +138,6 @@ public: auto InitRenderToTexture() -> unsigned; - void KeyHandler(projectMEvent event, - projectMKeycode keyCode, - projectMModifier modifier); - void SetTextureSize(size_t size); auto TextureSize() const -> size_t; @@ -226,8 +220,6 @@ public: auto WindowHeight() -> int; - void DefaultKeyHandler(projectMEvent event, projectMKeycode keycode); - /** * @brief Dumps a debug image to the working dir when the next frame is rendered. * diff --git a/src/libprojectM/ProjectMCWrapper.cpp b/src/libprojectM/ProjectMCWrapper.cpp index dd63ed266..bc69a10ae 100644 --- a/src/libprojectM/ProjectMCWrapper.cpp +++ b/src/libprojectM/ProjectMCWrapper.cpp @@ -194,19 +194,6 @@ unsigned int projectm_init_render_to_texture(projectm_handle instance) return projectMInstance->InitRenderToTexture(); } -void projectm_key_handler(projectm_handle instance, projectMEvent event, projectMKeycode keycode, - projectMModifier modifier) -{ - auto projectMInstance = handle_to_instance(instance); - projectMInstance->KeyHandler(event, keycode, modifier); -} - -void projectm_default_key_handler(projectm_handle instance, projectMEvent event, projectMKeycode keycode) -{ - auto projectMInstance = handle_to_instance(instance); - projectMInstance->DefaultKeyHandler(event, keycode); -} - size_t projectm_get_texture_size(projectm_handle instance) { auto projectMInstance = handle_to_instance(instance); @@ -424,18 +411,18 @@ void projectm_write_config(const char* config_file, const projectm_settings* set ProjectM::WriteConfig(config_file, cppSettings); } -void projectm_lock_preset(projectm_handle instance, bool lock) -{ - auto projectMInstance = handle_to_instance(instance); - projectMInstance->SetPresetLocked(lock); -} - -bool projectm_is_preset_locked(projectm_handle instance) +bool projectm_get_preset_locked(projectm_handle instance) { auto projectMInstance = handle_to_instance(instance); return projectMInstance->PresetLocked(); } +void projectm_set_preset_locked(projectm_handle instance, bool lock) +{ + auto projectMInstance = handle_to_instance(instance); + projectMInstance->SetPresetLocked(lock); +} + void projectm_get_window_size(projectm_handle instance, size_t* width, size_t* height) { auto projectMInstance = handle_to_instance(instance);