Skip to content
Myr

Merge branch 'master' of https://github.com/eugeneopalev/stb into stb_h_fix

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parents c41629f, a5bbc93 · Browse files · 6 files+22 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+22 added−9 removed

  • other:+22 added−9 removed

6 files+22 added−9 removed

modified:docs/other_libs.md+1 added
modified:README.md+6 added-6 removed
5 unmodified lines
6single-file public domain libraries for C/C++ <a name="stb_libs"></a>78library | lastest version | category | LoC | description9--------------------- | ---- | -------- | --- | --------------------------------10**stb_vorbis.c** | 1.06 | audio | 5441 | decode ogg vorbis files from file/memory to float/16-bit signed output11**stb_image.h** | 2.08 | graphics | 6509 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC12**stb_truetype.h** | 1.08 | graphics | 3235 | parse, decode, and rasterize characters from truetype fonts13**stb_image_write.h** | 1.00 | graphics | 993 | image writing to disk: PNG, TGA, BMP10**stb_vorbis.c** | 1.07 | audio | 5462 | decode ogg vorbis files from file/memory to float/16-bit signed output11**stb_image.h** | 2.09 | graphics | 6610 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC12**stb_truetype.h** | 1.09 | graphics | 3246 | parse, decode, and rasterize characters from truetype fonts13**stb_image_write.h** | 1.01 | graphics | 1044 | image writing to disk: PNG, TGA, BMP14**stb_image_resize.h** | 0.90 | graphics | 2586 | resize images larger/smaller with good quality15**stb_rect_pack.h** | 0.08 | graphics | 572 | simple 2D rectangle packer with decent quality16**stretchy_buffer.h** | 1.02 | utility | 216 | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++17**stb_textedit.h** | 1.7 | user&nbsp;interface | 1301 | guts of a text editor for games etc implementing them from scratch
2 unmodified lines
20**stb_perlin.h** | 0.2 | 3D&nbsp;graphics | 182 | revised Perlin noise (3D input, 1D output)21**stb_easy_font.h** | 0.6 | 3D&nbsp;graphics | 232 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc22**stb_tilemap_editor.h** | 0.36 | game&nbsp;dev | 4127 | embeddable tilemap editor23**stb_herringbone_wa...** | 0.6 | game&nbsp;dev | 1220 | herringbone Wang tile map generator24**stb_c_lexer.h** | 0.06 | parsing | 815 | simplify writing parsers for C-like languages24**stb_c_lexer.h** | 0.07 | parsing | 816 | simplify writing parsers for C-like languages25**stb_divide.h** | 0.91 | math | 379 | more useful 32-bit modulus e.g. "euclidean divide"26**stb.h** | 2.25 | misc | 14136 | helper functions for C, mostly redundant in C++; basically author's personal stuff27**stb_leakcheck.h** | 0.2 | misc | 124 | quick-and-dirty malloc/free leak-checking2829Total libraries: 18 30Total lines of C code: 4644830Total lines of C code: 46633313233FAQ34---
97 unmodified lines
modified:stb_c_lexer.h+2 added-1 removed
1// stb_c_lexer.h - v0.06 - public domain Sean Barrett 20131// stb_c_lexer.h - v0.07 - public domain Sean Barrett 20132// lexer for making little C-like languages with recursive-descent parsers3//4// This file provides both the interface and the implementation.5// To instantiate the implementation,
3 unmodified lines
9// The default configuration is fairly close to a C lexer, although10// suffixes on integer constants are not handled (you can override this).11//12// History:13// 0.07 fix mishandling of hexadecimal constants parsed by strtol14// 0.06 fix missing next character after ending quote mark (Andreas Fredriksson)15// 0.05 refixed get_location because github version had lost the fix16// 0.04 fix octal parsing bug17// 0.03 added STB_C_LEX_DISCARD_PREPROCESSOR option
799 unmodified lines
modified:stb_tilemap_editor.h+2 added
326 unmodified lines
327#ifndef STB_TILEMAP_INCLUDE_STB_TILEMAP_EDITOR_H328#define STB_TILEMAP_INCLUDE_STB_TILEMAP_EDITOR_H329330#ifdef _WIN32331 #ifndef _CRT_SECURE_NO_WARNINGS332 #define _CRT_SECURE_NO_WARNINGS333 #endif334 #include <stdlib.h>335 #include <stdio.h>336#endif337
3792 unmodified lines
modified:stb_truetype.h+4 added-1 removed
48 unmodified lines
49// Ryan Gordon50//51// VERSION HISTORY52//53// 1.09 (????-??-??) warning fix; avoid crash on outofmem53// 1.09 (2016-01-16) warning fix; avoid crash on outofmem; use allocation userdata properly54// 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges55// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;56// variant PackFontRanges to pack and render in separate phases;57// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);
2463 unmodified lines
2521{2522 float scale;2523 int x,y,bottom_y, i;2524 stbtt_fontinfo f;2525 f.userdata = NULL;2526 if (!stbtt_InitFont(&f, data, offset))2527 return -1;2528 STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels2529 x=y=1;
456 unmodified lines
2986 rects = (stbrp_rect *) STBTT_malloc(sizeof(*rects) * n, spc->user_allocator_context);2987 if (rects == NULL)2988 return 0;29892990 info.userdata = spc->user_allocator_context;2991 stbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata,font_index));29922993 n = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects);2994
209 unmodified lines
320432053206// FULL VERSION HISTORY3207//3208// 1.09 (2016-01-16) warning fix; avoid crash on outofmem; use alloc userdata for PackFontRanges3209// 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges3210// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;3211// allow PackFontRanges to pack and render in separate phases;3212// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);
37 unmodified lines
modified:stb.h+7 added-1 removed
205 unmodified lines
206 #endif207#endif208209#ifdef _WIN32210 #ifndef _CRT_SECURE_NO_WARNINGS211 #define _CRT_SECURE_NO_WARNINGS212 #endif213 #ifndef _CRT_NONSTDC_NO_DEPRECATE214 #define _CRT_NONSTDC_NO_DEPRECATE215 #endif216 #ifndef _CRT_NON_CONFORMING_SWPRINTFS217 #define _CRT_NON_CONFORMING_SWPRINTFS218 #endif219 #if !defined(_MSC_VER) || _MSC_VER > 1700220 #include <intrin.h> // _BitScanReverse221 #endif222#endif
7606 unmodified lines
78297830void ** stb_ps_getlist(stb_ps *ps, int *count)7831{7832 int i,n=0;7827 void **p;7833 void **p = NULL;7834 switch (3 & (int) ps) {7835 case STB_ps_direct:7836 if (ps == NULL) { *count = 0; return NULL; }7837 p = (void **) malloc(sizeof(*p) * 1);
6343 unmodified lines