Code-style consistency improvement:

Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
erwincoumans
2018-09-23 14:17:31 -07:00
parent b73b05e9fb
commit ab8f16961e
1773 changed files with 1081087 additions and 474249 deletions

View File

@@ -20,11 +20,9 @@
#ifndef FONTSTASH_H
#define FONTSTASH_H
#define MAX_ROWS 128
#define VERT_COUNT (16*128)
#define INDEX_COUNT (VERT_COUNT*2)
#define VERT_COUNT (16 * 128)
#define INDEX_COUNT (VERT_COUNT * 2)
struct vec2
{
@@ -38,34 +36,33 @@ struct vec2
struct vec4
{
vec4(float x,float y, float z, float w)
vec4(float x, float y, float z, float w)
{
p[0] = x;
p[1] = y;
p[2] = z;
p[3] = w;
}
float p[4];
};
typedef struct
{
vec4 position;
vec4 colour;
vec4 position;
vec4 colour;
vec2 uv;
} Vertex;
struct sth_quad
{
float x0,y0,s0,t0;
float x1,y1,s1,t1;
float x0, y0, s0, t0;
float x1, y1, s1, t1;
};
struct sth_row
{
short x,y,h;
short x, y, h;
};
struct sth_glyph
@@ -73,40 +70,37 @@ struct sth_glyph
unsigned int codepoint;
short size;
struct sth_texture* texture;
int x0_,y0,x1,y1;
float xadv,xoff,yoff;
int x0_, y0, x1, y1;
float xadv, xoff, yoff;
int next;
};
struct sth_texture
{
union
{
union {
void* m_userData;
int m_userId;
};
unsigned char* m_texels;
// TODO: replace rows with pointer
struct sth_row rows[MAX_ROWS];
int nrows;
int nverts;
Vertex newverts[VERT_COUNT];
struct sth_texture* next;
Vertex newverts[VERT_COUNT];
struct sth_texture* next;
};
struct RenderCallbacks
struct RenderCallbacks
{
virtual ~RenderCallbacks() {}
virtual void setColorRGBA(float color[4])=0;
virtual void setWorldPosition(float pos[3])=0;
virtual void setWorldOrientation(float orn[4])=0;
virtual void updateTexture(sth_texture* texture, sth_glyph* glyph, int textureWidth, int textureHeight)=0;
virtual void render(sth_texture* texture)=0;
virtual void setColorRGBA(float color[4]) = 0;
virtual void setWorldPosition(float pos[3]) = 0;
virtual void setWorldOrientation(float orn[4]) = 0;
virtual void updateTexture(sth_texture* texture, sth_glyph* glyph, int textureWidth, int textureHeight) = 0;
virtual void render(sth_texture* texture) = 0;
};
struct sth_stash* sth_create(int cachew, int cacheh, RenderCallbacks* callbacks);
@@ -124,30 +118,28 @@ void sth_begin_draw(struct sth_stash* stash);
void sth_end_draw(struct sth_stash* stash);
void sth_draw_texture(struct sth_stash* stash,
int idx, float size,
float x, float y,
int screenwidth, int screenheight,
const char* s, float* dx, float colorRGBA[4]);
int idx, float size,
float x, float y,
int screenwidth, int screenheight,
const char* s, float* dx, float colorRGBA[4]);
void sth_flush_draw(struct sth_stash* stash);
void sth_draw_text3D(struct sth_stash* stash,
int idx, float fontSize,
float x, float y, float z,
const char* s, float* dx, float textScale, float colorRGBA[4], int bla);
int idx, float fontSize,
float x, float y, float z,
const char* s, float* dx, float textScale, float colorRGBA[4], int bla);
void sth_draw_text(struct sth_stash* stash,
int idx, float size,
float x, float y, const char* string, float* dx, int screenwidth, int screenheight, int measureOnly, float retinaScale, float colorRGBA[4]);
inline void sth_draw_text(struct sth_stash* stash,
int idx, float size,
float x, float y, const char* string, float* dx, int screenwidth, int screenheight, int measureOnly=false, float retinaScale=1.)
int idx, float size,
float x, float y, const char* string, float* dx, int screenwidth, int screenheight, int measureOnly = false, float retinaScale = 1.)
{
float colorRGBA[4]={1,1,1,1};
sth_draw_text(stash,idx,size,x,y,string,dx,screenwidth,screenheight,measureOnly, retinaScale, colorRGBA);
float colorRGBA[4] = {1, 1, 1, 1};
sth_draw_text(stash, idx, size, x, y, string, dx, screenwidth, screenheight, measureOnly, retinaScale, colorRGBA);
}
void sth_dim_text(struct sth_stash* stash, int idx, float size, const char* string,
@@ -155,10 +147,8 @@ void sth_dim_text(struct sth_stash* stash, int idx, float size, const char* stri
void sth_vmetrics(struct sth_stash* stash,
int idx, float size,
float* ascender, float* descender, float * lineh);
float* ascender, float* descender, float* lineh);
void sth_delete(struct sth_stash* stash);
#endif // FONTSTASH_H
#endif // FONTSTASH_H