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.
SineWaveAnimation.h
Go to the documentation of this file.
1 #pragma once
2 
13 #include <SDL2/SDL.h>
14 #include <vector>
15 
16 #include "Application.h"
17 #include "TouchEnabledObject.h"
19 
21 {
22 public:
24  void draw(uint32_t time) override;
25  int getX() const;
26  int getY() const;
27  int getWidth() const;
28  int getHeight() const;
29 private:
30  static constexpr int X = 0, Y = 270, WIDTH = 480, HEIGHT = 40;
31  const double PI = std::acos(-1);
32  static constexpr float DIVISION = 30.f;
33  const int RANGE = HEIGHT / 2;
34  const int BASE_Y = Y + HEIGHT / 2;
35  static constexpr int REVOLUTION_TIME = 2000;
36  int ADDITIONAL_PIXELS = 4 * DIVISION;
37  int sinF(double x);
38  const SDL_Point* makePoints(const std::vector<int>& points, int count, int offset);
39  std::vector<int> points;
40  SDL_Renderer* renderer;
41  SDL_Point buffer[WIDTH];
42 };
43 
int getY() const
Definition: SineWaveAnimation.cpp:24
The main application class header.
SineWaveAnimation()
Definition: SineWaveAnimation.cpp:3
Definition: SineWaveAnimation.h:20
int getX() const
Definition: SineWaveAnimation.cpp:19
An abstract class implementing both the GraphicsObject and the TouchEnabledObject, which gives an interactive graphic object as result.
Definition: InteractiveGraphicsObject.h:20
int getWidth() const
Definition: SineWaveAnimation.cpp:29
void draw(uint32_t time) override
The draw method. It will be called once per frame for each object in a scene.
Definition: SineWaveAnimation.cpp:12
int getHeight() const
Definition: SineWaveAnimation.cpp:34