36 lines
986 B
C
36 lines
986 B
C
#pragma once
|
|
#include <d3d11.h>
|
|
#include <stdint.h>
|
|
#include "../Rendering/shader.h"
|
|
#include "../Rendering/mesh.h"
|
|
|
|
#define ED2D_MAX_QUADS 8192
|
|
|
|
typedef struct {
|
|
float x, y, z;
|
|
float nx, ny, nz;
|
|
float u, v;
|
|
float r, g, b, a;
|
|
} Ed2DVert;
|
|
|
|
typedef struct {
|
|
Shader* shader;
|
|
ID3D11Buffer* vb;
|
|
ID3D11Buffer* ib;
|
|
ID3D11BlendState* blend;
|
|
ID3D11DepthStencilState* ds_no_depth;
|
|
ID3D11RenderTargetView* rtv;
|
|
Ed2DVert* verts;
|
|
int quad_count;
|
|
float screen_w;
|
|
float screen_h;
|
|
float wvp[16];
|
|
} Editor2D;
|
|
|
|
int editor2d_init(Editor2D* e, ID3D11Device* dev);
|
|
void editor2d_destroy(Editor2D* e);
|
|
void editor2d_begin(Editor2D* e, float sw, float sh);
|
|
void editor2d_rect(Editor2D* e, float x, float y, float w, float h, float r, float g, float b, float a);
|
|
void editor2d_rect_border(Editor2D* e, float x, float y, float w, float h, float r, float g, float b, float a, float thickness);
|
|
void editor2d_end(Editor2D* e, ID3D11DeviceContext* ctx);
|