first commit
This commit is contained in:
commit
e6a42e28e9
4355 changed files with 4626605 additions and 0 deletions
79
libraries/LovyanGFX/examples_for_PC/PlatformIO_SDL/README.md
Normal file
79
libraries/LovyanGFX/examples_for_PC/PlatformIO_SDL/README.md
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
|
||||
## Visual Studio Code + PlatformIO + SDL2 環境で LovyanGFXを使用する手順
|
||||
|
||||
まず最初にVisual Studio Code をインストールし、PlatformIO を使用できる状態にする。
|
||||
|
||||
---
|
||||
|
||||
### PlatformIOにて、 `platform = native` のビルドができる状態にする。
|
||||
|
||||
手順は下記 URL から `Installation` の項目を読んで実施する。
|
||||
https://docs.platformio.org/en/latest/platforms/native.html#installation
|
||||
|
||||
#### Linuxの場合
|
||||
|
||||
`apt` で `build-essential` をインストールする。
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install build-essential
|
||||
```
|
||||
|
||||
#### macOSの場合
|
||||
ターミナルから `xcode-select` をインストールする。
|
||||
```
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
#### Windowsの場合
|
||||
`MSYS2` をここ https://www.msys2.org/ から入手してインストールする。
|
||||
そのあと、Windowsの`システムのプロパティ`->`環境変数` を開き、 `PATH` に以下の3つのパスを追加する。
|
||||
```
|
||||
C:\msys64\mingw64\bin
|
||||
C:\msys64\ucrt64\bin
|
||||
C:\msys64\usr\bin
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### PlatformIOにて、 SDL2 が使用できる状態にする。
|
||||
|
||||
手順は下記 URL から `Install SDL2` の項目を読んで実施する。
|
||||
https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html#install-sdl-2
|
||||
|
||||
|
||||
#### Linuxの場合
|
||||
|
||||
apt-getでlibsdl2をインストールする。
|
||||
|
||||
```
|
||||
sudo apt-get install libsdl2 libsdl2-dev
|
||||
```
|
||||
|
||||
#### MacOS OSXの場合
|
||||
|
||||
Homebrewを使ってsdl2をインストールする。
|
||||
```
|
||||
brew install sdl2
|
||||
```
|
||||
|
||||
#### Windowsの場合
|
||||
|
||||
`platform = native` のビルドを可能にする手順において、 msys2をインストール済みのはずなので、
|
||||
githubの SDLのリポジトリにアクセスし、SDL2-devel-x.xx.x-mingw のリリースパッケージを入手する。
|
||||
https://github.com/libsdl-org/SDL/releases
|
||||
|
||||
本記事作成時点のファイル名は `SDL2-devel-2.28.1-mingw.zip`
|
||||
これを解凍し、出てきたフォルダの中にある `x86_64-w64-mingw32` フォルダを開き、中に以下の 4つのフォルダがあることを確認。
|
||||
- share
|
||||
- bin
|
||||
- include
|
||||
- lib
|
||||
|
||||
C:\msys64\mingw64\ を開き、上記の4つのフォルダと同名のフォルダが存在することを確認したら、C:\msys64\mingw64\ 内に上記フォルダの内容を追加する。(上書きコピー)
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
; 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
|
||||
|
||||
[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
|
||||
|
||||
[esp32_base]
|
||||
build_type = debug
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
upload_speed = 1500000
|
||||
monitor_speed = 115200
|
||||
monitor_filters = esp32_exception_decoder
|
||||
|
||||
[env:esp32_arduino]
|
||||
extends = esp32_base
|
||||
framework = arduino
|
||||
|
||||
[env:esp32_idf]
|
||||
extends = esp32_base
|
||||
framework = espidf
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#include <lgfx/v1/platforms/sdl/Panel_sdl.hpp>
|
||||
#if defined ( SDL_h_ )
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
__attribute__((weak))
|
||||
int user_func(bool* running)
|
||||
{
|
||||
setup();
|
||||
do
|
||||
{
|
||||
loop();
|
||||
} while (*running);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
return lgfx::Panel_sdl::main(user_func);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#define LGFX_AUTODETECT
|
||||
#include <LovyanGFX.h>
|
||||
#include <LGFX_AUTODETECT.hpp>
|
||||
|
||||
#if defined ( SDL_h_ )
|
||||
static LGFX lcd ( 320, 240, 2 );
|
||||
#else
|
||||
static LGFX lcd;
|
||||
#endif
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
lcd.init();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
lcd.fillCircle(rand()%lcd.width(), rand()%lcd.height(), 16, rand());
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined ( ESP_PLATFORM ) && !defined ( ARDUINO )
|
||||
extern "C" {
|
||||
int app_main(int, char**)
|
||||
{
|
||||
setup();
|
||||
for (;;) {
|
||||
loop();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue