c_api_window.h - Engine C API Reference

c_api_window.h
  1. #pragma once
  2. #include "c_api_types.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. typedef void(*WindowCApi_KeyDownFunction)(void *obj, int virtual_key, int repeat_count, int scan_code, int extended, int previous_state);
  7. typedef void(*WindowCApi_CharDownFunction)(void *obj, int char_code);
  8. typedef void(*WindowCApi_KeyUpFunction)(void *obj, int virtual_key, int scan_code, int extended);
  9. typedef void(*WindowCApi_MouseButtonFunction)(void *obj, int button);
  10. typedef void(*WindowCApi_MouseMoveFunction)(void *obj, ConstVector3Ptr delta);
  11. typedef void(*WindowCApi_CursorPosFunction)(void *obj, unsigned x, unsigned y);
  12. typedef void(*WindowCApi_ActivateFunction)(void *obj, int active);
  13. typedef void(*WindowCApi_ResizeFunction)(void *obj, WindowPtr window, int x, int y, int width, int heigh);
  14. typedef void(*WindowCApi_ToggleFullscreenFunction)(void *obj, WindowPtr window);
  15. typedef void(*WindowCApi_SetFocusFunction)(void *obj);
  16. struct WindowCApi
  17. {
  18. int (*has_mouse_focus) (ConstWindowPtr optional);
  19. int (*has_focus) (ConstWindowPtr optional);
  20. void (*set_mouse_focus) (WindowPtr optional, int enabled);
  21. void (*set_focus) (WindowPtr optional);
  22. int (*show_cursor) (WindowPtr optional);
  23. int (*clip_cursor) (WindowPtr optional);
  24. void (*set_cursor) (WindowPtr optional, const char* optional_mouse_cursor);
  25. void (*set_show_cursor) (WindowPtr optional, int enabled, int restore_cursor_pos);
  26. void (*set_clip_cursor)(WindowPtr optional, int enabled);
  27. int (*is_resizable)(ConstWindowPtr optional);
  28. void (*set_resizable) (WindowPtr optional, int enabled);
  29. void (*set_resolution) (WindowPtr optional, unsigned width, unsigned height);
  30. float (*get_dpi_scale) ();
  31. void (*set_title) (WindowPtr optional, const char* title);
  32. int (*has_window) (ConstWindowPtr);
  33. WindowPtr (*get_main_window)();
  34. void (*minimize) (WindowPtr optional);
  35. void (*maximize) (WindowPtr optional);
  36. void (*restore) (WindowPtr optional);
  37. int (*is_closing) (WindowPtr optional);
  38. void (*close) (WindowPtr optional);
  39. void (*trigger_resize) (WindowPtr optional);
  40. void (*set_ime_enabled) (WindowPtr optional, int enabled);
  41. void (*set_foreground) (WindowPtr optional);
  42. void (*set_keystroke_enabled) (enum WindowKeystrokes, int enabled);
  43. void (*fill_default_open_parameter) (struct WindowOpenParameter* out_result);
  44. unsigned (*id) (WindowPtr optional);
  45. WindowPtr (*open) (struct WindowOpenParameter* const);
  46. struct WindowRectWrapper (*rect) (WindowPtr optional);
  47. void (*set_rect)(WindowPtr optional, struct WindowRectWrapper rect);
  48. void (*add_key_down_callback)(WindowPtr window, void *obj, WindowCApi_KeyDownFunction f);
  49. void (*remove_key_down_callback)(WindowPtr window, void *obj, WindowCApi_KeyDownFunction f);
  50. void (*add_char_down_callback)(WindowPtr window, void *obj, WindowCApi_CharDownFunction f);
  51. void (*remove_char_down_callback)(WindowPtr window, void *obj, WindowCApi_CharDownFunction f);
  52. void (*add_key_up_callback)(WindowPtr window, void *obj, WindowCApi_KeyUpFunction f);
  53. void (*remove_key_up_callback)(WindowPtr window, void *obj, WindowCApi_KeyUpFunction f);
  54. void (*add_mouse_down_callback)(WindowPtr window, void *obj, WindowCApi_MouseButtonFunction f);
  55. void (*remove_mouse_down_callback)(WindowPtr window, void *obj, WindowCApi_MouseButtonFunction f);
  56. void (*add_mouse_up_callback)(WindowPtr window, void *obj, WindowCApi_MouseButtonFunction f);
  57. void (*remove_mouse_up_callback)(WindowPtr window, void *obj, WindowCApi_MouseButtonFunction f);
  58. void (*add_mouse_move_callback)(WindowPtr window, void *obj, WindowCApi_MouseMoveFunction f);
  59. void (*remove_mouse_move_callback)(WindowPtr window, void *obj, WindowCApi_MouseMoveFunction f);
  60. void (*add_wheel_move_callback)(WindowPtr window, void *obj, WindowCApi_MouseMoveFunction f);
  61. void (*remove_wheel_move_callback)(WindowPtr window, void *obj, WindowCApi_MouseMoveFunction f);
  62. void (*add_cursor_pos_callback)(WindowPtr window, void *obj, WindowCApi_CursorPosFunction f);
  63. void (*remove_cursor_pos_callback)(WindowPtr window, void *obj, WindowCApi_CursorPosFunction f);
  64. void (*add_activate_callback)(WindowPtr window, void *obj, WindowCApi_ActivateFunction f);
  65. void (*remove_activate_callback)(WindowPtr window, void *obj, WindowCApi_ActivateFunction f);
  66. void (*add_resize_callback)(WindowPtr window, void *obj, WindowCApi_ResizeFunction f);
  67. void (*remove_resize_callback)(WindowPtr window, void *obj, WindowCApi_ResizeFunction f);
  68. void (*add_toggle_fullscreen_callback)(WindowPtr window, void *obj, WindowCApi_ToggleFullscreenFunction f);
  69. void (*remove_toggle_fullscreen_callback)(WindowPtr window, void *obj, WindowCApi_ToggleFullscreenFunction f);
  70. void (*add_set_focus_callback)(WindowPtr window, void *obj, WindowCApi_SetFocusFunction f);
  71. void (*remove_set_focus_callback)(WindowPtr window, void *obj, WindowCApi_SetFocusFunction f);
  72. };
  73. #ifdef __cplusplus
  74. }
  75. #endif