1

cleanup some vbe stuff

This commit is contained in:
2022-07-24 14:13:59 +02:00
parent adbc87c680
commit 319fb25ae1
11 changed files with 2872 additions and 2875 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
/* Acorn-like font definition, with PC graphics characters */
unsigned char acorndata_8x8[] = {
constexpr const unsigned char acorndata_8x8[] = {
/* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */
/* 01 */ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */
/* 02 */ 0x7e, 0xff, 0xbd, 0xff, 0xc3, 0xe7, 0xff, 0x7e, /* ^B */

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#define FONTDATAMAX_SUN_12x22 11264
unsigned char fontdata_sun_12x22[FONTDATAMAX_SUN_12x22] = {
constexpr const unsigned char fontdata_sun_12x22[FONTDATAMAX_SUN_12x22] = {
/* 0 0x00 '^@' */
0x00, 0x00, /* 000000000000 */

View File

@ -2,7 +2,7 @@
#define FONTDATAMAX_SUN8x16 4096
unsigned char fontdata_sun_8x16[FONTDATAMAX_SUN8x16] = {
constexpr const unsigned char fontdata_sun_8x16[FONTDATAMAX_SUN8x16] = {
/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00,
/* */ 0x00,0x00,0x7e,0xff,0xdb,0xff,0xff,0xc3,0xe7,0xff,0xff,0x7e,0x00,0x00,0x00,0x00,

View File

@ -11,9 +11,9 @@
#include "devices/fonts/Font_sun_12x22.h"
#include "devices/fonts/Font_sun_8x16.h"
Font_8x16 std_font_8x16;
Font_8x8 std_font_8x8;
Font_acorn_8x8 acorn_font_8x8;
Font_pearl_8x8 pearl_font_8x8;
Font_sun_12x22 sun_font_12x22;
Font_sun_8x16 sun_font_8x16;
const Font_8x16 std_font_8x16;
const Font_8x8 std_font_8x8;
const Font_acorn_8x8 acorn_font_8x8;
const Font_pearl_8x8 pearl_font_8x8;
const Font_sun_12x22 sun_font_12x22;
const Font_sun_8x16 sun_font_8x16;

View File

@ -13,37 +13,38 @@
class Font {
public:
virtual unsigned char* getChar(int c) const = 0;
virtual const unsigned char* getChar(int c) const = 0;
virtual unsigned int get_char_width() const = 0;
virtual unsigned int get_char_height() const = 0;
};
template<unsigned int width, unsigned int height, unsigned char* data>
template<unsigned int width, unsigned int height, const unsigned char* data>
class FontInstance : public Font {
const unsigned int char_width;
const unsigned int char_height;
const unsigned int char_mem_size;
unsigned char* font_data;
const unsigned char* font_data;
public:
FontInstance() : char_width(width), char_height(height), char_mem_size((((char_width + (8 >> 1)) / 8) * char_height)), font_data(data) {}
inline unsigned char* getChar(int c) const {
inline const unsigned char* getChar(int c) const override {
return &font_data[char_mem_size * c];
}
inline unsigned int get_char_width() const {
inline unsigned int get_char_width() const override {
return char_width;
}
inline unsigned int get_char_height() const {
inline unsigned int get_char_height() const override {
return char_height;
}
};
extern unsigned char fontdata_8x16[];
extern unsigned char fontdata_8x8[];
extern unsigned char acorndata_8x8[];
extern unsigned char fontdata_pearl_8x8[];
extern unsigned char fontdata_sun_12x22[];
extern unsigned char fontdata_sun_8x16[];
extern const unsigned char fontdata_8x16[];
extern const unsigned char fontdata_8x8[];
extern const unsigned char acorndata_8x8[];
extern const unsigned char fontdata_pearl_8x8[];
extern const unsigned char fontdata_sun_12x22[];
extern const unsigned char fontdata_sun_8x16[];
typedef FontInstance<8, 16, fontdata_8x16> Font_8x16;
typedef FontInstance<8, 8, fontdata_8x8> Font_8x8;
@ -52,11 +53,11 @@ typedef FontInstance<8, 8, fontdata_pearl_8x8> Font_pearl_8x8;
typedef FontInstance<12, 22, fontdata_sun_12x22> Font_sun_12x22;
typedef FontInstance<8, 16, fontdata_sun_8x16> Font_sun_8x16;
extern Font_8x16 std_font_8x16;
extern Font_8x8 std_font_8x8;
extern Font_acorn_8x8 acorn_font_8x8;
extern Font_pearl_8x8 pearl_font_8x8;
extern Font_sun_12x22 sun_font_12x22;
extern Font_sun_8x16 sun_font_8x16;
extern const Font_8x16 std_font_8x16;
extern const Font_8x8 std_font_8x8;
extern const Font_acorn_8x8 acorn_font_8x8;
extern const Font_pearl_8x8 pearl_font_8x8;
extern const Font_sun_12x22 sun_font_12x22;
extern const Font_sun_8x16 sun_font_8x16;
#endif