TouchCPLib  1.0.0
A touch-enabled GUI interface based on SDL and libTS. It provides a simple desktop-free UI for your embedded Raspberry projects.
WavefunctionAnimation.h
Go to the documentation of this file.
1 #pragma once
2 
13 #include <SDL2/SDL.h>
14 #include <vector>
15 #include <array>
16 
17 #include "Application.h"
18 #include "TouchEnabledObject.h"
20 
22 {
23 public:
25  void setRevolutionTime(int time);
26  void draw(uint32_t time) override;
27  int getX() const;
28  int getY() const;
29  int getWidth() const;
30  int getHeight() const;
31  void rebuild();
32 
33 private:
34  int REVOLUTION_TIME = 2000;
35  int X = 0, Y = 270, WIDTH = 480, HEIGHT = 40, FRAMES = REVOLUTION_TIME / 80;
36  const double PI = std::acos(-1);
37  static constexpr float DIVISION = 30.f;
38  const int RANGE = HEIGHT / 2;
39  const int BASE_Y = Y + HEIGHT / 2;
40  int ADDITIONAL_PIXELS = 4 * DIVISION;
41  int sinF(double x);
42  std::vector<std::vector<SDL_Point>> points;
43  SDL_Renderer *renderer;
44 };
int getY() const
Definition: WavefunctionAnimation.cpp:31
int getWidth() const
Definition: WavefunctionAnimation.cpp:36
The main application class header.
void draw(uint32_t time) override
The draw method. It will be called once per frame for each object in a scene.
Definition: WavefunctionAnimation.cpp:15
void setRevolutionTime(int time)
Definition: WavefunctionAnimation.cpp:9
An abstract class implementing both the GraphicsObject and the TouchEnabledObject, which gives an interactive graphic object as result.
Definition: InteractiveGraphicsObject.h:20
WavefunctionAnimation()
Definition: WavefunctionAnimation.cpp:3
int getHeight() const
Definition: WavefunctionAnimation.cpp:41
void rebuild()
Definition: WavefunctionAnimation.cpp:46
Definition: WavefunctionAnimation.h:21
int getX() const
Definition: WavefunctionAnimation.cpp:26