Skip to content

Instantly share code, notes, and snippets.

@loganwm
loganwm / gist:6162885
Created August 6, 2013 08:58
Dirt simple NodeJS/Express sample
var express = require("express");
var app = express();
app.configure(function()
{
app.use(express.compress());
app.use(express.bodyParser());
app.use("/", express.static(__dirname + "/public/", {maxAge: 86400000}));
});
while(1)
{
calculateDT
disaptch inbound packets (you don't pass DT here, instead, this should have a reference to your gamestate object)
update accordingly (pass DT HERE)
render
}
@loganwm
loganwm / gist:5695033
Last active December 18, 2015 00:09
Kayne, this is an example of delta_time in C++11
#include <iostream>
#include <chrono>
#include <thread>
#include <cmath>
#define TIME_WASTE_MAGIC_NUMBER 5000000
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using std::chrono::monotonic_clock;
@loganwm
loganwm / Asset format
Created March 13, 2013 08:59
basic engine asset format markup
<Texture2D name="optional name" description="optional description">
<ImageData encoding="base64" format="rgba" bpp="8">
[base64 encoded data here]
</ImageData>
<TextureAttribute>blah blah blah filtering modes and shit</TextureAttribute>
</Texture2D>
<Asset name="optional name" description="optional description">
<AssetAttribute>some shit</AssetAttribute>
<Texture2D src="file containing texture xml decl"/>
for (int face = 0; face < scene->mMeshes[0]->mNumFaces; face++)
{
glBegin(GL_TRIANGLES);
/* iterate through face indicies */
for (int face = 0; face < scene->mMeshes[0]->mNumFaces; face++)
{
glVertex3f((scene->mMeshes[0]->mVertices[[scene->mMeshes[0]->mFaces[face]->mIndicies[0]]).x,(scene->mMeshes[0]->mVertices[[scene->mMeshes[0]->mFaces[face]->mIndicies[0]]).y,(scene->mMeshes[0]->mVertices[[scene->mMeshes[0]->mFaces[face]->mIndicies[0]]).z);
glVertex3f((scene->mMeshes[0]->mVertices[[scene->mMeshes[0]->mFaces[face]->mIndicies[1]]).x,(scene->mMeshes[0]->mVertices[[scene->mMeshes[0]->mFaces[face]->mIndicies[1]]).y,(scene->mMeshes[0]->mVertices[[scene->mMeshes[1]->mFaces[face]->mIndicies[0]]).z);
glVertex3f((scene->mMeshes[0]->mVertices[[scene->mMeshes[0]->mFaces[face]->mIndicies[2]]).x,(scene->mMeshes[0]->mVertices[[scene->mMeshes[0]->mFaces[face]->mIndicies[2]]).y,(scene->mMeshes[0]->mVertices[[scene->mMeshes[2]->mFaces[face]->mIndicies[0]]).z);