Skip to content

Instantly share code, notes, and snippets.

# Script to generate cryptokitty images using assets from:
# https://github.com/BytesForBites/cryptokitty-designer
# NOTE: requires imagemagick built with --with-librsvg
require 'rubygems'
require 'rmagick'
require 'digest'
class KittyGen
require 'rubygems'
require 'rmagick'
require 'digest'
def build_cat(seed=nil)
srand(Digest::MD5.hexdigest(seed.to_s)[0...6].to_i(16)) if !seed.nil?
# throw the dice for body parts
parts = [
['body', rand(15)+1],
@jamesu
jamesu / torque_net_connection
Created December 5, 2016 23:56
Example connection class for Torque2D/Torque3D network code
// Example connection class for Torque2D/Torque3D network code
class ExampleNetConnection : public NetConnection
{
public:
typedef NetConnection Parent;
static const U32 CurrentProtocolVersion;
static const U32 MinRequiredProtocolVersion;
/// Configuration
#-----------------------------------------------------------------------------
# Test PBMS master client
# ( use with https://github.com/jamesu/PushButton-Master-Server )
#
# Copyright (C) 2016 James S Urquhart.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
@jamesu
jamesu / premake5.lua
Last active September 10, 2023 21:44
Torque3D premake build file. Generates a suitable project for T3D with premake.
-- premake5.lua
-- Project file creator for T3D
-- Usage: premake5 <toolchain>
-- (C)2016-2019 James S Urquhart. Feel free to use wherever.
--
-- Instructions:
-- * Copy Templates/Full to a folder in "My Projects"
-- * Change PROJECT_NAME to match this folder name
-- * Change WORKSPACE_NAME to your desired workspace name
@jamesu
jamesu / openvr.cs
Created June 14, 2016 23:13
Current openvr base code for Torque3D
// Only load these functions if an Oculus VR device is present
if(!isFunction(OpenVRIsCompiledIn))
return;
$Video::VREnabled = false;
function setupOpenVRActionMaps()
{
new ActionMap(VRCanvasMap);
@jamesu
jamesu / kaboom.cpp
Created May 2, 2016 10:15
A casual exploration of potential hash conflicts
// Don't ask
#include "core/crc.h"
struct GFXSamplerStateDesc2
{
GFXTextureAddressMode addressModeU;
GFXTextureAddressMode addressModeV;
GFXTextureAddressMode addressModeW;
@jamesu
jamesu / compileShape.cs
Created November 19, 2015 15:32
Tool to compile torque shapes
function onStart()
{
}
function onExit()
{
}
function parseArgs()
@jamesu
jamesu / ts_lua_convert_example.lua
Created August 24, 2015 11:39
TS Lua Conversion Example
// ********
TorqueScript code
// ********
$shit = 1;
$fudge = 2 + 2.3;
if ($fudge < 2) // TOFIX
{
@jamesu
jamesu / engineAPiTemplate.erb
Created November 9, 2014 21:08
Generates engineAPI.h for Torque3D
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//