Doly C++ SDK v1.00
Loading...
Searching...
No Matches
EyeControl.h
Go to the documentation of this file.
1#pragma once
2#include <cstdint>
3#include <string>
4#include <string_view>
5#include <Color.h>
6#include <EyeEvent.h>
7#include <VContent.h>
8
24
28enum class EyeSide :uint8_t
29{
33};
34
38enum class IrisShape :uint8_t
39{
46};
47
48namespace EyeControl
49{
64 int8_t init(ColorCode eye_color, ColorCode bg_color);
65
71 void Abort();
72
77 bool isActive();
78
84
97 int8_t setEyes(IrisShape shape, ColorCode iris_color, ColorCode bg_color);
98
111 int8_t setIris(IrisShape shape, ColorCode color, EyeSide side);
112
123 int8_t setIris(VContent* eye_image, EyeSide side);
124
136 int8_t setLid(VContent* lid_image, bool isTop, EyeSide side);
137
145 int8_t setBackground(Color color);
146
157 int8_t setBackground(VContent* bg_image, EyeSide side);
158
172 int8_t setAnimation(uint16_t id, std::string_view name);
173
191 int8_t setPosition(EyeSide side, int16_t centerX, int16_t centerY, float scaleX = 1, float scaleY = 1, uint8_t lid_top_end = 0, uint8_t lid_bot_start = 240);
192
206 int8_t getIrisPosition(EyeSide side, int16_t& x, int16_t& y);
207
215 float getVersion();
216
217};
218
225{
226 inline constexpr std::string_view ADMIRING = "ADMIRING";
227 inline constexpr std::string_view AGGRAVATED = "AGGRAVATED";
228 inline constexpr std::string_view ANNOYED = "ANNOYED";
229 inline constexpr std::string_view ANXIOUS = "ANXIOUS";
230 inline constexpr std::string_view ATTENTION = "ATTENTION";
231 inline constexpr std::string_view ATTENTION_LEFT = "ATTENTION LEFT";
232 inline constexpr std::string_view ATTENTION_RIGHT = "ATTENTION RIGHT";
233 inline constexpr std::string_view AWAKE_L = "AWAKE L";
234 inline constexpr std::string_view AWAKE_R = "AWAKE R";
235 inline constexpr std::string_view BATTERY_LOW = "BATTERY LOW";
236 inline constexpr std::string_view BLINK = "BLINK";
237 inline constexpr std::string_view BLINK_BIG = "BLINK BIG";
238 inline constexpr std::string_view BLINK_L = "BLINK L";
239 inline constexpr std::string_view BLINK_ONLY = "BLINK ONLY";
240 inline constexpr std::string_view BLINK_R = "BLINK R";
241 inline constexpr std::string_view BLINK_SLOW = "BLINK SLOW";
242 inline constexpr std::string_view BLUE = "BLUE";
243 inline constexpr std::string_view BUGGED = "BUGGED";
244 inline constexpr std::string_view BUMP = "BUMP";
245 inline constexpr std::string_view BURNED_UP = "BURNED UP";
246 inline constexpr std::string_view CAUTIOUS = "CAUTIOUS";
247 inline constexpr std::string_view CAUTIOUS_DOWN = "CAUTIOUS DOWN";
248 inline constexpr std::string_view CAUTIOUS_DOWN_LEFT = "CAUTIOUS DOWN LEFT";
249 inline constexpr std::string_view CAUTIOUS_DOWN_RIGHT = "CAUTIOUS DOWN RIGHT";
250 inline constexpr std::string_view CAUTIOUS_LEFT = "CAUTIOUS LEFT";
251 inline constexpr std::string_view CAUTIOUS_RIGHT = "CAUTIOUS RIGHT";
252 inline constexpr std::string_view CAUTIOUS_UP = "CAUTIOUS UP";
253 inline constexpr std::string_view CHAOTIC = "CHAOTIC";
254 inline constexpr std::string_view CHEERFUL = "CHEERFUL";
255 inline constexpr std::string_view COLOR_CHANGE = "COLOR CHANGE";
256 inline constexpr std::string_view CONCENTRATE = "CONCENTRATE";
257 inline constexpr std::string_view CONFUSED = "CONFUSED";
258 inline constexpr std::string_view CRAZY_ABOUT = "CRAZY ABOUT";
259 inline constexpr std::string_view CRUSHED = "CRUSHED";
260 inline constexpr std::string_view CYCLOPS_L = "CYCLOPS L";
261 inline constexpr std::string_view CYCLOPS_R = "CYCLOPS R";
262 inline constexpr std::string_view DAMAGED = "DAMAGED";
263 inline constexpr std::string_view DEJECTED = "DEJECTED";
264 inline constexpr std::string_view DELIGHTED = "DELIGHTED";
265 inline constexpr std::string_view DEMORALIZED = "DEMORALIZED";
266 inline constexpr std::string_view DEPRESSED = "DEPRESSED";
267 inline constexpr std::string_view DESTROYED = "DESTROYED";
268 inline constexpr std::string_view DISCOVER = "DISCOVER";
269 inline constexpr std::string_view DISAPPOINTED = "DISAPPOINTED";
270 inline constexpr std::string_view DIZZY_L = "DIZZY L";
271 inline constexpr std::string_view DIZZY_R = "DIZZY R";
272 inline constexpr std::string_view DOWN = "DOWN";
273 inline constexpr std::string_view DROP_CENTER = "DROP CENTER";
274 inline constexpr std::string_view DROWSY = "DROWSY";
275 inline constexpr std::string_view ELEVATED_I = "ELEVATED I";
276 inline constexpr std::string_view ELEVATED_O = "ELEVATED O";
277 inline constexpr std::string_view EMPTY = "EMPTY";
278 inline constexpr std::string_view EXCITED = "EXCITED";
279 inline constexpr std::string_view FED_UP = "FED UP";
280 inline constexpr std::string_view FINE = "FINE";
281 inline constexpr std::string_view FIREMAN = "FIREMAN";
282 inline constexpr std::string_view FLAME = "FLAME";
283 inline constexpr std::string_view FOCUS = "FOCUS";
284 inline constexpr std::string_view FRIGHTENED = "FRIGHTENED";
285 inline constexpr std::string_view FRUSTRATED = "FRUSTRATED";
286 inline constexpr std::string_view FUMING_L = "FUMING L";
287 inline constexpr std::string_view FUMING_R = "FUMING R";
288 inline constexpr std::string_view FURIOUS = "FURIOUS";
289 inline constexpr std::string_view GET_BIGGER = "GET BIGGER";
290 inline constexpr std::string_view GET_SMALLER = "GET SMALLER";
291 inline constexpr std::string_view HAPPY = "HAPPY";
292 inline constexpr std::string_view HEARTS = "HEARTS";
293 inline constexpr std::string_view HEATED = "HEATED";
294 inline constexpr std::string_view HOPELESS = "HOPELESS";
295 inline constexpr std::string_view HOSTILE = "HOSTILE";
296 inline constexpr std::string_view IMPACT_F = "IMPACT F";
297 inline constexpr std::string_view IMPACT_L = "IMPACT L";
298 inline constexpr std::string_view IMPACT_R = "IMPACT R";
299 inline constexpr std::string_view IMPATIENT = "IMPATIENT";
300 inline constexpr std::string_view INJURED = "INJURED";
301 inline constexpr std::string_view IRRITATED = "IRRITATED";
302 inline constexpr std::string_view JEALOUS_L = "JEALOUS L";
303 inline constexpr std::string_view JEALOUS_R = "JEALOUS R";
304 inline constexpr std::string_view LEFT = "LEFT";
305 inline constexpr std::string_view LIDS_DOWN_5S = "LIDS DOWN 5S";
306 inline constexpr std::string_view LOOK_AHEAD = "LOOK AHEAD";
307 inline constexpr std::string_view LOOK_AHEAD_SLOW = "LOOK AHEAD SLOW";
308 inline constexpr std::string_view LOOK_DOWN = "LOOK DOWN";
309 inline constexpr std::string_view LOOK_DOWN_L = "LOOK DOWN L";
310 inline constexpr std::string_view LOOK_DOWN_R = "LOOK DOWN R";
311 inline constexpr std::string_view LOOK_LEFT = "LOOK LEFT";
312 inline constexpr std::string_view LOOK_RIGHT = "LOOK RIGHT";
313 inline constexpr std::string_view LOOK_UP = "LOOK UP";
314 inline constexpr std::string_view LOOK_UP_L = "LOOK UP L";
315 inline constexpr std::string_view LOOK_UP_R = "LOOK UP R";
316 inline constexpr std::string_view LOW = "LOW";
317 inline constexpr std::string_view LOW_LONG = "LOW LONG";
318 inline constexpr std::string_view MELANCHOLY = "MELANCHOLY";
319 inline constexpr std::string_view MID_DOWN = "MID DOWN";
320 inline constexpr std::string_view MID_UP = "MID UP";
321 inline constexpr std::string_view MID_UP_L = "MID UP L";
322 inline constexpr std::string_view MID_UP_R = "MID UP R";
323 inline constexpr std::string_view MIXED_UP = "MIXED UP";
324 inline constexpr std::string_view MOODY_LR = "MOODY LR";
325 inline constexpr std::string_view MOODY_RL = "MOODY RL";
326 inline constexpr std::string_view NERVOUS = "NERVOUS";
327 inline constexpr std::string_view OFFENDED = "OFFENDED";
328 inline constexpr std::string_view OUTRAGED = "OUTRAGED";
329 inline constexpr std::string_view OVERJOYED = "OVERJOYED";
330 inline constexpr std::string_view PANICKY = "PANICKY";
331 inline constexpr std::string_view PASSIONATE = "PASSIONATE";
332 inline constexpr std::string_view PHOTO = "PHOTO";
333 inline constexpr std::string_view POLICE = "POLICE";
334 inline constexpr std::string_view PUZZLED = "PUZZLED";
335 inline constexpr std::string_view PUMPKIN = "PUMPKIN";
336 inline constexpr std::string_view RIGHT = "RIGHT";
337 inline constexpr std::string_view ROLL_UD = "ROLL UD";
338 inline constexpr std::string_view SCAN = "SCAN";
339 inline constexpr std::string_view SHAKE_FRONT = "SHAKE FRONT";
340 inline constexpr std::string_view SHAKE_LR = "SHAKE LR";
341 inline constexpr std::string_view SHAKE_UD = "SHAKE UD";
342 inline constexpr std::string_view SHOCKED = "SHOCKED";
343 inline constexpr std::string_view SHY = "SHY";
344 inline constexpr std::string_view SLEEP = "SLEEP";
345 inline constexpr std::string_view SLEEPY = "SLEEPY";
346 inline constexpr std::string_view SNEEZE = "SNEEZE";
347 inline constexpr std::string_view SPARKLING = "SPARKLING";
348 inline constexpr std::string_view SQUINT_RL = "SQUINT RL";
349 inline constexpr std::string_view STORMING = "STORMING";
350 inline constexpr std::string_view SUNGLASS = "SUNGLASS";
351 inline constexpr std::string_view SUNGLASS_LR = "SUNGLASS LR";
352 inline constexpr std::string_view SUNGLASS_UPR = "SUNGLASS UPR";
353 inline constexpr std::string_view THINK = "THINK";
354 inline constexpr std::string_view THREATENED_L = "THREATENED L";
355 inline constexpr std::string_view THREATENED_R = "THREATENED R";
356 inline constexpr std::string_view THRILLED = "THRILLED";
357 inline constexpr std::string_view THROWN = "THROWN";
358 inline constexpr std::string_view TIRED = "TIRED";
359 inline constexpr std::string_view TROUBLED = "TROUBLED";
360 inline constexpr std::string_view TURNED_ON = "TURNED ON";
361 inline constexpr std::string_view UNCOMFORTABLE = "UNCOMFORTABLE";
362 inline constexpr std::string_view UNHAPPY = "UNHAPPY";
363 inline constexpr std::string_view UPSET = "UPSET";
364 inline constexpr std::string_view VR = "VR";
365 inline constexpr std::string_view WAKE_WORD = "WAKE WORD";
366 inline constexpr std::string_view WORKOUT = "WORKOUT";
367 inline constexpr std::string_view ZOOM_IN = "ZOOM IN";
368}
Color utilities and predefined color codes used across the Doly SDK.
IrisShape
Built-in iris style presets.
Definition EyeControl.h:39
@ CLASSIC
Definition EyeControl.h:40
@ DIGI
Definition EyeControl.h:45
@ ORBIT
Definition EyeControl.h:43
@ SPACE
Definition EyeControl.h:42
@ GLOW
Definition EyeControl.h:44
@ MODERN
Definition EyeControl.h:41
EyeSide
Which eye(s) a command targets.
Definition EyeControl.h:29
@ BOTH
Definition EyeControl.h:30
Event registration API for EyeControl.
Visual content container for Doly displays.
Container class for visual (image/animation) content.
Definition VContent.h:31
@ LEFT
Definition LcdControl.h:38
@ RIGHT
Definition LcdControl.h:39
ColorCode
Predefined color identifiers.
Definition Color.h:31
Definition EyeControl.h:49
int8_t setAnimation(uint16_t id, std::string_view name)
Start a named eye animation (non-blocking).
bool isAnimating()
Check whether an animation is currently running.
int8_t setLid(VContent *lid_image, bool isTop, EyeSide side)
Set eyelid image content for a given side.
float getVersion()
Get current library version.
int8_t setIris(IrisShape shape, ColorCode color, EyeSide side)
Set iris preset for a given side.
int8_t init(ColorCode eye_color, ColorCode bg_color)
Initialize the eye subsystem (LCD + eye assets).
bool isActive()
Check whether the subsystem is active (initialized and running).
int8_t setEyes(IrisShape shape, ColorCode iris_color, ColorCode bg_color)
Set both iris and background to built-in presets.
int8_t setBackground(Color color)
Set background color (solid).
int8_t getIrisPosition(EyeSide side, int16_t &x, int16_t &y)
Get the current iris center position for a given side.
int8_t setPosition(EyeSide side, int16_t centerX, int16_t centerY, float scaleX=1, float scaleY=1, uint8_t lid_top_end=0, uint8_t lid_bot_start=240)
Set iris position/scale and eyelid limits for a given side.
void Abort()
Abort/terminate the active animation.
Named eye expression/animation identifiers.
Definition EyeControl.h:225
constexpr std::string_view FED_UP
Definition EyeControl.h:279
constexpr std::string_view DIZZY_L
Definition EyeControl.h:270
constexpr std::string_view PUZZLED
Definition EyeControl.h:334
constexpr std::string_view CAUTIOUS
Definition EyeControl.h:246
constexpr std::string_view MID_UP_L
Definition EyeControl.h:321
constexpr std::string_view CONFUSED
Definition EyeControl.h:257
constexpr std::string_view HAPPY
Definition EyeControl.h:291
constexpr std::string_view MOODY_LR
Definition EyeControl.h:324
constexpr std::string_view SHAKE_FRONT
Definition EyeControl.h:339
constexpr std::string_view MID_DOWN
Definition EyeControl.h:319
constexpr std::string_view MID_UP_R
Definition EyeControl.h:322
constexpr std::string_view BLINK_BIG
Definition EyeControl.h:237
constexpr std::string_view PHOTO
Definition EyeControl.h:332
constexpr std::string_view SLEEP
Definition EyeControl.h:344
constexpr std::string_view IMPACT_R
Definition EyeControl.h:298
constexpr std::string_view EXCITED
Definition EyeControl.h:278
constexpr std::string_view LOOK_UP_L
Definition EyeControl.h:314
constexpr std::string_view FUMING_L
Definition EyeControl.h:286
constexpr std::string_view TURNED_ON
Definition EyeControl.h:360
constexpr std::string_view STORMING
Definition EyeControl.h:349
constexpr std::string_view ATTENTION
Definition EyeControl.h:230
constexpr std::string_view CONCENTRATE
Definition EyeControl.h:256
constexpr std::string_view LIDS_DOWN_5S
Definition EyeControl.h:305
constexpr std::string_view CRUSHED
Definition EyeControl.h:259
constexpr std::string_view ANNOYED
Definition EyeControl.h:228
constexpr std::string_view SHAKE_UD
Definition EyeControl.h:341
constexpr std::string_view AWAKE_L
Definition EyeControl.h:233
constexpr std::string_view BLINK
Definition EyeControl.h:236
constexpr std::string_view TIRED
Definition EyeControl.h:358
constexpr std::string_view HOPELESS
Definition EyeControl.h:294
constexpr std::string_view BLINK_ONLY
Definition EyeControl.h:239
constexpr std::string_view ADMIRING
Definition EyeControl.h:226
constexpr std::string_view GET_SMALLER
Definition EyeControl.h:290
constexpr std::string_view UNCOMFORTABLE
Definition EyeControl.h:361
constexpr std::string_view CYCLOPS_R
Definition EyeControl.h:261
constexpr std::string_view LOOK_DOWN
Definition EyeControl.h:308
constexpr std::string_view CRAZY_ABOUT
Definition EyeControl.h:258
constexpr std::string_view SQUINT_RL
Definition EyeControl.h:348
constexpr std::string_view BUMP
Definition EyeControl.h:244
constexpr std::string_view WAKE_WORD
Definition EyeControl.h:365
constexpr std::string_view LOOK_LEFT
Definition EyeControl.h:311
constexpr std::string_view CAUTIOUS_DOWN_RIGHT
Definition EyeControl.h:249
constexpr std::string_view JEALOUS_R
Definition EyeControl.h:303
constexpr std::string_view PUMPKIN
Definition EyeControl.h:335
constexpr std::string_view ELEVATED_I
Definition EyeControl.h:275
constexpr std::string_view CAUTIOUS_LEFT
Definition EyeControl.h:250
constexpr std::string_view LOOK_DOWN_R
Definition EyeControl.h:310
constexpr std::string_view HEARTS
Definition EyeControl.h:292
constexpr std::string_view COLOR_CHANGE
Definition EyeControl.h:255
constexpr std::string_view PANICKY
Definition EyeControl.h:330
constexpr std::string_view CYCLOPS_L
Definition EyeControl.h:260
constexpr std::string_view ZOOM_IN
Definition EyeControl.h:367
constexpr std::string_view CHEERFUL
Definition EyeControl.h:254
constexpr std::string_view SUNGLASS_LR
Definition EyeControl.h:351
constexpr std::string_view FIREMAN
Definition EyeControl.h:281
constexpr std::string_view SNEEZE
Definition EyeControl.h:346
constexpr std::string_view FINE
Definition EyeControl.h:280
constexpr std::string_view CAUTIOUS_UP
Definition EyeControl.h:252
constexpr std::string_view MID_UP
Definition EyeControl.h:320
constexpr std::string_view BLINK_L
Definition EyeControl.h:238
constexpr std::string_view SPARKLING
Definition EyeControl.h:347
constexpr std::string_view DROP_CENTER
Definition EyeControl.h:273
constexpr std::string_view SHY
Definition EyeControl.h:343
constexpr std::string_view THREATENED_L
Definition EyeControl.h:354
constexpr std::string_view SUNGLASS
Definition EyeControl.h:350
constexpr std::string_view OFFENDED
Definition EyeControl.h:327
constexpr std::string_view FUMING_R
Definition EyeControl.h:287
constexpr std::string_view HEATED
Definition EyeControl.h:293
constexpr std::string_view ATTENTION_LEFT
Definition EyeControl.h:231
constexpr std::string_view RIGHT
Definition EyeControl.h:336
constexpr std::string_view DAMAGED
Definition EyeControl.h:262
constexpr std::string_view MELANCHOLY
Definition EyeControl.h:318
constexpr std::string_view LOOK_AHEAD_SLOW
Definition EyeControl.h:307
constexpr std::string_view GET_BIGGER
Definition EyeControl.h:289
constexpr std::string_view TROUBLED
Definition EyeControl.h:359
constexpr std::string_view NERVOUS
Definition EyeControl.h:326
constexpr std::string_view LOW_LONG
Definition EyeControl.h:317
constexpr std::string_view SHOCKED
Definition EyeControl.h:342
constexpr std::string_view IRRITATED
Definition EyeControl.h:301
constexpr std::string_view UNHAPPY
Definition EyeControl.h:362
constexpr std::string_view PASSIONATE
Definition EyeControl.h:331
constexpr std::string_view DOWN
Definition EyeControl.h:272
constexpr std::string_view CAUTIOUS_DOWN
Definition EyeControl.h:247
constexpr std::string_view THROWN
Definition EyeControl.h:357
constexpr std::string_view LEFT
Definition EyeControl.h:304
constexpr std::string_view MOODY_RL
Definition EyeControl.h:325
constexpr std::string_view DROWSY
Definition EyeControl.h:274
constexpr std::string_view FRIGHTENED
Definition EyeControl.h:284
constexpr std::string_view BLINK_R
Definition EyeControl.h:240
constexpr std::string_view HOSTILE
Definition EyeControl.h:295
constexpr std::string_view ANXIOUS
Definition EyeControl.h:229
constexpr std::string_view DEMORALIZED
Definition EyeControl.h:265
constexpr std::string_view BLUE
Definition EyeControl.h:242
constexpr std::string_view LOOK_DOWN_L
Definition EyeControl.h:309
constexpr std::string_view ELEVATED_O
Definition EyeControl.h:276
constexpr std::string_view POLICE
Definition EyeControl.h:333
constexpr std::string_view BATTERY_LOW
Definition EyeControl.h:235
constexpr std::string_view CAUTIOUS_RIGHT
Definition EyeControl.h:251
constexpr std::string_view OUTRAGED
Definition EyeControl.h:328
constexpr std::string_view BLINK_SLOW
Definition EyeControl.h:241
constexpr std::string_view JEALOUS_L
Definition EyeControl.h:302
constexpr std::string_view LOOK_AHEAD
Definition EyeControl.h:306
constexpr std::string_view DELIGHTED
Definition EyeControl.h:264
constexpr std::string_view FRUSTRATED
Definition EyeControl.h:285
constexpr std::string_view WORKOUT
Definition EyeControl.h:366
constexpr std::string_view AGGRAVATED
Definition EyeControl.h:227
constexpr std::string_view INJURED
Definition EyeControl.h:300
constexpr std::string_view IMPACT_L
Definition EyeControl.h:297
constexpr std::string_view DISCOVER
Definition EyeControl.h:268
constexpr std::string_view LOOK_RIGHT
Definition EyeControl.h:312
constexpr std::string_view IMPACT_F
Definition EyeControl.h:296
constexpr std::string_view CHAOTIC
Definition EyeControl.h:253
constexpr std::string_view DEPRESSED
Definition EyeControl.h:266
constexpr std::string_view DIZZY_R
Definition EyeControl.h:271
constexpr std::string_view CAUTIOUS_DOWN_LEFT
Definition EyeControl.h:248
constexpr std::string_view SHAKE_LR
Definition EyeControl.h:340
constexpr std::string_view DISAPPOINTED
Definition EyeControl.h:269
constexpr std::string_view THREATENED_R
Definition EyeControl.h:355
constexpr std::string_view AWAKE_R
Definition EyeControl.h:234
constexpr std::string_view MIXED_UP
Definition EyeControl.h:323
constexpr std::string_view THINK
Definition EyeControl.h:353
constexpr std::string_view ATTENTION_RIGHT
Definition EyeControl.h:232
constexpr std::string_view OVERJOYED
Definition EyeControl.h:329
constexpr std::string_view BUGGED
Definition EyeControl.h:243
constexpr std::string_view LOW
Definition EyeControl.h:316
constexpr std::string_view EMPTY
Definition EyeControl.h:277
constexpr std::string_view LOOK_UP
Definition EyeControl.h:313
constexpr std::string_view SCAN
Definition EyeControl.h:338
constexpr std::string_view LOOK_UP_R
Definition EyeControl.h:315
constexpr std::string_view ROLL_UD
Definition EyeControl.h:337
constexpr std::string_view VR
Definition EyeControl.h:364
constexpr std::string_view FLAME
Definition EyeControl.h:282
constexpr std::string_view IMPATIENT
Definition EyeControl.h:299
constexpr std::string_view FOCUS
Definition EyeControl.h:283
constexpr std::string_view SLEEPY
Definition EyeControl.h:345
constexpr std::string_view DEJECTED
Definition EyeControl.h:263
constexpr std::string_view SUNGLASS_UPR
Definition EyeControl.h:352
constexpr std::string_view BURNED_UP
Definition EyeControl.h:245
constexpr std::string_view UPSET
Definition EyeControl.h:363
constexpr std::string_view THRILLED
Definition EyeControl.h:356
constexpr std::string_view FURIOUS
Definition EyeControl.h:288
constexpr std::string_view DESTROYED
Definition EyeControl.h:267
Simple 8-bit RGB color container and conversion helpers.
Definition Color.h:60