1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-01 04:04:28 +00:00

Add bitmap font to apple2, remove rectangle draw

This commit is contained in:
Peter Evans 2017-12-21 23:33:04 -06:00
parent adac6346e8
commit 979ca65f43
3 changed files with 21 additions and 2 deletions

View File

@ -3,6 +3,7 @@
#include "apple2.dd.h"
#include "mos6502.h"
#include "vm_bitfont.h"
#include "vm_screen.h"
enum video_modes {
@ -39,6 +40,12 @@ typedef struct {
*/
vm_screen *screen;
/*
* This is the system font (the only font the Apple II knows about,
* really); anywhere we render text, we have to use this font.
*/
vm_bitfont *sysfont;
/*
* This is the mode in which we must interpret graphics. This will
* tell us not only if we're in lo- or hi-res, but also if we are in
@ -68,6 +75,7 @@ extern void apple2_clear_strobe(apple2 *);
extern void apple2_release_key(apple2 *);
extern int apple2_boot(apple2 *);
extern void apple2_run_loop(apple2 *);
extern void apple2_set_color(apple2 *, int);
extern void apple2_set_video(apple2 *, int);
#endif

View File

@ -64,6 +64,16 @@ apple2_create(int width, int height)
// We default to lo-res mode.
apple2_set_video(mach, VIDEO_LORES);
// Let's install our bitmap font.
mach->sysfont = vm_bitfont_create(mach->screen,
"apple2-system",
7, 8, // 7 pixels wide, 8 pixels tall
0x7f); // 7-bit values only
if (mach->sysfont == NULL) {
log_critical("Could not initialize apple2: bad font");
return NULL;
}
return mach;
}
@ -80,8 +90,6 @@ void
apple2_run_loop(apple2 *mach)
{
while (vm_screen_active(mach->screen)) {
vm_screen_set_color(mach->screen, 255, 0, 0, 255);
vm_screen_draw_rect(mach->screen, 50, 50, 20, 20);
vm_screen_refresh(mach->screen);
}
}

View File

@ -10,4 +10,7 @@ apple2_draw_pixel(apple2 *mach, vm_16bit addr)
void
apple2_draw_text(apple2 *mach, vm_16bit addr)
{
// Drawing text is a two-step process; first you need to wipe out
// the block on the screen at that point. Then you need to draw the
// text in over that.
}