Created
November 19, 2023 22:57
-
-
Save hollyhockberry/2bf4686cc4bdd6af1e11285a5f8c6268 to your computer and use it in GitHub Desktop.
Sample to check behavior of native env.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <M5Unified.h> | |
M5Canvas sprite; | |
void setup() { | |
M5.begin(); | |
sprite.createSprite(120, 120); | |
sprite.drawCircle(sprite.width() >> 1, sprite.height() >> 1, sprite.width() >> 2, RED); | |
sprite.drawRect(0, 0, sprite.width() - 1, sprite.height() - 1, RED); | |
const auto offset = -40; | |
// xに負の値を指定すると下記2行の挙動が変わる(native時のみ) | |
sprite.pushSprite(&M5.Display, offset, 0); | |
sprite.pushSprite(&M5.Display, offset, 120, BLACK); | |
} | |
void loop() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; PlatformIO Project Configuration File | |
; | |
; Build options: build flags, source filter | |
; Upload options: custom upload port, speed and extra flags | |
; Library options: dependencies, extra library storages | |
; Advanced options: extra scripting | |
; | |
; Please visit documentation for the other options and examples | |
; https://docs.platformio.org/page/projectconf.html | |
[platformio] | |
default_envs = native | |
[env] | |
lib_deps = https://github.com/m5stack/M5Unified | |
[env:native] | |
platform = native | |
build_type = debug | |
build_flags = -O0 -xc++ -std=c++14 -lSDL2 | |
-I"/usr/local/include/SDL2" ; for intel mac homebrew SDL2 | |
-L"/usr/local/lib" ; for intel mac homebrew SDL2 | |
-I"${sysenv.HOMEBREW_PREFIX}/include/SDL2" ; for arm mac homebrew SDL2 | |
-L"${sysenv.HOMEBREW_PREFIX}/lib" ; for arm mac homebrew SDL2 | |
[env:native_m5stack] | |
extends = native | |
platform = native | |
build_flags = ${env:native.build_flags} | |
-DM5GFX_BOARD=board_M5Stack | |
[env:m5stack-core-esp32] | |
platform = espressif32 | |
board = m5stack-core-esp32 | |
framework = arduino | |
monitor_speed = 115200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment