imgui.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. // This code is based on:
  6. //
  7. // Copyright (c) 2009-2010 Mikko Mononen [email protected]
  8. //
  9. // This software is provided 'as-is', without any express or implied
  10. // warranty. In no event will the authors be held liable for any damages
  11. // arising from the use of this software.
  12. // Permission is granted to anyone to use this software for any purpose,
  13. // including commercial applications, and to alter it and redistribute it
  14. // freely, subject to the following restrictions:
  15. // 1. The origin of this software must not be misrepresented; you must not
  16. // claim that you wrote the original software. If you use this software
  17. // in a product, an acknowledgment in the product documentation would be
  18. // appreciated but is not required.
  19. // 2. Altered source versions must be plainly marked as such, and must not be
  20. // misrepresented as being the original software.
  21. // 3. This notice may not be removed or altered from any source distribution.
  22. //
  23. // Source altered and distributed from https://github.com/AdrienHerubel/imgui
  24. #ifndef IMGUI_H_HEADER_GUARD
  25. #define IMGUI_H_HEADER_GUARD
  26. #define IMGUI_MBUT_LEFT 0x01
  27. #define IMGUI_MBUT_RIGHT 0x02
  28. struct ImguiTextAlign
  29. {
  30. enum Enum
  31. {
  32. Left,
  33. Center,
  34. Right,
  35. };
  36. };
  37. inline uint32_t imguiRGBA(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255)
  38. {
  39. return 0
  40. | (uint32_t(_r) << 0)
  41. | (uint32_t(_g) << 8)
  42. | (uint32_t(_b) << 16)
  43. | (uint32_t(_a) << 24)
  44. ;
  45. }
  46. bool imguiCreate(const void* _data, uint32_t _size);
  47. void imguiDestroy();
  48. void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, uint8_t _view = 31);
  49. void imguiEndFrame();
  50. bool imguiBeginScrollArea(const char* _name, int _x, int _y, int _width, int _height, int* _scroll);
  51. void imguiEndScrollArea();
  52. void imguiIndent();
  53. void imguiUnindent();
  54. void imguiSeparator();
  55. void imguiSeparatorLine();
  56. bool imguiButton(const char* _text, bool _enabled = true);
  57. bool imguiItem(const char* _text, bool _enabled = true);
  58. bool imguiCheck(const char* _text, bool _checked, bool _enabled = true);
  59. bool imguiCollapse(const char* _text, const char* _subtext, bool _checked, bool _enabled = true);
  60. void imguiLabel(const char* _format, ...);
  61. void imguiValue(const char* _text);
  62. bool imguiSlider(const char* _text, float* _val, float _vmin, float _vmax, float _vinc, bool _enabled = true);
  63. bool imguiSlider(const char* _text, int32_t* _val, int32_t _vmin, int32_t _vmax, bool _enabled = true);
  64. uint32_t imguiChooseUseMacroInstead(uint32_t _selected, ...);
  65. #define imguiChoose(...) imguiChooseUseMacroInstead(__VA_ARGS__, NULL)
  66. void imguiDrawText(int _x, int _y, ImguiTextAlign::Enum _align, const char* _text, uint32_t _argb);
  67. void imguiDrawLine(float _x0, float _y0, float _x1, float _y1, float _r, uint32_t _argb);
  68. void imguiDrawRoundedRect(float _x, float _y, float _w, float _h, float _r, uint32_t _argb);
  69. void imguiDrawRect(float _x, float _y, float _w, float _h, uint32_t _argb);
  70. #endif // IMGUI_H_HEADER_GUARD