emulator working
This commit is contained in:
@@ -2,31 +2,31 @@
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "./fonts/5x5_font.h"
|
||||
#include "./fonts/BMplain_font.h"
|
||||
#include "./fonts/Blokus_font.h"
|
||||
#include "./fonts/HISKYF21_font.h"
|
||||
#include "./fonts/Minimum_font.h"
|
||||
#include "./fonts/SUPERDIG_font.h"
|
||||
#include "./fonts/acme_5_outlines_font.h"
|
||||
#include "./fonts/aztech_font.h"
|
||||
#include "./fonts/crackers_font.h"
|
||||
#include "./fonts/haiku_font.h"
|
||||
#include "./fonts/sloth_font.h"
|
||||
#include "./fonts/zxpix_font.h"
|
||||
#include "./fonts/Commo-Monospaced_font.h"
|
||||
#include "./fonts/7linedigital_font.h"
|
||||
#include "./fonts/BMSPA_font.h"
|
||||
#include "./fonts/HUNTER_font.h"
|
||||
#include "./fonts/Raumsond_font.h"
|
||||
#include "./fonts/bubblesstandard_font.h"
|
||||
#include "./fonts/formplex12_font.h"
|
||||
#include "./fonts/homespun_font.h"
|
||||
#include "./fonts/Minimum_1_font.h"
|
||||
#include "./fonts/m38_font.h"
|
||||
#include "./fonts/pzim3x5_font.h"
|
||||
#include "./fonts/renew_font.h"
|
||||
#include "./fonts/tama_mini02_font.h"
|
||||
#include "../fonts/5x5_font.h"
|
||||
#include "../fonts/BMplain_font.h"
|
||||
#include "../fonts/Blokus_font.h"
|
||||
#include "../fonts/HISKYF21_font.h"
|
||||
#include "../fonts/Minimum_font.h"
|
||||
#include "../fonts/SUPERDIG_font.h"
|
||||
#include "../fonts/acme_5_outlines_font.h"
|
||||
#include "../fonts/aztech_font.h"
|
||||
#include "../fonts/crackers_font.h"
|
||||
#include "../fonts/haiku_font.h"
|
||||
#include "../fonts/sloth_font.h"
|
||||
#include "../fonts/zxpix_font.h"
|
||||
#include "../fonts/Commo-Monospaced_font.h"
|
||||
#include "../fonts/7linedigital_font.h"
|
||||
#include "../fonts/BMSPA_font.h"
|
||||
#include "../fonts/HUNTER_font.h"
|
||||
#include "../fonts/Raumsond_font.h"
|
||||
#include "../fonts/bubblesstandard_font.h"
|
||||
#include "../fonts/formplex12_font.h"
|
||||
#include "../fonts/homespun_font.h"
|
||||
#include "../fonts/Minimum_1_font.h"
|
||||
#include "../fonts/m38_font.h"
|
||||
#include "../fonts/pzim3x5_font.h"
|
||||
#include "../fonts/renew_font.h"
|
||||
#include "../fonts/tama_mini02_font.h"
|
||||
|
||||
// Font object definitions
|
||||
Font font_5x5_obj(reinterpret_cast<const unsigned char*>(font_5x5), 96, 6, 8);
|
||||
@@ -547,19 +547,27 @@ void LowLevelRenderer::draw_filled_circle(int x, int y, int radius, bool on)
|
||||
|
||||
int LowLevelRenderer::draw_char_vcol(int x, int y, char c)
|
||||
{
|
||||
if (!current_font) return 0;
|
||||
|
||||
// The font table starts at space (ASCII 32)
|
||||
if (c < 32 || c > 127)
|
||||
if (!current_font) {
|
||||
fprintf(stderr, "[draw_char_vcol] current_font is null!\n");
|
||||
return 0;
|
||||
}
|
||||
// The font table starts at space (ASCII 32)
|
||||
if (c < 32 || c > 127) {
|
||||
fprintf(stderr, "[draw_char_vcol] char out of range: %d\n", (int)c);
|
||||
return 0;
|
||||
}
|
||||
int font_idx = c - 32;
|
||||
|
||||
if (font_idx < 0 || font_idx >= current_font->get_num_chars()) {
|
||||
fprintf(stderr, "[draw_char_vcol] font_idx out of range: %d\n", font_idx);
|
||||
return 0;
|
||||
}
|
||||
const unsigned char* char_data = current_font->get_char_data(font_idx);
|
||||
if (!char_data) return 0;
|
||||
|
||||
if (!char_data) {
|
||||
fprintf(stderr, "[draw_char_vcol] char_data is null for idx %d\n", font_idx);
|
||||
return 0;
|
||||
}
|
||||
int bytes_per_char = current_font->get_bytes_per_char();
|
||||
int char_height = current_font->get_char_height();
|
||||
|
||||
// Find the actual width by skipping trailing empty columns
|
||||
int actual_width = 0;
|
||||
for (int col = bytes_per_char - 1; col >= 0; col--)
|
||||
@@ -570,12 +578,10 @@ int LowLevelRenderer::draw_char_vcol(int x, int y, char c)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw only up to the actual width
|
||||
for (int col = 0; col < actual_width; col++)
|
||||
{
|
||||
unsigned char column_byte = char_data[col];
|
||||
|
||||
for (int row = 0; row < char_height; row++)
|
||||
{
|
||||
// Check if the bit for this row is set
|
||||
@@ -585,7 +591,6 @@ int LowLevelRenderer::draw_char_vcol(int x, int y, char c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return actual_width;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user