当前位置:   article > 正文

C++使用imgui框架的绘制封装-绘制矩形-直线-文字-菜单-(复制即用)_imgui绘制菜单源码

imgui绘制菜单源码

头文件

  1. #include <d3d9.h>
  2. #include <d3dx9.h>
  3. #include <dwmapi.h>
  4. #pragma comment(lib, "d3d9.lib")
  5. #pragma comment(lib, "d3dx9.lib")
  6. #pragma comment(lib, "dwmapi.lib")
  7. #include "imgui/imgui.h"
  8. #include "imgui/imgui_impl_dx9.h"
  9. #include "imgui/imgui_impl_win32.h"
  10. typedef struct {
  11. BYTE R, G, B, A;
  12. }RGBA;
  13. //画矩形,文字之类的单独放在这个函数里
  14. typedef void(*Draw)();
  15. static Draw Render;
  16. static Draw DrawMenu;
  17. #define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
  18. extern void CreateWindowAndInitImGui(HWND GameHwnd, Draw WndDraw, Draw DrawMenu);
  19. void MessageWhile();
  20. void DrawBox(int x, int y, int w, int h, RGBA color, float T);
  21. void DrawCircle(int x, int y, float r, RGBA color, float T);
  22. void DrawLine(int x1, int y1, int x2, int y2, RGBA color, float T);
  23. void Draw_Text(int x, int y, const char* str, RGBA color);

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号