fonts and keyboard characters
This commit is contained in:
parent
f8fe206626
commit
e76794a04b
4 changed files with 27 additions and 18 deletions
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
Config config = {
|
Config config = {
|
||||||
.progname = "hpemung",
|
.progname = "hpemung",
|
||||||
.ui_font = "/usr/share/fonts/TTF/unifont.ttf",
|
.ui_font1 = "/usr/share/fonts/TTF/unifont.ttf",
|
||||||
|
.ui_font2 = "/usr/share/fonts/TTF/unifont.ttf",
|
||||||
|
.ui_font_size1 = 6,
|
||||||
|
.ui_font_size2 = 4,
|
||||||
.real_speed = true,
|
.real_speed = true,
|
||||||
.verbose = true,
|
.verbose = true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char* progname;
|
char* progname;
|
||||||
char* ui_font;
|
char* ui_font1;
|
||||||
|
char* ui_font2;
|
||||||
|
int ui_font_size1;
|
||||||
|
int ui_font_size2;
|
||||||
bool real_speed;
|
bool real_speed;
|
||||||
bool verbose;
|
bool verbose;
|
||||||
} Config;
|
} Config;
|
||||||
|
|
32
src/gui.c
32
src/gui.c
|
@ -359,7 +359,7 @@ static Button gui_buttons[] = {
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = "SIN",
|
.label = "SIN",
|
||||||
.label_Lshift = "ASIN",
|
.label_Lshift = "ASIN",
|
||||||
.label_Rshift = "𝛛",
|
.label_Rshift = "\u2202",
|
||||||
.label_letter = "S",
|
.label_letter = "S",
|
||||||
.label_below = "",
|
.label_below = "",
|
||||||
.down = press_SIN,
|
.down = press_SIN,
|
||||||
|
@ -385,7 +385,7 @@ static Button gui_buttons[] = {
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = "TAN",
|
.label = "TAN",
|
||||||
.label_Lshift = "ATAN",
|
.label_Lshift = "ATAN",
|
||||||
.label_Rshift = "𝚺",
|
.label_Rshift = "\u03a3",
|
||||||
.label_letter = "U",
|
.label_letter = "U",
|
||||||
.label_below = "",
|
.label_below = "",
|
||||||
.down = press_TAN,
|
.down = press_TAN,
|
||||||
|
@ -409,8 +409,8 @@ static Button gui_buttons[] = {
|
||||||
.w = UI_K_WIDTH_1,
|
.w = UI_K_WIDTH_1,
|
||||||
.h = UI_K_HEIGHT_2,
|
.h = UI_K_HEIGHT_2,
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = "y^x",
|
.label = "y\u02e3",
|
||||||
.label_Lshift = "⏨^x",
|
.label_Lshift = "\u23e8\u02e3",
|
||||||
.label_Rshift = "LOG",
|
.label_Rshift = "LOG",
|
||||||
.label_letter = "W",
|
.label_letter = "W",
|
||||||
.label_below = "",
|
.label_below = "",
|
||||||
|
@ -423,7 +423,7 @@ static Button gui_buttons[] = {
|
||||||
.h = UI_K_HEIGHT_2,
|
.h = UI_K_HEIGHT_2,
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = "1/x",
|
.label = "1/x",
|
||||||
.label_Lshift = "e^x",
|
.label_Lshift = "e\u02e3",
|
||||||
.label_Rshift = "LN",
|
.label_Rshift = "LN",
|
||||||
.label_letter = "X",
|
.label_letter = "X",
|
||||||
.label_below = "",
|
.label_below = "",
|
||||||
|
@ -449,7 +449,7 @@ static Button gui_buttons[] = {
|
||||||
.w = UI_K_WIDTH_1,
|
.w = UI_K_WIDTH_1,
|
||||||
.h = UI_K_HEIGHT_2,
|
.h = UI_K_HEIGHT_2,
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = "±",
|
.label = "+/-",
|
||||||
.label_Lshift = "EDIT",
|
.label_Lshift = "EDIT",
|
||||||
.label_Rshift = "CMD",
|
.label_Rshift = "CMD",
|
||||||
.label_letter = "Y",
|
.label_letter = "Y",
|
||||||
|
@ -568,7 +568,7 @@ static Button gui_buttons[] = {
|
||||||
.w = UI_K_WIDTH_1,
|
.w = UI_K_WIDTH_1,
|
||||||
.h = UI_K_HEIGHT_2,
|
.h = UI_K_HEIGHT_2,
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = "⮢",
|
.label = "\u2ba2",
|
||||||
.label_Lshift = "",
|
.label_Lshift = "",
|
||||||
.label_Rshift = "",
|
.label_Rshift = "",
|
||||||
.label_letter = "",
|
.label_letter = "",
|
||||||
|
@ -634,7 +634,7 @@ static Button gui_buttons[] = {
|
||||||
.w = UI_K_WIDTH_1,
|
.w = UI_K_WIDTH_1,
|
||||||
.h = UI_K_HEIGHT_2,
|
.h = UI_K_HEIGHT_2,
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = "⮣",
|
.label = "\u2ba3",
|
||||||
.label_Lshift = "",
|
.label_Lshift = "",
|
||||||
.label_Rshift = "",
|
.label_Rshift = "",
|
||||||
.label_letter = "",
|
.label_letter = "",
|
||||||
|
@ -715,7 +715,7 @@ static Button gui_buttons[] = {
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = "0",
|
.label = "0",
|
||||||
.label_Lshift = "=",
|
.label_Lshift = "=",
|
||||||
.label_Rshift = "→",
|
.label_Rshift = "\u2192",
|
||||||
.label_letter = "",
|
.label_letter = "",
|
||||||
.label_below = "",
|
.label_below = "",
|
||||||
.down = press_0,
|
.down = press_0,
|
||||||
|
@ -728,7 +728,7 @@ static Button gui_buttons[] = {
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = ".",
|
.label = ".",
|
||||||
.label_Lshift = ",",
|
.label_Lshift = ",",
|
||||||
.label_Rshift = "⮐",
|
.label_Rshift = "\u2ba0",
|
||||||
.label_letter = "",
|
.label_letter = "",
|
||||||
.label_below = "",
|
.label_below = "",
|
||||||
.down = press_PERIOD,
|
.down = press_PERIOD,
|
||||||
|
@ -740,8 +740,8 @@ static Button gui_buttons[] = {
|
||||||
.h = UI_K_HEIGHT_2,
|
.h = UI_K_HEIGHT_2,
|
||||||
.flags = std_flags,
|
.flags = std_flags,
|
||||||
.label = "SPC",
|
.label = "SPC",
|
||||||
.label_Lshift = "𝛑",
|
.label_Lshift = "\u03c0",
|
||||||
.label_Rshift = "⦨",
|
.label_Rshift = "\u29a8",
|
||||||
.label_letter = "",
|
.label_letter = "",
|
||||||
.label_below = "",
|
.label_below = "",
|
||||||
.down = press_SPC,
|
.down = press_SPC,
|
||||||
|
@ -862,7 +862,7 @@ static inline void _init_keyboard_textures( Button* calcbuttons )
|
||||||
s = NULL;
|
s = NULL;
|
||||||
t = NULL;
|
t = NULL;
|
||||||
if ( buttons->label_below && strcmp( buttons->label_below, "" ) != 0 ) {
|
if ( buttons->label_below && strcmp( buttons->label_below, "" ) != 0 ) {
|
||||||
s = TTF_RenderUTF8_Blended( ttffont2, buttons->label_below, colors.letter );
|
s = TTF_RenderUTF8_Blended( ttffont2, buttons->label_below, colors.below );
|
||||||
if ( s ) {
|
if ( s ) {
|
||||||
t = SDL_CreateTextureFromSurface( renderer, s );
|
t = SDL_CreateTextureFromSurface( renderer, s );
|
||||||
}
|
}
|
||||||
|
@ -879,7 +879,7 @@ static inline void _init_keyboard_textures( Button* calcbuttons )
|
||||||
s = NULL;
|
s = NULL;
|
||||||
t = NULL;
|
t = NULL;
|
||||||
if ( buttons->label_letter && strcmp( buttons->label_letter, "" ) != 0 ) {
|
if ( buttons->label_letter && strcmp( buttons->label_letter, "" ) != 0 ) {
|
||||||
s = TTF_RenderUTF8_Blended( ttffont2, buttons->label_letter, colors.below );
|
s = TTF_RenderUTF8_Blended( ttffont2, buttons->label_letter, colors.letter );
|
||||||
if ( s ) {
|
if ( s ) {
|
||||||
t = SDL_CreateTextureFromSurface( renderer, s );
|
t = SDL_CreateTextureFromSurface( renderer, s );
|
||||||
}
|
}
|
||||||
|
@ -1503,8 +1503,8 @@ bool gui_init( void )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ttffont = TTF_OpenFont( config.ui_font, 7 * UI_SCALE );
|
ttffont = TTF_OpenFont( config.ui_font1, config.ui_font_size1 * UI_SCALE );
|
||||||
ttffont2 = TTF_OpenFont( config.ui_font, 5 * UI_SCALE );
|
ttffont2 = TTF_OpenFont( config.ui_font2, config.ui_font_size2 * UI_SCALE );
|
||||||
|
|
||||||
int window_width = ( LCD_WIDTH + ( 2 * UI_PADDING ) ) * UI_SCALE;
|
int window_width = ( LCD_WIDTH + ( 2 * UI_PADDING ) ) * UI_SCALE;
|
||||||
int window_height = ( UI_KB_OFFSET_Y + UI_KB_HEIGHT ) + 2 * UI_PADDING;
|
int window_height = ( UI_KB_OFFSET_Y + UI_KB_HEIGHT ) + 2 * UI_PADDING;
|
||||||
|
|
|
@ -49,9 +49,11 @@ void timer2_update( void )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
timer2_value--;
|
timer2_value--;
|
||||||
|
|
||||||
if ( timer2_value & 0x80000000 ) {
|
if ( timer2_value & 0x80000000 ) {
|
||||||
if ( timer2_control & TIMER2_WAKE ) {
|
if ( timer2_control & TIMER2_WAKE ) {
|
||||||
timer2_control |= TIMER2_SRQ;
|
timer2_control |= TIMER2_SRQ;
|
||||||
|
|
||||||
if ( cpu.shutdown ) {
|
if ( cpu.shutdown ) {
|
||||||
cpu.shutdown = 0;
|
cpu.shutdown = 0;
|
||||||
timer2_control &= ~TIMER2_WAKE;
|
timer2_control &= ~TIMER2_WAKE;
|
||||||
|
@ -59,6 +61,7 @@ void timer2_update( void )
|
||||||
}
|
}
|
||||||
if ( timer2_control & TIMER2_INT ) {
|
if ( timer2_control & TIMER2_INT ) {
|
||||||
timer2_control |= TIMER2_SRQ;
|
timer2_control |= TIMER2_SRQ;
|
||||||
|
|
||||||
if ( !cpu.shutdown )
|
if ( !cpu.shutdown )
|
||||||
cpu_interrupt();
|
cpu_interrupt();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue