diff --git a/src/droplets/ad_droplet.cpp b/src/droplets/ad_droplet.cpp index 707f283..4350a02 100644 --- a/src/droplets/ad_droplet.cpp +++ b/src/droplets/ad_droplet.cpp @@ -211,6 +211,7 @@ void ADDroplet::UpdateStateCallback() { sample_rate, State()); } + delete title_graph; title_graph = new Graph(GetScreenMax()-GetScreenMin(), GetTitleHeight()); } diff --git a/src/graphics/graph.h b/src/graphics/graph.h index 58f1454..6fe6cdc 100644 --- a/src/graphics/graph.h +++ b/src/graphics/graph.h @@ -14,15 +14,68 @@ class Graph { bool** graph; int GetNextActive(); public: + /* + * Contsturctor for graph. + * + * @param m_width width + * @param m_height height + */ Graph(int m_width, int m_height); + /* + * Destructor for graph. + */ ~Graph(); + + /* + * Shifts the graph by one pixel. + */ void Update(); + + /* + * Clears the pxiels at the currently active column. + */ void ClearColumn(); + + /* + * Draws an active pixel on the graph. + * + * @param pos y dimension of pixel + */ void SetPixel(int pos); + + /* + * Draws a pixel on the graph. + * + * @param pos y dimension of pixel + * @param on pixel active state + */ void SetPixel(int pos, bool on); + + /* + * Draws an acive pixel based on a percentage of the + * the height of the graph. + * + * @param percentage precentage height of the pixel + */ void SetPixelPercentage(double percentage); + + /* + * Draws a pixel based on a percentage of the + * the height of the graph. + * + * @param percentage precentage height of the pixel + * @param on pixel active state + */ void SetPixelPercentage(double percentage, bool on); + + /* + * Draws graph on display. + * + * @param patch daisy patch board + * @param x starting x coordinate of graph + * @param y starting y coordinate of graph + */ void Draw(DaisyPatch* patch, int x, int y); };