Skip to content

Commit

Permalink
add stb_truetype to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
xtreme8000 committed May 17, 2018
1 parent e844770 commit de0365b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
24 changes: 13 additions & 11 deletions README.md
Expand Up @@ -30,17 +30,18 @@ You can either:

These libraries and files are needed:

| Name | License | Usage | Github |
| ----------- | --------------- | --------------------- | :-----------------------------------------------: |
| GLFW3 | *ZLib* | OpenGL context | [Link](https://github.com/glfw/glfw) |
| OpenAL soft | *LGPL-2.1* | 3D Sound env | [Link](https://github.com/kcat/openal-soft) |
| dr_wav | *Public domain* | wav support | [Link](https://github.com/mackron/dr_libs/) |
| LodePNG | *MIT* | png support | [Link](https://github.com/lvandeve/lodepng) |
| libdeflate | *MIT* | decompression of maps | [Link](https://github.com/ebiggers/libdeflate) |
| enet | *MIT* | networking library | [Link](https://github.com/lsalzman/enet) |
| inih | *BSD-3.Clause* | .INI file parser | [Link](https://github.com/benhoyt/inih) |
| http | *Public domain* | http client library | [Link](https://github.com/mattiasgustavsson/libs) |
| parson | *MIT* | JSON parser | [Link](https://github.com/kgabis/parson) |
| Name | License | Usage | GitHub |
| ------------ | --------------- | ---------------------- | :-----------------------------------------------: |
| GLFW3 | *ZLib* | OpenGL context | [Link](https://github.com/glfw/glfw) |
| OpenAL soft | *LGPL-2.1* | 3D Sound env | [Link](https://github.com/kcat/openal-soft) |
| inih | *BSD-3.Clause* | .INI file parser | [Link](https://github.com/benhoyt/inih) |
| stb_truetype | *Public domain* | TrueType font renderer | [Link](https://github.com/nothings/stb) |
| dr_wav | *Public domain* | wav support | [Link](https://github.com/mackron/dr_libs/) |
| http | *Public domain* | http client library | [Link](https://github.com/mattiasgustavsson/libs) |
| LodePNG | *MIT* | png support | [Link](https://github.com/lvandeve/lodepng) |
| libdeflate | *MIT* | decompression of maps | [Link](https://github.com/ebiggers/libdeflate) |
| enet | *MIT* | networking library | [Link](https://github.com/lsalzman/enet) |
| parson | *MIT* | JSON parser | [Link](https://github.com/kgabis/parson) |

You will need to compile the following by yourself, or get hold of precompiled binaries:

Expand All @@ -63,6 +64,7 @@ This means:
| `ini.c` and `ini.h` | → | `src/ini.c` and `src/ini.h` |
| `parson.c` and `parson.h` | → | `src/parson.c` and `src/parson.h` |
| `http.h` | → | `src/http.h` |
| `stb_truetype.h` | → | `src/stb_truetype.h` |

Because state of copyright of 0.75 assets is unknown, you will need to get them *[here](http://aos.party/bsresources.zip)*. Unzip the file and extract all contents to `resources/` manually.

Expand Down
18 changes: 9 additions & 9 deletions src/font.c
Expand Up @@ -148,17 +148,17 @@ void font_render(float x, float y, float h, char* text) {
if(*text>31) {
stbtt_aligned_quad q;
stbtt_GetBakedQuad(font->cdata,font->w,font->h,*text-31,&x,&y2,&q,1);
font_coords_buffer[k+0] = q.s0*4096.0F;
font_coords_buffer[k+1] = q.t1*4096.0F;
font_coords_buffer[k+0] = q.s0*8192.0F;
font_coords_buffer[k+1] = q.t1*8192.0F;

font_coords_buffer[k+2] = q.s1*4096.0F;
font_coords_buffer[k+3] = q.t1*4096.0F;
font_coords_buffer[k+2] = q.s1*8192.0F;
font_coords_buffer[k+3] = q.t1*8192.0F;

font_coords_buffer[k+4] = q.s1*4096.0F;
font_coords_buffer[k+5] = q.t0*4096.0F;
font_coords_buffer[k+4] = q.s1*8192.0F;
font_coords_buffer[k+5] = q.t0*8192.0F;

font_coords_buffer[k+6] = q.s0*4096.0F;
font_coords_buffer[k+7] = q.t0*4096.0F;
font_coords_buffer[k+6] = q.s0*8192.0F;
font_coords_buffer[k+7] = q.t0*8192.0F;

font_vertex_buffer[k+0] = q.x0;
font_vertex_buffer[k+1] = -q.y1+y;
Expand All @@ -180,7 +180,7 @@ void font_render(float x, float y, float h, char* text) {

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(1.0F/4096.0F,1.0F/4096.0F,1.0F);
glScalef(1.0F/8192.0F,1.0F/8192.0F,1.0F);
glMatrixMode(GL_MODELVIEW);

glEnable(GL_TEXTURE_2D);
Expand Down

0 comments on commit de0365b

Please sign in to comment.