Files
lity3d/Engine/Editor/bitmap_font.h
T
shuiyu1123 2d56cb3bc9 MiMoEngine ASM: x86-64 MASM汇编+C混合架构游戏引擎
核心热路径(数学/内存/字符串/性能分析)用MASM汇编(SSE/AVX2)
外围系统(窗口/渲染/ECS/音频/UI/脚本)用C语言
含自研编辑器、VisualScript积木编程、中文渲染(glyph_atlas)
2026-07-10 19:20:40 +08:00

41 lines
1.1 KiB
C

#pragma once
#include <d3d11.h>
#include <stdint.h>
#include "../Rendering/shader.h"
#define FONT_CHAR_W 8
#define FONT_CHAR_H 16
#define FONT_FIRST_CHAR 32
#define FONT_NUM_CHARS 96
#define FONT_MAX_QUADS 4096
typedef struct {
float pos[3];
float norm[3];
float uv[2];
float color[4];
} FontVert;
typedef struct {
ID3D11Texture2D* texture;
ID3D11ShaderResourceView* srv;
ID3D11Buffer* cb;
Shader* shader;
ID3D11BlendState* blend;
ID3D11SamplerState* sampler;
ID3D11DepthStencilState* ds_no_depth;
int atlas_w;
int atlas_h;
} BitmapFont;
int bitmap_font_init(BitmapFont* f, ID3D11Device* dev);
void bitmap_font_destroy(BitmapFont* f);
void bitmap_font_draw(BitmapFont* f, ID3D11DeviceContext* ctx,
const char* text, int x, int y,
float r, float g, float b, float a,
float screen_w, float screen_h);
void bitmap_font_rect(BitmapFont* f, ID3D11DeviceContext* ctx,
float x, float y, float w, float h,
float r, float g, float b, float a,
float screen_w, float screen_h);