brand new font
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user