核心热路径(数学/内存/字符串/性能分析)用MASM汇编(SSE/AVX2) 外围系统(窗口/渲染/ECS/音频/UI/脚本)用C语言 含自研编辑器、VisualScript积木编程、中文渲染(glyph_atlas)
29 lines
795 B
C
29 lines
795 B
C
#pragma once
|
|
#include <d3d11.h>
|
|
#include <stdint.h>
|
|
|
|
#define GLYPH_CELL_W 32
|
|
#define GLYPH_CELL_H 32
|
|
#define GLYPH_ATLAS_COLS 16
|
|
#define GLYPH_ATLAS_ROWS 16
|
|
#define GLYPH_ATLAS_SIZE (GLYPH_ATLAS_COLS * GLYPH_CELL_W)
|
|
|
|
typedef struct {
|
|
ID3D11Texture2D* texture;
|
|
ID3D11ShaderResourceView* srv;
|
|
int atlas_w;
|
|
int atlas_h;
|
|
int next_x;
|
|
int next_y;
|
|
int cell_w;
|
|
int cell_h;
|
|
float u_scale;
|
|
float v_scale;
|
|
} GlyphAtlas;
|
|
|
|
int glyph_atlas_init(GlyphAtlas* ga, ID3D11Device* dev);
|
|
void glyph_atlas_destroy(GlyphAtlas* ga);
|
|
int glyph_atlas_get_or_create(GlyphAtlas* ga, ID3D11Device* dev, ID3D11DeviceContext* ctx, wchar_t ch,
|
|
float* u0, float* v0, float* u1, float* v1,
|
|
float* advance_x, float* advance_y);
|