From 8dea34598a6eb427f06ec1cfac4ef9435dfd9911 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 8 Nov 2022 15:03:14 -0800 Subject: ansr-tex: add .ans->cp437->tex_t ability via libansr libansr is used to turn the ansi stream of bytes into an in-memory representation of the screen's character contents. From this in-memory representation (ansr_t) an RGBA pixel rendering is produced in the form of a uint32_t array. This is then uploaded to the GPU via the existing tex.[ch] api. The intention here is to replace all the compiled-in gfx/* RGBA buffers with runtime-loaded-and-rendered .and files read from the filesystem. This enables faster iteration on the art without involving recompilation, and smaller distribution of the builds. Nothing functionally changes with this commit yet. It's only introducing the functionality to the tree and adding it to the build. Subsequent commits will replace the various tex_new() callers in the various -node.c listings with ansr_tex_new() equivalents. Afterwards all of the headers in gfx/ will be removed in favor of .ans assets. One additional detail is there's now going to be a concept of mask.ans files for controlling the alpha, since .ans alone doesn't really suffice here. Some ansi editors use methods like space-padding from the left to place the actual content, and there's no obvious way to differentiate those space pads from desired opaque background color cells vs. just transparent locators. So a separate mask.ans is supported where every non-black pixel of the mask.ans will be opaque, and every black pixel transparent, in the final tex_t output. --- src/ansr-tex.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/ansr-tex.h (limited to 'src/ansr-tex.h') diff --git a/src/ansr-tex.h b/src/ansr-tex.h new file mode 100644 index 0000000..4d7eec8 --- /dev/null +++ b/src/ansr-tex.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2022 - Vito Caputo - + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _ANSR_TEX_H +#define _ANSR_TEX_H + +#include /* mask_path may be NULL and plenty of listings using this practically only include this */ + +typedef struct tex_t tex_t; + +tex_t * ansr_tex_new(const char *path, const char *mask_path); + +#endif -- cgit v1.2.3