raygui_custom_backend.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*******************************************************************************************
  2. *
  3. * raygui - Standalone mode custom backend
  4. *
  5. * Just edit this file to include your custom implementation to your graphic API
  6. *
  7. * LICENSE: <your_license>
  8. *
  9. * Copyright (c) <year> <developer_name>
  10. *
  11. **********************************************************************************************/
  12. //#include "my_cool_graphic_api.h"
  13. //----------------------------------------------------------------------------------
  14. // Defines and Macros
  15. // TODO: Define input keys required by raygui
  16. //----------------------------------------------------------------------------------
  17. #define KEY_RIGHT 262
  18. #define KEY_LEFT 263
  19. #define KEY_DOWN 264
  20. #define KEY_UP 265
  21. #define KEY_BACKSPACE 259
  22. #define KEY_ENTER 257
  23. #define MOUSE_LEFT_BUTTON 0
  24. //----------------------------------------------------------------------------------
  25. // Types and Structures Definition
  26. // TODO: Define required structures, maybe Font/Texture2D should be defined here?
  27. //----------------------------------------------------------------------------------
  28. // ...
  29. //----------------------------------------------------------------------------------
  30. // Global Variables Definition
  31. //----------------------------------------------------------------------------------
  32. // ...
  33. //----------------------------------------------------------------------------------
  34. // Module Functions Definition
  35. // TODO: Define all raygui required functions (previously provided by raylib)
  36. //----------------------------------------------------------------------------------
  37. //-------------------------------------------------------------------------------
  38. // Input required functions
  39. //-------------------------------------------------------------------------------
  40. static Vector2 GetMousePosition(void)
  41. {
  42. Vector2 position = { 0 };
  43. // TODO: Mouse position
  44. return position;
  45. }
  46. static int GetMouseWheelMove(void)
  47. {
  48. // TODO: Mouse wheel movement variation, reseted every frame
  49. return 0;
  50. }
  51. static bool IsMouseButtonDown(int button)
  52. {
  53. // TODO: Return true while mouse button [0..2] is being down
  54. return false;
  55. }
  56. static bool IsMouseButtonPressed(int button)
  57. {
  58. // TODO: Return true when mouse button [0..2] has been pressed: up->down
  59. return false;
  60. }
  61. static bool IsMouseButtonReleased(int button)
  62. {
  63. // TODO: Return true when mouse button [0..2] has been released: down->up
  64. return false;
  65. }
  66. static bool IsKeyDown(int key)
  67. {
  68. // TODO: Return true while key is being down
  69. return false;
  70. }
  71. static bool IsKeyPressed(int key)
  72. {
  73. // TODO: Return true when key has been pressed: up->down
  74. return false;
  75. }
  76. // USED IN: GuiTextBox(), GuiValueBox()
  77. static int GetKeyPressed(void)
  78. {
  79. // TODO: Return last key pressed (up->down) in the frame
  80. return 0;
  81. }
  82. //-------------------------------------------------------------------------------
  83. // Drawing required functions
  84. //-------------------------------------------------------------------------------
  85. static void DrawRectangle(int x, int y, int width, int height, Color color)
  86. {
  87. // TODO: Draw rectangle on the screen
  88. }
  89. // USED IN: GuiColorPicker()
  90. static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4)
  91. {
  92. // TODO: Draw rectangle with gradients (4 vertex colors) on the screen
  93. }
  94. // USED IN: GuiDropdownBox(), GuiScrollBar()
  95. static void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
  96. {
  97. // TODO: Draw triangle on the screen, required for arrows
  98. }
  99. //-------------------------------------------------------------------------------
  100. // Text required functions
  101. //-------------------------------------------------------------------------------
  102. // USED IN: GuiLoadStyleDefault()
  103. static Font GetFontDefault(void)
  104. {
  105. Font font = { 0 };
  106. // TODO: Return default rendering Font for the UI
  107. return font;
  108. }
  109. // USED IN: GetTextWidth()
  110. static Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing)
  111. {
  112. Vector2 size = { 0 };
  113. // TODO: Return text size (width, height) on screen depending on the Font, text, fontSize and spacing
  114. return size;
  115. }
  116. // USED IN: GuiDrawText()
  117. static void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint)
  118. {
  119. // TODO: Draw text on the screen
  120. }
  121. //-------------------------------------------------------------------------------
  122. // GuiLoadStyle() required functions
  123. //-------------------------------------------------------------------------------
  124. static Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount)
  125. {
  126. Font font = { 0 };
  127. // TODO: Load a new font from a file
  128. return font;
  129. }
  130. static char *LoadText(const char *fileName)
  131. {
  132. // TODO: Load text file data, used by GuiLoadStyle() to load characters list required on Font generation,
  133. // this is a .rgs feature, probably this function is not required in most cases
  134. return NULL;
  135. }
  136. static const char *GetDirectoryPath(const char *filePath)
  137. {
  138. // TODO: Get directory path for .rgs file, required to look for a possible .ttf/.otf font file referenced,
  139. // this is a .rgs feature, probably this function is not required in most cases
  140. return NULL;
  141. }