mirror of
https://github.com/pevans/erc-c.git
synced 2024-11-27 20:51:17 +00:00
Hello world, in rendered text; use nearest pixel sampling
The scale change removes some blurriness that we saw when copying pixels from the bitmap font into the renderer.
This commit is contained in:
parent
979ca65f43
commit
b2c1bd9e6d
11
src/apple2.c
11
src/apple2.c
@ -86,10 +86,21 @@ apple2_set_color(apple2 *mach, int mode)
|
||||
// correct color interpretation
|
||||
}
|
||||
|
||||
#define SHOW(ch) \
|
||||
vm_bitfont_render(mach->sysfont, mach->screen, &area, ch); \
|
||||
area.x += 7
|
||||
|
||||
void
|
||||
apple2_run_loop(apple2 *mach)
|
||||
{
|
||||
SDL_Rect area;
|
||||
|
||||
|
||||
while (vm_screen_active(mach->screen)) {
|
||||
area.x = 50;
|
||||
area.y = 50;
|
||||
SHOW('H'); SHOW('e'); SHOW('l'); SHOW('l'); SHOW('o'); SHOW(' ');
|
||||
SHOW('w'); SHOW('o'); SHOW('r'); SHOW('l'); SHOW('d'); SHOW('!');
|
||||
vm_screen_refresh(mach->screen);
|
||||
}
|
||||
}
|
||||
|
@ -98,10 +98,17 @@ vm_bitfont_render(vm_bitfont *font,
|
||||
src.w = font->width;
|
||||
src.h = font->height;
|
||||
|
||||
// The source and destination width/height must match. This might be
|
||||
// a faulty assumption down the road; for now, it holds.
|
||||
dest->w = src.w;
|
||||
dest->h = src.h;
|
||||
|
||||
// Get the spot in the bitmap where the glyph is found
|
||||
vm_bitfont_offset(font, ch, &src.x, &src.y);
|
||||
|
||||
if (SDL_RenderCopy(screen->render, font->texture, dest, &src) < 0) {
|
||||
log_critical("src.x = %d, src.y = %d", src.x, src.y);
|
||||
|
||||
if (SDL_RenderCopy(screen->render, font->texture, &src, dest) < 0) {
|
||||
log_critical("Failed to render glyph: %s", SDL_GetError());
|
||||
return ERR_GFXOP;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ vm_screen_add_window(vm_screen *screen, int width, int height)
|
||||
|
||||
// We plan to draw onto a surface that is xcoords x ycoords in area,
|
||||
// regardless of the actual size of the window.
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
||||
|
||||
// We default to a logical coordinate system of exactly the given
|
||||
// width and height. For emulated systems like the Apple II, this
|
||||
|
Loading…
Reference in New Issue
Block a user