核心热路径(数学/内存/字符串/性能分析)用MASM汇编(SSE/AVX2) 外围系统(窗口/渲染/ECS/音频/UI/脚本)用C语言 含自研编辑器、VisualScript积木编程、中文渲染(glyph_atlas)
42 lines
1.4 KiB
C
42 lines
1.4 KiB
C
#pragma once
|
|
#include "../Rendering/camera.h"
|
|
#include "../Rendering/shader.h"
|
|
#include "../Rendering/mesh.h"
|
|
#include "../Rendering/graphics_device.h"
|
|
#include "../ASM/math_c_fallback.h"
|
|
|
|
#define UI_MAX_QUADS 8192
|
|
|
|
typedef struct {
|
|
Camera camera;
|
|
Shader* shader;
|
|
ID3D11Buffer* vb;
|
|
ID3D11Buffer* ib;
|
|
ID3D11Buffer* text_vb;
|
|
ID3D11Buffer* text_ib;
|
|
ID3D11RasterizerState* rstate;
|
|
ID3D11DepthStencilState* ds_state;
|
|
ID3D11VertexShader* text_vs;
|
|
ID3D11PixelShader* text_ps;
|
|
ID3D11InputLayout* text_layout;
|
|
ID3D11BlendState* text_blend;
|
|
ID3D11SamplerState* text_sampler;
|
|
float screen_w;
|
|
float screen_h;
|
|
float z_plane;
|
|
} UILayer;
|
|
|
|
int uilayer_init(UILayer* u, ID3D11Device* dev, float screen_w, float screen_h);
|
|
void uilayer_destroy(UILayer* u);
|
|
void uilayer_begin(UILayer* u);
|
|
void uilayer_rect(UILayer* u,
|
|
float x, float y, float w, float h,
|
|
float r, float g, float b, float a);
|
|
void uilayer_textured_rect(UILayer* u, ID3D11DeviceContext* ctx,
|
|
ID3D11ShaderResourceView* srv,
|
|
float x, float y, float w, float h,
|
|
float u0, float v0, float u1, float v1,
|
|
float r, float g, float b, float a);
|
|
void uilayer_flush(UILayer* u, ID3D11DeviceContext* ctx);
|
|
void uilayer_flush_text(UILayer* u, ID3D11DeviceContext* ctx);
|