From 2cf2d7441bcd1632316ae42e1d0a6a8776144f15 Mon Sep 17 00:00:00 2001 From: Fierelier Date: Thu, 10 Aug 2023 01:58:46 +0200 Subject: [PATCH] Add engine_rendertarget_fill --- src/helpers.c | 14 +++++++++++++- src/values/functions.toml | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/helpers.c b/src/helpers.c index 952e682..f6a58cb 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -2,6 +2,18 @@ struct ENGINE_TEXTURE * engine_rendertarget_get() { return engine_rendertarget; } +void engine_rendertarget_fill(int sx,int sy,int ex,int ey) { + int y = sy; + while (y < ey) { + int x = sx; + while (x < ex) { + engine_rendertarget_draw_point(x,y); + x += 1; + } + y += 1; + } +} + void engine_rendertarget_draw_texture(struct ENGINE_TEXTURE * texture,int x,int y) { int sx = 0; if (x < 0) { @@ -59,4 +71,4 @@ void engine_rendertarget_draw_file(char * fpath) { x = 0; y += 1; } -} \ No newline at end of file +} diff --git a/src/values/functions.toml b/src/values/functions.toml index 04d8ec5..0ed4b49 100644 --- a/src/values/functions.toml +++ b/src/values/functions.toml @@ -71,6 +71,12 @@ arguments = ["int","int"] argNames = ["x", "y"] description = "Draw a pixel." +[engine_rendertarget_fill] +type = "void" +arguments = ["int","int","int","int"] +argNames = ["sx", "sy", "ex", "ey"] +description = "Fill the rendertarget from sx,sy to ex,ey." + [engine_rendertarget_draw_texture] type = "void" arguments = ["struct ENGINE_TEXTURE *","int","int"]