m5stack-avatar
Loading...
Searching...
No Matches
DrawContext.h
1// Copyright (c) Shinya Ishikawa. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full
3// license information.
4
5#ifndef DRAWCONTEXT_H_
6#define DRAWCONTEXT_H_
7
8#define ERACER_COLOR 0x0000
9
10#include "ColorPalette.h"
11#include "Expression.h"
12#include "Gaze.h"
13#include "M5GFX.h"
14
15#ifndef ARDUINO
16#include <string>
17typedef std::string String;
18#endif // ARDUINO
19
20namespace m5avatar {
21enum BatteryIconStatus { discharging, charging, invisible, unknown };
23 private:
24 Expression expression;
25 float breath;
26
27 // left eye
28 Gaze leftGaze;
29 float leftEyeOpenRatio;
30 // right eye
31 Gaze rightGaze;
32 float rightEyeOpenRatio;
33
34 float mouthOpenRatio;
35
36 ColorPalette* const palette;
37 String speechText;
38 float rotation = 0.0;
39 float scale = 1.0;
40 int colorDepth = 1;
41 BatteryIconStatus batteryIconStatus = BatteryIconStatus::invisible;
42 int32_t batteryLevel = 0;
43 const lgfx::IFont* speechFont =
44 nullptr; // = &fonts::lgfxJapanGothicP_16; // = &fonts::efontCN_10;
45
46 public:
47 DrawContext() = delete;
48 DrawContext(Expression expression, float breath, ColorPalette* const palette,
49 Gaze rightGaze, float rightEyeOpenRatio, Gaze leftGaze,
50 float leftEyeOpenRatio, float mouthOpenRatio, String speechText,
51 BatteryIconStatus batteryIconStatus, int32_t batteryLevel,
52 const lgfx::IFont* speechFont);
53 DrawContext(Expression expression, float breath, ColorPalette* const palette,
54 Gaze rightGaze, float rightEyeOpenRatio, Gaze leftGaze,
55 float leftEyeOpenRatio, float mouthOpenRatio, String speechText,
56 float rotation, float scale, int colorDepth,
57 BatteryIconStatus batteryIconStatus, int32_t batteryLevel,
58 const lgfx::IFont* speechFont);
59 ~DrawContext() = default;
60 DrawContext(const DrawContext& other) = delete;
61 DrawContext& operator=(const DrawContext& other) = delete;
62 Expression getExpression() const;
63 float getBreath() const;
64 float getRightEyeOpenRatio() const;
65 Gaze getRightGaze() const;
66 float getLeftEyeOpenRatio() const;
67 Gaze getLeftGaze() const;
68 float getMouthOpenRatio() const;
69 float getScale() const;
70 float getRotation() const;
71 ColorPalette* const getColorPalette() const;
72 String getspeechText() const;
73 int getColorDepth() const;
74 BatteryIconStatus getBatteryIconStatus() const;
75 int32_t getBatteryLevel() const;
76 const lgfx::IFont* getSpeechFont() const;
77};
78} // namespace m5avatar
79
80#endif // DRAWCONTEXT_H_
Definition: ColorPalette.h:50
Definition: DrawContext.h:22
Definition: Gaze.h:9