Comments (5)
Thanks. I didn't know you could push a sprite to display in another sprite. I don't need to do it now, but am curious. Would it work like this?
#include <M5Unified.h>
M5Canvas SpriteA;
M5Canvas SpriteB;
void setup(void)
{
M5.begin();
SpriteA.createSprite(32, 32);
SpriteA.drawCircle(16, 16, 10, TFT_WHITE);
SpriteB.createSprite(100, 100);
SpriteA.pushSprite(&SpriteB, 32, 32); // Draw SpriteA inside SpriteB
SpriteB.pushSprite(&M5.Display, 0, 0);
}
from m5unified.
@patfelst
Yes, that's correct.
If you are interested, take a look at the LovyanGFX sample.
https://github.com/lovyan03/LovyanGFX/blob/0.4.7/examples/Sprite/ClockSample/ClockSample.ino
The entity of M5.Display is the M5GFX library, and M5GFX is a wrapping of LovyanGFX.
from m5unified.
Actually they all compile, but the first and last both cuase the ESP32 to crash. The middle one works ok.
from m5unified.
@patfelst
It is as per the specification.
When using pushSprite, you can set the output destination as the first argument.
In other words, in addition to output from M5Canvas to M5.Display, you can also output from M5Canvas to other M5Canvas.
If you specify the output destination in the constructor argument, you do not need to specify the output destination when using pushSprite, but you can specify the output destination if necessary.
In other words, if you omit the output destination in the constructor argument, you must always specify the output destination as the first argument when using pushSprite.
#include <M5Unified.h>
M5Canvas canvas; // Omit the output destination
void setup(void)
{
M5.begin();
canvas.createSprite(32, 32);
canvas.drawCircle(16, 16, 10, TFT_WHITE);
canvas.pushSprite(&M5.Display, 32, 32); // OK
//canvas.pushSprite( 64, 64); // Crash !
}
from m5unified.
Wow that clock example will take some study. But I get the idea of what you're doing with the sprites.
from m5unified.
Related Issues (20)
- Cracking sound on speaker using the "M5CoreS3-Esphome/voice-assistant" HOT 2
- M5Core2 Power LED HOT 8
- Customised buttons HOT 1
- M5Capsule cannot be detected corretly HOT 2
- Setting text color on LCD prevents breaks text output HOT 1
- M5 Core2 v1.1 power LED HOT 1
- build error with esp-idf 5.1.1 for esp32-c3 HOT 2
- Example "Display_Unicode" doesn't compile with M5Unified HOT 6
- can't ring the speaker of M5Stack CoreS3 with esp-idf HOT 5
- Unit Mini OLED display does not work with M5Stamp-Pico HOT 3
- S3 family compilation error: unused variable when compiler_warnings=all HOT 1
- H/W infomationにS3系新機種がない HOT 1
- AXP2101_Class.cpp not fully implemented HOT 2
- AtomS3 Button not defined in M5Unified.h HOT 4
- M5unified and boot/flash encryption HOT 2
- IDF 5.1/Arduino 3.0 support: legacy adc driver migration missing causing a boot crash if an ADC input is used HOT 3
- IDF 5.1/Arduino 3.0 support: M5.Speaker methods, camera input broken (CoreS3)
- M5Paper wakes too soon from deep sleep when touch wakeup is enabled - with solution HOT 2
- Minimalist configuration using M5Unified and BluetoothA2DPSink HOT 3
- M5CoreS3 speaker issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from m5unified.