Skip to content

Commit

Permalink
Merge pull request #18 from lovyan03/unstable
Browse files Browse the repository at this point in the history
v0.1.10
  • Loading branch information
lovyan03 committed May 26, 2020
2 parents 5292772 + 7509d32 commit f049128
Show file tree
Hide file tree
Showing 16 changed files with 1,639 additions and 310 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ void setup(void)
drawLine ( x0, y0, x1, y1 , color); // 2点間の直線
drawTriangle ( x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の外周
fillTriangle ( x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の塗り
drawArc ( x, y, r1, r2, angle1, angle2, color); // 円弧の外周
fillArc ( x, y, r1, r2, angle1, angle2, color); // 円弧の塗り
drawBezier ( x0, y0, x1, y1, x2, y2, color); // 3点間のベジエ曲線
drawArc ( x, y, r0, r1, angle0, angle1, color); // 円弧の外周
fillArc ( x, y, r0, r1, angle0, angle1, color); // 円弧の塗り
*/


Expand Down Expand Up @@ -181,7 +182,9 @@ void setup(void)
lcd.drawCircle ( 40, 80, 20 ); // 青色で円の外周
lcd.drawEllipse( 80, 40, 10, 20); // 青色で楕円の外周
lcd.drawArc ( 80, 80, 20, 10, 0, 90); // 青色で円弧の外周
lcd.drawTriangle(80, 80, 60, 80, 80, 60);// 青色で三角の外周
lcd.drawTriangle(60, 80, 80, 80, 80, 60);// 青色で三角の外周
lcd.setColor(0x00FF00U); // 緑色を指定
lcd.drawBezier( 60, 80, 80, 80, 80, 60);// 緑色でベジエ曲線


// SPIバスの確保と解放は描画関数を呼び出した時に自動的に行われます。
Expand Down
9 changes: 6 additions & 3 deletions examples/HowToUse/1_simple_use/1_simple_use.ino
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ void setup(void)
drawLine ( x0, y0, x1, y1 , color); // 2点間の直線
drawTriangle ( x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の外周
fillTriangle ( x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の塗り
drawArc ( x, y, r1, r2, angle1, angle2, color); // 円弧の外周
fillArc ( x, y, r1, r2, angle1, angle2, color); // 円弧の塗り
drawBezier ( x0, y0, x1, y1, x2, y2, color); // 3点間のベジエ曲線
drawArc ( x, y, r0, r1, angle0, angle1, color); // 円弧の外周
fillArc ( x, y, r0, r1, angle0, angle1, color); // 円弧の塗り
*/


Expand Down Expand Up @@ -122,7 +123,9 @@ void setup(void)
lcd.drawCircle ( 40, 80, 20 ); // 青色で円の外周
lcd.drawEllipse( 80, 40, 10, 20); // 青色で楕円の外周
lcd.drawArc ( 80, 80, 20, 10, 0, 90); // 青色で円弧の外周
lcd.drawTriangle(80, 80, 60, 80, 80, 60);// 青色で三角の外周
lcd.drawTriangle(60, 80, 80, 80, 80, 60);// 青色で三角の外周
lcd.setColor(0x00FF00U); // 緑色を指定
lcd.drawBezier( 60, 80, 80, 80, 80, 60);// 緑色でベジエ曲線


// SPIバスの確保と解放は描画関数を呼び出した時に自動的に行われます。
Expand Down
67 changes: 37 additions & 30 deletions examples/HowToUse/3_fonts/3_fonts.ino
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,29 @@ void setup(void)
// setTextSize 関数で 文字の拡大率を指定します。
// 第1引数で横方向の倍率、第2引数で縦方向の倍率を指定します。
// 第2引数を省略した場合は、第1引数の倍率が縦と横の両方に反映されます。
lcd.setTextSize(3, 4);
lcd.println("Size 3 x 4");
lcd.setTextSize(2.7, 4);
lcd.println("Size 2.7 x 4");

lcd.setTextSize(2);
lcd.println("Size 2 x 2");
lcd.setTextSize(2.5);
lcd.println("Size 2.5 x 2.5");

lcd.setTextSize(1, 2);
lcd.println("Size 1 x 2");
lcd.setTextSize(1.5, 2);
lcd.println("Size 1.5 x 2");

delay(1000);

lcd.setTextColor(0xFFFFFFU, 0);
for (float i = 0; i < 30; i += 0.01) {
lcd.setTextSize(sin(i)+1.1, cos(i)+1.1);
lcd.drawString("size test", 10, 10);
}

lcd.setTextSize(1);

// setTextWrap 関数で、print 関数が画面端(描画範囲端)に到達した時の折り返し動作を指定します。
// 第1引数をtrueにすると、右端到達後に左端へ移動します。
// 第2引数をtrueにすると、下端到達後に上端へ移動します。(省略時:false)
lcd.setTextWrap(false);
lcd.setTextColor(0x00FFFFU, 0);
lcd.println("setTextWrap(false) testing... long long long long string wrap test string ");
// false指定時は位置調整されず、描画範囲外にはみ出した部分は描画されません。

Expand Down Expand Up @@ -251,27 +258,27 @@ void drawNumberTest(const lgfx::IFont* font)
void loop(void)
{
// ※ 名前が"Free"で始まるフォントは 9pt 12pt 18pt 24ptの4種類があります。
drawNumberTest(&Font0);
drawNumberTest(&Font2);
drawNumberTest(&Font4);
drawNumberTest(&Font6);
drawNumberTest(&Font7);
drawNumberTest(&Font8);
drawNumberTest(&TomThumb);
drawNumberTest(&FreeMono9pt7b);
drawNumberTest(&FreeMonoBold9pt7b);
drawNumberTest(&FreeMonoOblique9pt7b);
drawNumberTest(&FreeMonoBoldOblique9pt7b);
drawNumberTest(&FreeSans9pt7b);
drawNumberTest(&FreeSansBold9pt7b);
drawNumberTest(&FreeSansOblique9pt7b);
drawNumberTest(&FreeSansBoldOblique9pt7b);
drawNumberTest(&FreeSerif9pt7b);
drawNumberTest(&FreeSerifBold9pt7b);
drawNumberTest(&FreeSerifItalic9pt7b);
drawNumberTest(&FreeSerifBoldItalic9pt7b);
drawNumberTest(&Orbitron_Light_24);
drawNumberTest(&Roboto_Thin_24);
drawNumberTest(&Satisfy_24);
drawNumberTest(&Yellowtail_32);
drawNumberTest( &Font0 );
drawNumberTest( &Font2 );
drawNumberTest( &Font4 );
drawNumberTest( &Font6 );
drawNumberTest( &Font7 );
drawNumberTest( &Font8 );
drawNumberTest( &TomThumb );
drawNumberTest( &FreeMono9pt7b );
drawNumberTest( &FreeMonoBold9pt7b );
drawNumberTest( &FreeMonoOblique9pt7b );
drawNumberTest( &FreeMonoBoldOblique9pt7b);
drawNumberTest( &FreeSans9pt7b );
drawNumberTest( &FreeSansBold9pt7b );
drawNumberTest( &FreeSansOblique9pt7b );
drawNumberTest( &FreeSansBoldOblique9pt7b);
drawNumberTest( &FreeSerif9pt7b );
drawNumberTest( &FreeSerifBold9pt7b );
drawNumberTest( &FreeSerifItalic9pt7b );
drawNumberTest( &FreeSerifBoldItalic9pt7b);
drawNumberTest( &Orbitron_Light_24 );
drawNumberTest( &Roboto_Thin_24 );
drawNumberTest( &Satisfy_24 );
drawNumberTest( &Yellowtail_32 );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

// このサンプルの実行にはArduino-misakiUTF16が必要です。
// need misakifont to run this example.
//
// URL : https://github.com/Tamakichi/Arduino-misakiUTF16
//

// Arduino-misakiUTF16のフォントデータをincludeします。
// Include the font data of Arduino-misakiUTF16.
#include "misakiUTF16FontData.h"

#include <LovyanGFX.hpp>

static LGFX lcd;

// lgfx::BDFfontクラスを使って、Arduino-misakiUTF16を使用できるように設定します。
static constexpr lgfx::BDFfont misaki_font =
{ fdata // 第1引数 フォントのビットマップデータ
, ftable // 第2引数 unicodeフォントテーブル
, sizeof(ftable)>>1 // 第3引数 フォントテーブルのサイズ
, 8 // 第4引数 フォント幅
, 4 // 第5引数 フォント幅 (半角)
, 7 // 第6引数 フォント高さ
, 6 // 第7引数 ベースライン高さ
, 8 // 第8引数 改行時の縦方向カーソル移動量
};


void setup()
{
lcd.init();

// 先ほど作成した misaki_font を setFont 関数の引数に指定することで、print や drawString 等で使用できます。
lcd.setFont(&misaki_font);

lcd.setTextWrap(true, true);
}

void loop()
{
lcd.setTextColor(0x808080U|random(0xFFFFFF), 0x7F7F7FU&random(0x10000));

lcd.print("美さきフォントは8x8のコンパクトなフォントです。");
lcd.print("Arduino-misakiUTF16は、教育漢字1,006字(小学校で習う漢字)+ひらがな・カタカナ・記号・半角等の1,710字にしぼって収録されています。");
lcd.print("Hello");
lcd.print("HELLO");
lcd.print("こんにちは");
delay(1000);
}
Loading

0 comments on commit f049128

Please sign in to comment.