This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var anim_hz = 30; | |
function AnimHandle(complete, callback) | |
{ | |
// No parameter ensures the handle represents a completed animation | |
this.Complete = complete == null ? true : complete; | |
this.Callback = callback; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// COMPILE-TIME SHADER ASSEMBLER | |
#ifndef _INCLUDED_ASSEMBLER_H | |
#define _INCLUDED_ASSEMBLER_H | |
#ifndef _INCLUDED_D3D_H | |
#include "D3D.h" | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// What I want | |
int x[8], y[8]; | |
x = y; | |
// What I have to do | |
struct Array | |
{ | |
int v[8]; | |
}; | |
Array x, y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create tables of simple types; don't try to replicate C++ entity structures in a DB as they don't map well. For example, a C++ structure like this: | |
struct Entity | |
{ | |
PositionComponent* position; | |
AIComponent* ai; | |
}; | |
Can be considered a "object-oriented database model" and is hard to extend. Generalising this in C++ a little, we get: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.sublimetext.com/docs/2/projects.html | |
"build_systems": | |
[ | |
{ | |
"cmd": "pib.bat", | |
"file_regex": "^\\s*(..[^\\(\n]*)\\(([0-9]+)\\)() : (.*)$", | |
"name": "PiB C++", | |
"path": "D:/dev/projects/PiB/Python", | |
"selector": "source.c++", | |
"working_dir": "D:/dev/projects/Star/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You write a structure with reflect attribute, like this: | |
clcpp_attr(reflect) | |
struct Person | |
{ | |
int id; | |
std::string name; | |
std::string email; | |
}; | |
// You modify it like this: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String DownloadRemoteFile(String source, String filename, String dest, boolean log_download) | |
{ | |
// Locate in the user's home directory | |
String remote_filename = source + filename; | |
String local_filename = m_HomeDirectory + "/" + dest + filename; | |
if (log_download) | |
m_Client.Log("Downloading: " + local_filename); | |
// Open a stream to the source file | |
InputStream input_stream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct BoxIterator | |
{ | |
BoxIterator(const math::boxi& range) | |
: range(range) | |
{ | |
// Clamp any negative deltas to zero before calculating volume | |
// Also add 1 to make the max inclusive | |
delta.x = max(range.max.x - range.min.x + 1, 0); | |
delta.y = max(range.max.y - range.min.y + 1, 0); | |
delta.z = max(range.max.z - range.min.z + 1, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"build_systems": | |
[ | |
{ | |
"cmd": "pib.bat", | |
"file_regex": "^\\s*(..[^\\(\n]*)\\(([0-9]+)\\)() : (.*)$", | |
"name": "PiB C++", | |
"path": "D:/dev/projects/PiB/Python", | |
"selector": "source.c++,source.c", | |
"working_dir": "D:/dev/projects/Star/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace simd | |
{ | |
typedef __m128i v128i; | |
typedef __m128d v128d; | |
typedef __m128 v128f; | |
enum VectorSelect | |
{ |
OlderNewer