Skip to content

LovyanGFX based framework for the WT32-SC01 Plus highlighting device info, animation, and FPS counter

License

Notifications You must be signed in to change notification settings

thisoldcpu/WT32-SC01_Plus_FPS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

WT32-SC01_Plus_FPS_thumbnail

class FPSCounter {
protected:
  unsigned int m_fps;
  unsigned int m_fpscount;
  unsigned long m_lastTime;

public:
  // Constructor
  FPSCounter()
    : m_fps(0), m_fpscount(0), m_lastTime(0) {
  }

  // Update
  void update() {
    // increase the counter by one
    m_fpscount++;

    // Check if one second has elapsed
    unsigned long currentTime = millis();
    if (currentTime - m_lastTime > 1000) {
      // save the current counter value to m_fps
      m_fps = m_fpscount;

      // reset the counter
      m_fpscount = 0;

      // update the last time
      m_lastTime = currentTime;
    }
  }

  // Get fps
  unsigned int get() const {
    return m_fps;
  }
};
FPSCounter fps;
void loop() {
  tftBuffer.drawString(String(fps.get()), 8, 8);
  fps.update();
}

https://youtu.be/

IMAGE ALT TEXT

About

LovyanGFX based framework for the WT32-SC01 Plus highlighting device info, animation, and FPS counter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages