项目作者: maturu

项目描述 :
An easy Japanese font library for Gamebuino
高级语言: C
项目地址: git://github.com/maturu/kanafont-gamebuino.git
创建时间: 2020-03-28T15:50:56Z
项目社区:https://github.com/maturu/kanafont-gamebuino

开源协议:MIT License

下载


KanaFont: A japanese font for the game of Gamebuino






KanaFont is a C/C++ based japanese font generation system for the game of Gamebuino.
It provides an easy convert a japanese text array into a bitmap index array for the created japanese bitmap list, “Bitmap.h”.

Installation

To install KanaFont, use git

  1. $ git clone https://github.com/maturu/kanafont-gamebuino.git

Usage

First, generate a bitmap index array

  1. $ gcc hashConverter.c
  2. $ ./a.out
  3. Enter text in Japanese to convert to a bitmap. >> ほげふが
  4. const int words[4] = {30, 52, 28, 49};

Second, use it in Arduino IDE

  1. #include "Bitmaps.h"

For example

  1. void write(const int*, int, int, int);
  2. ...
  3. void write(const int *text, int text_len, int w = 0, int h = 0){
  4. int value;
  5. for(value=0; value < text_len; value++){
  6. // chars is variable in "Bitmap.h"
  7. gb.display.drawBitmap(w, h, chars[text[value]-1]);
  8. w += 7;
  9. if(w >= 84){
  10. w = 0;
  11. h += 7;
  12. }
  13. }
  14. }
  15. const int words[4] = {30, 52, 28, 49};
  16. void loop(){
  17. while(1){
  18. if(gb.update()){
  19. int w_len = sizeof(word)/sizeof(int);
  20. // w is your any width
  21. // h is your any height
  22. write(word, w_len, w, h);
  23. }
  24. }
  25. }

License

MIT License (see LICENSE file).