/** * Copyright (c) 2025 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "renderfps.h" #include "display/ui/rendertext.h" #include "time.h" void renderFPSDraw(void) { float_t fps = 1.0f / TIME.delta; char_t buffer[32]; snprintf(buffer, sizeof(buffer), "FPS: %.1f", fps); if(fps >= 50.0f) { // Green renderTextDraw(0, 0, buffer, 0x00, 0xFF, 0x00); } else if(fps >= 30.0f) { // Yellow renderTextDraw(0, 0, buffer, 0xFF, 0xFF, 0x00); } else { // Red renderTextDraw(0, 0, buffer, 0xFF, 0x00, 0x00); } }