commit
7ed3bb26bb
16 changed files with 255 additions and 19 deletions
@ -0,0 +1,11 @@ |
|||||||
|
git checkout working |
||||||
|
-- do work |
||||||
|
git add ... |
||||||
|
git commit |
||||||
|
|
||||||
|
to upload: |
||||||
|
|
||||||
|
git checkout master |
||||||
|
git pull ; usually unnecessary |
||||||
|
git merge working |
||||||
|
git push |
@ -0,0 +1,65 @@ |
|||||||
|
|
||||||
|
FAQ |
||||||
|
--- |
||||||
|
|
||||||
|
#### What's the license? |
||||||
|
|
||||||
|
These libraries are in the public domain (or the equivalent where that is not |
||||||
|
possible). You can do anything you want with them. You have no legal obligation |
||||||
|
to do anything else, although I appreciate attribution. |
||||||
|
|
||||||
|
#### If I wrap an stb library in a new library, does the new library have to be public domain? |
||||||
|
|
||||||
|
No. |
||||||
|
|
||||||
|
#### A lot of these libraries seem redundant to existing open source libraries. Are they better somehow? |
||||||
|
|
||||||
|
Generally they're only better in that they're easier to integrate, |
||||||
|
easier to use, and easier to release (single file; good API; no |
||||||
|
attribution requirement). They may be less featureful, slower, |
||||||
|
and/or use more memory. If you're already using an equivalent |
||||||
|
library, there's probably no good reason to switch. |
||||||
|
|
||||||
|
#### Why "stb"? Is this something to do with Set-Top Boxes? |
||||||
|
|
||||||
|
No, they are just the initials for my name, Sean T. Barrett. |
||||||
|
This was not chosen out of egomania, but as a semi-robust |
||||||
|
way of namespacing the filenames and source function names. |
||||||
|
|
||||||
|
#### Will you add more image types to stb_image.c? |
||||||
|
|
||||||
|
If people submit them, I generally add them, but the goal of stb_image |
||||||
|
is less for applications like image viewer apps (which need to support |
||||||
|
every type of image under the sun) and more for things like games which |
||||||
|
can choose what images to use, so I may decline to add them if they're |
||||||
|
too rare or if the size of implementation vs. apparent benefit is too low. |
||||||
|
|
||||||
|
#### Are there other single-file public-domain libraries out there? |
||||||
|
|
||||||
|
Yes. I'll put a list here when people remind me what they are. |
||||||
|
|
||||||
|
#### Do you have any advice on how to create my own single-file library? |
||||||
|
|
||||||
|
Yes. https://github.com/nothings/stb/blob/master/docs/stb_howto.txt |
||||||
|
|
||||||
|
#### Why public domain? |
||||||
|
|
||||||
|
Because more people will use it. Because it's not viral, people |
||||||
|
are not obligated to give back, so you could argue that it hurts |
||||||
|
the *development* of it, and then because it doesn't develop as |
||||||
|
well it's not as good, and then because it's not as good, in the |
||||||
|
long run maybe fewer people will use it. I have total respect for |
||||||
|
that opinion, but I just don't believe it myself for most software. |
||||||
|
|
||||||
|
#### Why C? |
||||||
|
|
||||||
|
Primarily, because I use C, not C++. But it does also make it easier |
||||||
|
for other people to use them from other languages. |
||||||
|
|
||||||
|
#### Why not C99? stdint.h, declare-anywhere, etc. |
||||||
|
|
||||||
|
I still use MSVC 6 (1998) as my IDE because it has better human factors |
||||||
|
for me than later versions of MSVC. |
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,7 @@ |
|||||||
|
stb |
||||||
|
=== |
||||||
|
|
||||||
|
single-file public domain libraries for C/C++ |
||||||
|
|
||||||
|
library | lastest version | category | description |
||||||
|
--------------------- | ---- | -------- | -------------------------------- |
@ -0,0 +1,10 @@ |
|||||||
|
stb_vorbis.c | audio | decode ogg vorbis files from file/memory to float/16-bit signed output |
||||||
|
stb_image.c | graphics | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC |
||||||
|
stb_truetype.h | graphics | parse, decode, and rasterize characters from truetype fonts |
||||||
|
stb_image_write.h | graphics | image writing to disk: PNG, TGA, BMP |
||||||
|
stb_textedit.h | UI | guts of a text editor for games etc implementing them from scratch |
||||||
|
stb_dxt.h | 3D graphics | Fabian "ryg" Giesen's real-time DXT compressor |
||||||
|
stb_perlin.h | 3D graphics | revised Perlin noise (3D input, 1D output) |
||||||
|
stb_c_lexer.h | parsing | simplify writing parsers for C-like languages |
||||||
|
stb_divide.h | math | more useful 32-bit modulus e.g. "euclidean divide" |
||||||
|
stb.h | misc | helper functions for C, mostly redundant in C++; basically author's personal stuff |
@ -0,0 +1,45 @@ |
|||||||
|
#define STB_DEFINE |
||||||
|
#include "../stb.h" |
||||||
|
|
||||||
|
int main(int argc, char **argv) |
||||||
|
{ |
||||||
|
int i; |
||||||
|
int hlen, flen, listlen; |
||||||
|
char *header = stb_file("README.header.md", &hlen); |
||||||
|
char *footer = stb_file("README.footer.md", &flen); |
||||||
|
char **list = stb_stringfile("README.list", &listlen); |
||||||
|
|
||||||
|
FILE *f = fopen("../README.md", "wb"); |
||||||
|
fwrite(header, 1, hlen, f); |
||||||
|
|
||||||
|
for (i=0; i < listlen; ++i) { |
||||||
|
int num,j; |
||||||
|
char **tokens = stb_tokens_stripwhite(list[i], "|", &num); |
||||||
|
FILE *g = fopen(stb_sprintf("../%s", tokens[0]), "rb"); |
||||||
|
char buffer[256], *s1, *s2; |
||||||
|
fread(buffer, 1, 256, g); |
||||||
|
fclose(g); |
||||||
|
buffer[255] = 0; |
||||||
|
s1 = strchr(buffer, '-'); |
||||||
|
if (!s1) stb_fatal("Couldn't find '-' before version number in %s", tokens[0]); |
||||||
|
s2 = strchr(s1+2, '-'); |
||||||
|
if (!s2) stb_fatal("Couldn't find '-' after version number in %s", tokens[0]); |
||||||
|
*s2 = 0; |
||||||
|
s1 += 1; |
||||||
|
s1 = stb_trimwhite(s1); |
||||||
|
if (*s1 == 'v') ++s1; |
||||||
|
fprintf(f, "**%s** | %s", tokens[0], s1); |
||||||
|
s1 = stb_trimwhite(tokens[1]); |
||||||
|
s2 = stb_dupreplace(s1, " ", " "); |
||||||
|
fprintf(f, " | %s", s2); |
||||||
|
free(s2); |
||||||
|
for (j=2; j < num; ++j) |
||||||
|
fprintf(f, " | %s", tokens[j]); |
||||||
|
fprintf(f, "\n"); |
||||||
|
} |
||||||
|
|
||||||
|
fwrite(footer, 1, flen, f); |
||||||
|
fclose(f); |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,88 @@ |
|||||||
|
# Microsoft Developer Studio Project File - Name="make_readme" - Package Owner=<4> |
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00 |
||||||
|
# ** DO NOT EDIT ** |
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103 |
||||||
|
|
||||||
|
CFG=make_readme - Win32 Debug |
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE, |
||||||
|
!MESSAGE use the Export Makefile command and run |
||||||
|
!MESSAGE |
||||||
|
!MESSAGE NMAKE /f "make_readme.mak". |
||||||
|
!MESSAGE |
||||||
|
!MESSAGE You can specify a configuration when running NMAKE |
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example: |
||||||
|
!MESSAGE |
||||||
|
!MESSAGE NMAKE /f "make_readme.mak" CFG="make_readme - Win32 Debug" |
||||||
|
!MESSAGE |
||||||
|
!MESSAGE Possible choices for configuration are: |
||||||
|
!MESSAGE |
||||||
|
!MESSAGE "make_readme - Win32 Release" (based on "Win32 (x86) Console Application") |
||||||
|
!MESSAGE "make_readme - Win32 Debug" (based on "Win32 (x86) Console Application") |
||||||
|
!MESSAGE |
||||||
|
|
||||||
|
# Begin Project |
||||||
|
# PROP AllowPerConfigDependencies 0 |
||||||
|
# PROP Scc_ProjName "" |
||||||
|
# PROP Scc_LocalPath "" |
||||||
|
CPP=cl.exe |
||||||
|
RSC=rc.exe |
||||||
|
|
||||||
|
!IF "$(CFG)" == "make_readme - Win32 Release" |
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0 |
||||||
|
# PROP BASE Use_Debug_Libraries 0 |
||||||
|
# PROP BASE Output_Dir "Release" |
||||||
|
# PROP BASE Intermediate_Dir "Release" |
||||||
|
# PROP BASE Target_Dir "" |
||||||
|
# PROP Use_MFC 0 |
||||||
|
# PROP Use_Debug_Libraries 0 |
||||||
|
# PROP Output_Dir "Release" |
||||||
|
# PROP Intermediate_Dir "Release" |
||||||
|
# PROP Target_Dir "" |
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c |
||||||
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c |
||||||
|
# ADD BASE RSC /l 0x409 /d "NDEBUG" |
||||||
|
# ADD RSC /l 0x409 /d "NDEBUG" |
||||||
|
BSC32=bscmake.exe |
||||||
|
# ADD BASE BSC32 /nologo |
||||||
|
# ADD BSC32 /nologo |
||||||
|
LINK32=link.exe |
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "make_readme - Win32 Debug" |
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0 |
||||||
|
# PROP BASE Use_Debug_Libraries 1 |
||||||
|
# PROP BASE Output_Dir "Debug" |
||||||
|
# PROP BASE Intermediate_Dir "Debug" |
||||||
|
# PROP BASE Target_Dir "" |
||||||
|
# PROP Use_MFC 0 |
||||||
|
# PROP Use_Debug_Libraries 1 |
||||||
|
# PROP Output_Dir "Debug" |
||||||
|
# PROP Intermediate_Dir "Debug" |
||||||
|
# PROP Target_Dir "" |
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c |
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c |
||||||
|
# ADD BASE RSC /l 0x409 /d "_DEBUG" |
||||||
|
# ADD RSC /l 0x409 /d "_DEBUG" |
||||||
|
BSC32=bscmake.exe |
||||||
|
# ADD BASE BSC32 /nologo |
||||||
|
# ADD BSC32 /nologo |
||||||
|
LINK32=link.exe |
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
||||||
|
|
||||||
|
!ENDIF |
||||||
|
|
||||||
|
# Begin Target |
||||||
|
|
||||||
|
# Name "make_readme - Win32 Release" |
||||||
|
# Name "make_readme - Win32 Debug" |
||||||
|
# Begin Source File |
||||||
|
|
||||||
|
SOURCE=.\make_readme.c |
||||||
|
# End Source File |
||||||
|
# End Target |
||||||
|
# End Project |
@ -0,0 +1 @@ |
|||||||
|
debug\make_readme |
Loading…
Reference in New Issue