Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.3KB

  1. // Copyright 2021 Jean Pierre Cimalando
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. // SPDX-License-Identifier: Apache-2.0
  16. //
  17. #pragma once
  18. #include "ysfx.h"
  19. #if !defined(YSFX_NO_GFX)
  20. struct ysfx_gfx_state_t;
  21. ysfx_gfx_state_t *ysfx_gfx_state_new(ysfx_t *fx);
  22. void ysfx_gfx_state_free(ysfx_gfx_state_t *state);
  23. YSFX_DEFINE_AUTO_PTR(ysfx_gfx_state_u, ysfx_gfx_state_t, ysfx_gfx_state_free);
  24. void ysfx_gfx_state_set_bitmap(ysfx_gfx_state_t *state, uint8_t *data, uint32_t w, uint32_t h, uint32_t stride);
  25. void ysfx_gfx_state_set_scale_factor(ysfx_gfx_state_t *state, ysfx_real scale);
  26. void ysfx_gfx_state_set_callback_data(ysfx_gfx_state_t *state, void *callback_data);
  27. void ysfx_gfx_state_set_show_menu_callback(ysfx_gfx_state_t *state, int (*callback)(void *, const char *, int32_t, int32_t));
  28. void ysfx_gfx_state_set_set_cursor_callback(ysfx_gfx_state_t *state, void (*callback)(void *, int32_t));
  29. void ysfx_gfx_state_set_get_drop_file_callback(ysfx_gfx_state_t *state, const char *(*callback)(void *, int32_t));
  30. bool ysfx_gfx_state_is_dirty(ysfx_gfx_state_t *state);
  31. void ysfx_gfx_state_add_key(ysfx_gfx_state_t *state, uint32_t mods, uint32_t key, bool press);
  32. void ysfx_gfx_state_update_mouse(ysfx_gfx_state_t *state, uint32_t mods, int xpos, int ypos, uint32_t buttons, int wheel, int hwheel);
  33. //------------------------------------------------------------------------------
  34. void ysfx_gfx_enter(ysfx_t *fx, bool doinit);
  35. void ysfx_gfx_leave(ysfx_t *fx);
  36. ysfx_gfx_state_t *ysfx_gfx_get_context(ysfx_t *fx);
  37. void ysfx_gfx_prepare(ysfx_t *fx);
  38. struct ysfx_scoped_gfx_t {
  39. ysfx_scoped_gfx_t(ysfx_t *fx, bool doinit) : m_fx(fx) { ysfx_gfx_enter(fx, doinit); }
  40. ~ysfx_scoped_gfx_t() { ysfx_gfx_leave(m_fx); }
  41. ysfx_t *m_fx = nullptr;
  42. };
  43. #endif
  44. //------------------------------------------------------------------------------
  45. void ysfx_api_init_gfx();