Merge branch 'master' of https://github.com/nothings/stb into num-fonts

This commit is contained in:
Christopher Hansen 2016-12-19 18:33:49 -07:00
commit 99fd236287
12 changed files with 2775 additions and 278 deletions

View File

@ -5,14 +5,19 @@ stb
single-file public domain libraries for C/C++ <a name="stb_libs"></a>
Most libraries by stb, except: stb_dxt by Fabian "ryg" Giesen, stb_image_resize
by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.
library | lastest version | category | LoC | description
--------------------- | ---- | -------- | --- | --------------------------------
**[stb_vorbis.c](stb_vorbis.c)** | 1.09 | audio | 5399 | decode ogg vorbis files from file/memory to float/16-bit signed output
**[stb_image.h](stb_image.h)** | 2.12 | graphics | 6755 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
**[stb_image.h](stb_image.h)** | 2.13 | graphics | 7099 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
**[stb_truetype.h](stb_truetype.h)** | 1.12 | graphics | 3287 | parse, decode, and rasterize characters from truetype fonts
**[stb_image_write.h](stb_image_write.h)** | 1.02 | graphics | 1048 | image writing to disk: PNG, TGA, BMP
**[stb_image_resize.h](stb_image_resize.h)** | 0.91 | graphics | 2578 | resize images larger/smaller with good quality
**[stb_rect_pack.h](stb_rect_pack.h)** | 0.10 | graphics | 583 | simple 2D rectangle packer with decent quality
**[stb_sprintf.h](stb_sprintf.h)** | 1.01 | utility | 1064 | fast sprintf, snprintf for C/C++
**[stretchy_buffer.h](stretchy_buffer.h)** | 1.02 | utility | 216 | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
**[stb_textedit.h](stb_textedit.h)** | 1.10 | user&nbsp;interface | 1330 | guts of a text editor for games etc implementing them from scratch
**[stb_voxel_render.h](stb_voxel_render.h)** | 0.84 | 3D&nbsp;graphics | 3752 | Minecraft-esque voxel rendering "engine" with many more features
@ -24,11 +29,11 @@ library | lastest version | category | LoC | description
**[stb_c_lexer.h](stb_c_lexer.h)** | 0.07 | parsing | 816 | simplify writing parsers for C-like languages
**[stb_divide.h](stb_divide.h)** | 0.91 | math | 379 | more useful 32-bit modulus e.g. "euclidean divide"
**[stb_connected_comp...](stb_connected_components.h)** | 0.95 | misc | 1006 | incrementally compute reachability on grids
**[stb.h](stb.h)** | 2.28 | misc | 14276 | helper functions for C, mostly redundant in C++; basically author's personal stuff
**[stb.h](stb.h)** | 2.28 | misc | 14277 | helper functions for C, mostly redundant in C++; basically author's personal stuff
**[stb_leakcheck.h](stb_leakcheck.h)** | 0.2 | misc | 124 | quick-and-dirty malloc/free leak-checking
Total libraries: 19
Total lines of C code: 47970
Total libraries: 20
Total lines of C code: 49379
FAQ

1055
deprecated/rrsprintf.h Normal file

File diff suppressed because it is too large Load Diff

1
stb.h
View File

@ -730,6 +730,7 @@ STB_EXTERN int stb_snprintf(char *s, size_t n, const char *fmt, ...);
STB_EXTERN int stb_vsnprintf(char *s, size_t n, const char *fmt, va_list v);
#ifdef STB_DEFINE
int stb_vsnprintf(char *s, size_t n, const char *fmt, va_list v)
{
int res;

File diff suppressed because it is too large Load Diff

1064
stb_sprintf.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -143,6 +143,8 @@ void end_timer(void)
printf("%6.4lf ms: %s\n", tm * 1000, message);
}
extern void quicktest(void);
int loc[5000][2];
int main(int argc, char **argv)
{
@ -152,6 +154,7 @@ int main(int argc, char **argv)
uint8 *map = stbi_load("data/map_03.png", &w, &h, 0, 1);
assert(map);
quicktest();
for (j=0; j < h; ++j)
for (i=0; i < w; ++i)

View File

@ -90,10 +90,6 @@ SOURCE=.\grid_reachability.c
# End Source File
# Begin Source File
SOURCE=..\docs\other_libs.md
# End Source File
# Begin Source File
SOURCE=.\stb.c
# End Source File
# Begin Source File
@ -158,6 +154,10 @@ SOURCE=..\stb_rect_pack.h
# End Source File
# Begin Source File
SOURCE=..\stb_sprintf.h
# End Source File
# Begin Source File
SOURCE=..\stb_textedit.h
# End Source File
# Begin Source File

View File

@ -1,3 +1,7 @@
#include "stb_sprintf.h"
#define STB_SPRINTF_IMPLEMENTATION
#include "stb_sprintf.h"
#define STB_PERLIN_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#define STB_DXT_IMPLEMENATION
@ -28,3 +32,11 @@
#define STBTE_DRAW_TILE(x,y,id,highlight,data) 0
#define STB_TILEMAP_EDITOR_IMPLEMENTATION
#include "stb_tilemap_editor.h"
int quicktest(void)
{
char buffer[999];
stbsp_sprintf(buffer, "test%%test");
return 0;
}

View File

@ -1,3 +1,7 @@
#include "stb_sprintf.h"
#define STB_SPRINTF_IMPLEMENTATION
#include "stb_sprintf.h"
#define STB_TRUETYPE_IMPLEMENTATION
#define STB_PERLIN_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION

View File

@ -1,3 +1,7 @@
#define STB_IMAGE_STATIC
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_VORBIS_HEADER_ONLY
#include "stb_vorbis.c"
#include "stb.h"

View File

@ -3,5 +3,9 @@ stb
single-file public domain libraries for C/C++ <a name="stb_libs"></a>
Most libraries by stb, except: stb_dxt by Fabian "ryg" Giesen, stb_image_resize
by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.
library | lastest version | category | LoC | description
--------------------- | ---- | -------- | --- | --------------------------------

View File

@ -4,6 +4,7 @@ stb_truetype.h | graphics | parse, decode, and rasterize ch
stb_image_write.h | graphics | image writing to disk: PNG, TGA, BMP
stb_image_resize.h | graphics | resize images larger/smaller with good quality
stb_rect_pack.h | graphics | simple 2D rectangle packer with decent quality
stb_sprintf.h | utility | fast sprintf, snprintf for C/C++
stretchy_buffer.h | utility | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
stb_textedit.h | user interface | guts of a text editor for games etc implementing them from scratch
stb_voxel_render.h | 3D graphics | Minecraft-esque voxel rendering "engine" with many more features