01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140
Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.
[Laughter]
| // Sample code showing how to create a modern OpenGL window and rendering context on Win32. | |
| #include <windows.h> | |
| #include <gl/gl.h> | |
| #include <stdbool.h> | |
| typedef HGLRC WINAPI wglCreateContextAttribsARB_type(HDC hdc, HGLRC hShareContext, | |
| const int *attribList); | |
| wglCreateContextAttribsARB_type *wglCreateContextAttribsARB; | 
| // To run: | |
| // clang core-audio-sine-wave.c -framework AudioUnit && ./a.out | |
| #include <AudioUnit/AudioUnit.h> | |
| #define SAMPLE_RATE 48000 | |
| #define TONE_FREQUENCY 440 | |
| #define M_TAU 2.0 * M_PI | |
| OSStatus RenderSineWave( | |
| void *inRefCon, | 
| // SAT collision check and resolution | |
| // Public domain | |
| // Usage example: | |
| // if (testCollision(obb1, obb2, mtv)) { // obb1, obb2 - sf::RectangleShape, mtv - sf::Vector2f | |
| // obb1.move(mtv); | |
| // } | |
| static const float NORMAL_TOLERANCE = 0.0001f; | |
| using RectVertexArray = std::array<sf::Vector2f, 4>; | 
| /** | |
| * @decorator | |
| * Attach events to DOM element | |
| * | |
| * @param {Element|Function} elemOrFunc: DOM Element, or a function returns element | |
| * @param {String} events: a list events separated with ',' | |
| * | |
| * Usage: | |
| * @attachEvents(window, 'click') | |
| * handleWindowClick(evt) { | 
| #include <iostream> | |
| #include <fstream> | |
| #include <vector> | |
| #include <string> | |
| #include <algorithm> | |
| #include <chrono> | |
| #include <functional> | |
| #define GLFW_INCLUDE_VULKAN | |
| #include <GLFW/glfw3.h> | 
Memory Optimization (Christer Ericson, GDC 2003)
http://realtimecollisiondetection.net/pubs/GDC03_Ericson_Memory_Optimization.ppt
Cache coherency primer (Fabian Giesen)
https://fgiesen.wordpress.com/2014/07/07/cache-coherency/
Code Clinic 2015: How to Write Code the Compiler Can Actually Optimize (Mike Acton)
http://gdcvault.com/play/1021866/Code-Clinic-2015-How-to
| // This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
| var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
| // Open (or create) the database | |
| var open = indexedDB.open("MyDatabase", 1); | |
| // Create the schema | |
| open.onupgradeneeded = function() { | |
| var db = open.result; | |
| var store = db.createObjectStore("MyObjectStore", {keyPath: "id"}); | 
GNU/LinuxIntelliJ IDEAAnt based.$JNIQtCreator (I'll mention the build steps inline).ndk-build should be available in $PATHjavah should be available in $PATH| // = Requirements: freetype 2.5, libpng, libicu, libz, libzip2 | |
| // = How to compile: | |
| // % export CXXFLAGS=`pkg-config --cflags freetype2 libpng` | |
| // % export LDFLAGS=`pkg-config --libs freetype2 libpng` | |
| // % clang++ -o clfontpng -static $(CXXFLAGS) clfontpng.cc $(LDFLAGS) \ | |
| // -licuuc -lz -lbz2 | |
| #include <cassert> | |
| #include <cctype> | |
| #include <iostream> | |
| #include <memory> |