pete286/slide.c
Jeremy Penner 64d421429e Presentation slides with demo
move sprites + tiles to far memory to free up space
2019-04-25 21:55:23 -04:00

83 lines
1.4 KiB
C
Executable file

#include <graphics.h>
#include "jorth.h"
static int bgi_on = 0;
void bgi_shutdown() {
if (bgi_on) {
closegraph();
bgi_on = 0;
}
}
void bgi_init() {
int driver = VGA;
int mode = VGAHI;
if (!bgi_on) {
initgraph(&driver, &mode, NULL);
bgi_on = 1;
}
}
void s_outtext() {
outtext(TOP().s);
DROP(1);
}
void s_justify() {
settextjustify(TOP().i, TOP_TEXT);
DROP(1);
}
void s_font() {
struct textsettingstype settings;
gettextsettings(&settings);
settextstyle(ST1().i, settings.direction, TOP().i);
DROP(2);
}
void s_direction() {
struct textsettingstype settings;
gettextsettings(&settings);
settextstyle(settings.font, TOP().i, settings.charsize);
DROP(1);
}
void s_moveto() {
moveto(ST1().i, TOP().i);
DROP(2);
}
void s_pos() {
PUSHI(getx());
PUSHI(gety());
}
void s_setcolor() {
setcolor(TOP().i);
DROP(1);
}
void s_setbgcolor() {
setbkcolor(TOP().i);
DROP(1);
}
void s_clear() {
cleardevice();
}
void slide_init() {
CDEF("bgi-on", bgi_init);
CDEF("bgi-off", bgi_shutdown);
CDEF("outtext", s_outtext);
CDEF("justify", s_justify);
CDEF("font", s_font);
CDEF("direction", s_direction);
CDEF("moveto", s_moveto);
CDEF("pos", s_pos);
CDEF("color!", s_setcolor);
CDEF("bg!", s_setbgcolor);
CDEF("wipe", s_clear);
atexit(bgi_shutdown);
}