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.

38 lines
845B

  1. #ifndef WIDGETS_H
  2. #define WIDGETS_H
  3. #include "nanovg.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. struct DemoData {
  8. int fontNormal, fontBold, fontIcons;
  9. int images[12];
  10. };
  11. int loadDemoData(struct NVGcontext* vg, struct DemoData* data);
  12. void freeDemoData(struct NVGcontext* vg, struct DemoData* data);
  13. void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float height, float t, int blowup, struct DemoData* data);
  14. #define FPS_HISTORY_COUNT 100
  15. enum FPSRenderStyle {
  16. RENDER_FPS,
  17. RENDER_MS,
  18. };
  19. struct FPScounter
  20. {
  21. float values[FPS_HISTORY_COUNT];
  22. int head;
  23. };
  24. void initFPS(struct FPScounter* fps);
  25. void updateFPS(struct FPScounter* fps, float frameTime);
  26. void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps, enum FPSRenderStyle style );
  27. #ifdef __cplusplus
  28. }
  29. #endif
  30. #endif // WIDGETS_H