replace dbegin/dend w/ dblock

This commit is contained in:
KikooDX 2021-11-18 01:15:26 +01:00
parent 738830d453
commit 6c74e6e91c
2 changed files with 11 additions and 17 deletions

View File

@ -3,8 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
static fe_Object *f_dbegin(fe_Context *ctx, fe_Object *arg);
static fe_Object *f_dend(fe_Context *ctx, fe_Object *arg);
static fe_Object *f_dblock(fe_Context *ctx, fe_Object *arg);
static fe_Object *f_dcolor(fe_Context *ctx, fe_Object *arg);
static fe_Object *f_dclear(fe_Context *ctx, fe_Object *arg);
static fe_Object *f_drect(fe_Context *ctx, fe_Object *arg);
@ -25,8 +24,7 @@ main(void)
rDisplayInit();
SetTargetFPS(30);
fe_set(ctx, fe_symbol(ctx, "dbegin"), fe_cfunc(ctx, f_dbegin));
fe_set(ctx, fe_symbol(ctx, "dend"), fe_cfunc(ctx, f_dend));
fe_set(ctx, fe_symbol(ctx, "dblock"), fe_cfunc(ctx, f_dblock));
fe_set(ctx, fe_symbol(ctx, "dcolor"), fe_cfunc(ctx, f_dcolor));
fe_set(ctx, fe_symbol(ctx, "dclear"), fe_cfunc(ctx, f_dclear));
fe_set(ctx, fe_symbol(ctx, "drect"), fe_cfunc(ctx, f_drect));
@ -55,15 +53,11 @@ main(void)
}
static fe_Object *
f_dbegin(fe_Context *ctx, fe_Object *arg)
f_dblock(fe_Context *ctx, fe_Object *arg)
{
rDrawBegin();
return NULL;
}
static fe_Object *
f_dend(fe_Context *ctx, fe_Object *arg)
{
while (fe_nextarg(ctx, &arg))
;
rDrawEnd();
return NULL;
}

12
test.fe
View File

@ -2,10 +2,10 @@
(while (< y 224)
(= x (+ x 1))
(= y (+ y 1))
(dbegin)
(dcolor 0 0 0)
(dclear)
(dcolor 31 31 31)
(drect x y 16 16)
(dend)
(dblock
(dcolor 0 0 0)
(dclear)
(dcolor 31 31 31)
(drect x y 16 16)
)
)