Fix the scaling and add nonthreaded

This commit is contained in:
2025-02-22 16:35:53 +01:00
parent 274c99f98b
commit 8158d35065
3 changed files with 28 additions and 19 deletions

View File

@@ -77,7 +77,7 @@ void init_editor(TextEditor *editor, BitmapFont *font, int x, int y, SDL_Rendere
editor->highlightedLineRect->x = 2;
editor->highlightedLineRect->y = 2;
editor->highlightedLineRect->w = editor->outRect->w - (2 * editor->highlightedLineRect->x);
editor->highlightedLineRect->h = editor->font->size;
editor->highlightedLineRect->h = editor->font->size + 1;
editor->cursorRect->x = 3 + editor->cursor_pos * font->size + editor->outRect->x;
editor->cursorRect->y =
@@ -333,16 +333,16 @@ void editor_render(TextEditor *editor, SDL_Renderer *renderer, CPU *cpu, uint8_t
if (editorIndex == 0) {
targetLine = cpu->addrToLineMapper[instrLine] - editor->cursor_line_offset;
editor->highlightedLineRect->w = editor->rect->w - 1;
editor->highlightedLineRect->x = 2;
editor->highlightedLineRect->x = 0;
}
if (editorIndex == 1) {
targetLine = (instrLine / 2) - editor->cursor_line_offset;
editor->highlightedLineRect->w = (editor->rect->w / 5 * 2) - 2;
editor->highlightedLineRect->w = (editor->rect->w / 5 * 2) - 8;
editor->highlightedLineRect->x =
2 + (11 * editor->font->size) + (instrLine % 2 ? (28 * editor->font->size) : 0);
4 + (11 * editor->font->size) + (instrLine % 2 ? (28 * editor->font->size) : 0);
}
editor->highlightedLineRect->y = 2 + ((editor->font->size + 1) * targetLine);
editor->highlightedLineRect->y = 1 + ((editor->font->size + 1) * targetLine);
SDL_Rect highlightedLineAbs = *editor->highlightedLineRect;
highlightedLineAbs.x += editor->outRect->x;
highlightedLineAbs.y += editor->outRect->y;