taisei/src/stagetext.h

73 lines
2 KiB
C
Raw Permalink Normal View History

2017-09-12 03:28:15 +02:00
/*
* This software is licensed under the terms of the MIT License.
2017-09-12 03:28:15 +02:00
* See COPYING for further information.
* ---
2024-05-16 23:30:41 +02:00
* Copyright (c) 2011-2024, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2024, Andrei Alexeyev <akari@taisei-project.org>.
2017-09-12 03:28:15 +02:00
*/
#pragma once
#include "taisei.h"
#include "color.h"
#include "resource/font.h"
typedef struct StageText StageText;
typedef LIST_ANCHOR(StageText) StageTextList;
typedef void (*StageTextUpdateFunc)(StageText* txt, int t, float alpha);
typedef struct StageTextTable StageTextTable;
2019-04-07 00:55:13 +02:00
// NOTE: tweaked to consume all padding in StageText, assuming x86_64 ABI
#define STAGETEXT_BUF_SIZE 76
struct StageText {
2019-04-12 10:36:40 +02:00
LIST_INTERFACE(StageText);
Font *font;
cmplx pos;
2019-04-07 00:55:13 +02:00
struct {
StageTextUpdateFunc update;
2019-04-07 00:55:13 +02:00
void *data1;
void *data2;
} custom;
Color color;
2019-04-07 00:55:13 +02:00
Alignment align;
struct {
int spawn;
int life;
int fadein;
int fadeout;
} time;
2019-04-07 00:55:13 +02:00
char text[STAGETEXT_BUF_SIZE];
};
void stagetext_free(void);
void stagetext_update(void);
void stagetext_draw(void);
StageText *stagetext_add(const char *text, cmplx pos, Alignment align, Font *font, const Color *clr, int delay, int lifetime, int fadeintime, int fadeouttime);
StageText *stagetext_add_numeric(int n, cmplx pos, Alignment align, Font *font, const Color *clr, int delay, int lifetime, int fadeintime, int fadeouttime);
StageText *stagetext_list_head(void);
struct StageTextTable {
cmplx pos;
double width;
Color clr;
int lifetime;
int fadeintime;
int fadeouttime;
int delay;
ListContainer *elems;
};
Premultiplied alpha (#133) * WIP premultiplied alpha * WIP color API rework (doesn't build yet; lots of things left to convert) * convert everything remaining to new Color api except stage*_event.c files * convert the stages to new Color api. builds & runs now; still many rendering errors * fix the bullet shader for premultiplied alpha * fix masterspark, graphs and stage 1 fog clouds * fix marisa_b and most of spellcards * Add deprecation warnings for BLEND_ADD and PFLAG_DRAWADD * fix a segfault in stage 6 undo accidental earlier change * fix text_hud.frag.glsl * fix scuttle bg and remaining stage3 BLEND_ADDs * fix marisa laser opacity * hacky fix for myon The old implementation relied on alpha being stored inside p->color. In premul alpha this doesn’t work and functions like color_set_opacity can’t solve this i think. So I tried messing around with it until it looked somewhat similar. * fix marisa_b stars * remove color_set_opacity i overlooked * more plrmode blending changes * fixup additive blending in stage 1 * various premultiplied alpha fixups for bosses and enemies * stage 2 premul alpha fixups * stage 4 premul alpha fixups * stage 5 premul alpha fixups * stage 6 premul alpha fixups * make lasers also use the PMA blend mode * remove PFLAG_DRAWADD and PFLAG_DRAWSUB * fix remaining PMA issues in menus * lame extraspell bg workaround * fix item alpha * make marisaA lasers look somewhat like in master * fix marisaA bomb background fadeout * fixup various r_color4 calls * fix myon * remove dead code * fix use of BLEND_ADD in player death effect * fix myon shot trails (broken on master as well) * fix myon shot fade-in * extend the sprite shaders custom parameter to a vec4 * fix youmuB stuff and make it look somewhat better. the code looks even worse though.
2018-07-23 19:07:59 +02:00
void stagetext_begin_table(StageTextTable *tbl, const char *title, const Color *titleclr, const Color *clr, double width, int delay, int lifetime, int fadeintime, int fadeouttime);
void stagetext_end_table(StageTextTable *tbl);
void stagetext_table_add(StageTextTable *tbl, const char *title, const char *val);
void stagetext_table_add_numeric(StageTextTable *tbl, const char *title, int n);
2017-04-04 02:57:38 +02:00
void stagetext_table_add_numeric_nonzero(StageTextTable *tbl, const char *title, int n);
void stagetext_table_add_separator(StageTextTable *tbl);