diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-11-08 15:03:14 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-11-08 15:03:14 -0800 |
commit | 8dea34598a6eb427f06ec1cfac4ef9435dfd9911 (patch) | |
tree | 7cc2f75b98e14d7cce0a6e82584dece0d91c88e6 /src/ansr-tex.h | |
parent | e11c6361ee49a6ef5cfd29bbd3a8ac336a992337 (diff) |
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.
Diffstat (limited to 'src/ansr-tex.h')
-rw-r--r-- | src/ansr-tex.h | 26 |
1 files changed, 26 insertions, 0 deletions
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 - <vcaputo@pengaru.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#ifndef _ANSR_TEX_H +#define _ANSR_TEX_H + +#include <stddef.h> /* 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 |