Post by japeral on Jun 5, 2014 0:55:25 GMT -8
Hello,
I am trying to add 2 different fonts to assets, buy python script creates each different font with same "INFOFONT_HANDLE" define.
For example:
I execute this:
And result is:
x_assets.h content is:
Arduino console output is:
As you can see Arial8 and ArialBold32 are translated to "INFOFONT_x" defines. So I can not use both fonts because it is redefinition of defines.
May this is a bug in gd2asset scrypt?
I can solve this issue it changeing "INFOFONT_x" define names by "ARIAL8_x" and "ARIALBOLD32_" like this:
Thank you
I am trying to add 2 different fonts to assets, buy python script creates each different font with same "INFOFONT_HANDLE" define.
For example:
I execute this:
c:\python27\python.exe c:\python27\scripts\gd2asset -o x_assets.h -f x.gd2 x1.bmp,format=RGB332 x2.bmp,format=RGB332 Arial.ttf,size=8 ArialBold.ttf,size=32
And result is:
Assets report
-------------
Header file: x_assets.h
GD2 RAM used: 188372
Output file: x.gd2
File size: 22215
x_assets.h content is:
#define LOAD_ASSETS() GD.safeload("x.gd2");
#define X1_HANDLE 0
#define X1_WIDTH 471
#define X1_HEIGHT 266
#define X1_CELLS 1
#define X2_HANDLE 1
#define X2_WIDTH 50
#define X2_HEIGHT 50
#define X2_CELLS 1
#define INFOFONT_HANDLE 2
#define INFOFONT_WIDTH 8
#define INFOFONT_HEIGHT 9
#define INFOFONT_CELLS 96
#define INFOFONT_HANDLE 3
#define INFOFONT_WIDTH 31
#define INFOFONT_HEIGHT 37
#define INFOFONT_CELLS 96
#define ASSETS_END 188372UL
static const shape_t X1_SHAPE = {0, 471, 266, 0};
static const shape_t X2_SHAPE = {1, 50, 50, 0};
static const shape_t INFOFONT_SHAPE = {2, 8, 9, 0};
static const shape_t INFOFONT_SHAPE = {3, 31, 37, 0};
Arduino console output is:
In file included from x.ino:24:
/x_assets.h:14:1: warning: "INFOFONT_HANDLE" redefined
/x_assets.h:10:1: warning: this is the location of the previous definition
/x_assets.h:15:1: warning: "INFOFONT_WIDTH" redefined
/x_assets.h:11:1: warning: this is the location of the previous definition
/x_assets.h:16:1: warning: "INFOFONT_HEIGHT" redefined
/x_assets.h:12:1: warning: this is the location of the previous definition
In file included from x.ino:22:
C:\Arduino\libraries\Gameduino2/GD2.h:329: warning: '__progmem__' attribute ignored
In file included from x.ino:24:
x_assets.h:22: error: redefinition of 'const shape_t INFOFONT_SHAPE'
x_assets.h:21: error: 'const shape_t INFOFONT_SHAPE' previously defined here
C:\Arduino\libraries\Gameduino2/GD2.h:932: warning: 'byte sinus(byte)' defined but not used
As you can see Arial8 and ArialBold32 are translated to "INFOFONT_x" defines. So I can not use both fonts because it is redefinition of defines.
May this is a bug in gd2asset scrypt?
I can solve this issue it changeing "INFOFONT_x" define names by "ARIAL8_x" and "ARIALBOLD32_" like this:
#define ARIAL8_HANDLE 2
#define ARIAL8_WIDTH 8
#define ARIAL8_HEIGHT 9
#define ARIAL8_CELLS 96
static const shape_t ARIAL8_SHAPE = {2, 8, 9, 0};
#define ARIALBOLD32_HANDLE 3
#define ARIALBOLD32_WIDTH 31
#define ARIALBOLD32_HEIGHT 37
#define ARIALBOLD32_CELLS 96
static const shape_t ARIALBOLD32_SHAPE = {3, 31, 37, 0};
Thank you