Skip to content

Instantly share code, notes, and snippets.

Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Could NOT find GME (missing: GME_LIBRARIES GME_INCLUDE_DIR)
Using internal zlib
Using internal jpeg library
Using internal bzip2 library
Using internal gme library
c:/app/gzdoom/zlib
c:/app/gzdoom/bzip2
One of the primary benefits of using a fixed-width
programming font is that things line up in columns
if they are the same length in characters. (Please
note that monospacing is not just for indentation;
indentation works fine with proportional fonts. It
is only once you have a non-blank character on the
line that proportional vs. monospace differ much.)
In my experience, lining code up so features align
vertically makes it a lot easier to avoid the bugs
#define GDRAW_GL_EXTENSION_LIST \
/* identifier import procname */ \
/* GL_ARB_multitexture */ \
GLE(ActiveTexture, "ActiveTextureARB", ACTIVETEXTUREARB) \
/* GL_ARB_texture_compression */ \
GLE(CompressedTexImage2D, "CompressedTexImage2DARB", COMPRESSEDTEXIMAGE2DARB) \
/* GL_ARB_vertex_buffer_object */ \
GLE(GenBuffers, "GenBuffersARB", GENBUFFERSARB) \
GLE(DeleteBuffers, "DeleteBuffersARB", DELETEBUFFERSARB) \
GLE(BindBuffer, "BindBufferARB", BINDBUFFERARB) \
@nothings
nothings / stb_vm excerpt 1
Created August 4, 2014 18:00
stb_vm excerpts
#define atom_array_ref_preshifted(arr,offset) ((svmatom *) (((uint8 *) (arr)) + (offset)))
#define atom_array_ref_naive(arr,offset) (&(arr)[offset])
#ifdef STB_VM_CONFIG_PRESHIFTED_BYTESTREAM_CPOOL
#define atom_cpool_ref atom_array_ref_preshifted
#else
#define atom_cpool_ref atom_array_ref_naive
#endif
#ifdef STB_VM_CONFIG_PRESHIFTED_BYTESTREAM_REG
//////////////////////////////////////////////////////////////////////////////
//
// Easy-to-use API:
//
// * "input pixels" points to an array of image data with 'num_channels' channels (e.g. RGB=3, RGBA=4)
// * input_w is input image width (x-axis), input_h is input image height (y-axis)
// * stride is the offset between successive rows of image data in memory, in bytes. you can
// specify 0 to mean packed continuously in memory
// * alpha channel is treated identically to other channels.
// * colorspace is linear or sRGB as specified by function name
@nothings
nothings / gist:8a082282552aef672631
Created September 27, 2014 18:50
stb_tilemap_editor GUI colors
// idle, over, down, over&down, selected, sel&over, disabled
static int stbte__color_table[STBTE__num_color_modes][STBTE__num_color_aspects][STBTE__num_color_states] =
{
{
{ 0x000000, 0x60d060, 0xc0ffc0, 0xc0ffc0, 0x40c040, 0x60d060, 0x505050, },
{ 0x40ff40, 0x80ff80, 0x80ff80, 0x80ff80, 0x80ff80, 0x80ff80, 0x606060, },
{ 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x909090, },
}, {
{ 0x808890, 0x606060, 0x606060, 0x606060, 0x606060, 0x606060, 0x606060, },
{ 0x605860, 0x606060, 0x606060, 0x606060, 0x606060, 0x606060, 0x606060, },
@nothings
nothings / gist:06ac1d8ea61635d09e0f
Created October 2, 2014 08:37
ryg on luajit string-tofloat
Thinking about this some more: the decimal expansion of the halfway point between two numbers is always going to be either
...xyz000000
or
...xyz500000
We don't want to deal with the 5s if we can avoid it. Say the longest decimal expansion of a binary float is N digits (it's somewhere around 770, haven't calculated it exactly). Then the halfway point is gonna be all zeros after N+1 decimal digits, guaranteed.
@nothings
nothings / gist:3aaf2586194265a3a622
Last active August 29, 2015 14:20
Concerning "Modeling Real-World Terrain with Exponentially Distributed Noise"
Concerning "Modeling Real-World Terrain with Exponentially Distributed Noise"
http://jcgt.org/published/0004/02/01/
Comments by Sean Barrett (sean at nothings dot org, @nothings on twitter)
Table of contents:
1. Proof of "mu" in section 3 loses a negation partway
through, thus giving an obviously nonsensical result.
JMP L1
MOV UP,DOWN
L1: JRO RIGHT
MOV UP,ACC
MOV ACC,RIGHT
MOV ACC,DOWN
JMP L1
MOV DOWN,UP
#### Are there other single-file public-domain libraries out there?
Yes. Here are some:
- [jo_gif.cpp](http://www.jonolick.com/home/gif-writer): tiny GIF writer (public domain)
- [gif.h](https://github.com/ginsweater/gif-h): animated GIF writer (public domain)
- [tiny_jpeg.h](https://github.com/serge-rgb/TinyJPEG/blob/master/tiny_jpeg.h): JPEG encoder (public domain)
- [lodepng](http://lodev.org/lodepng/): PNG encoder/decoder (zlib license)
- [nanoSVG](https://github.com/memononen/nanosvg): 1-file SVG parser; 1-file SVG rasterizer (zlib license)