brand new font

This commit is contained in:
2025-06-28 21:09:29 +02:00
parent 687cfebd00
commit 2a74e87276
5 changed files with 101 additions and 3 deletions

View File

@@ -141,7 +141,7 @@ void nni_gpu_set(nni_gpu *gpu, void *_, nn_component *component, nn_computer *co
}
int current = 0;
while(s[current]) {
while(s[current] != 0) {
int codepoint = nn_unicode_codepointAt(s, current);
nn_setPixel(gpu->currentScreen, x, y, nni_gpu_makePixel(gpu, s + current));
if(isVertical) {

View File

@@ -315,6 +315,8 @@ int main() {
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow(800, 600, "emulator");
Font unscii = LoadFont("unscii-16-full.ttf");
double lastTime = nn_realTime();
while(true) {
if(WindowShouldClose()) break;
@@ -362,7 +364,8 @@ render:
int scrW = 1, scrH = 1;
nn_getResolution(s, &scrW, &scrH);
int pixelHeight = GetScreenHeight() / scrH;
int pixelWidth = MeasureText("A", pixelHeight);
float spacing = (float)pixelHeight/10;
int pixelWidth = MeasureTextEx(unscii, "A", pixelHeight, spacing).x;
for(size_t x = 0; x < scrW; x++) {
for(size_t y = 0; y < scrH; y++) {
@@ -373,7 +376,7 @@ render:
Color fgColor = ne_processColor(p.fg);
Color bgColor = ne_processColor(p.bg);
DrawRectangle(x * pixelWidth, y * pixelHeight, pixelWidth, pixelHeight, bgColor);
DrawText(s, x * pixelWidth, y * pixelHeight, pixelHeight - 5, fgColor);
DrawTextEx(unscii, s, (Vector2) {x * pixelWidth, y * pixelHeight}, pixelHeight - 5, spacing, fgColor);
}
}