Skip to content

Instantly share code, notes, and snippets.

@beakr
beakr / scripting_in_dendrite_lua.md
Last active December 31, 2015 20:39
How Dendrite scripting should work.

Dendrite Lua Scripting: How it should work.

This is a simple page meant to be used for documentation-driven design in my Dendrite game engine. This is where I write some simple documentation and use it as a reference for implementing the code.

Linking

To link a script, select an entity in the game editor and click the 'link' dropdown button. Then click the menu item 'lua script'.

If you need to link a script to your scene, simply go to Game > World Settings or use command-shift-W (Mac) cntrl-shift-W (Windows/Linux) to attach a script to the current world.

// Load stdlibs onto lua interpreter instance.
luaL_openlibs(this->L);
int s = luaL_dofile(this->L, file.c_str());
if (s == 0)
{
// Execute the script.
s = lua_pcall(L, 0, LUA_MULTRET, 0);
}
@beakr
beakr / pixi-boilerplate.js
Created December 15, 2013 03:48
Pixi.js boilerplate.
function main()
{
// We render our game with WebGL or canvas depending on the browser automatically
// with Pixi.js in our game renderer variable.
//
// Our game is 400x400 pixels because it will be made of 25x25 tiles measuring 16x16
// pixels.
var gameRenderer = PIXI.autoDetectRenderer(400, 400);
document.body.appendChild(gameRenderer.view);
@beakr
beakr / Scripter.cc
Last active December 27, 2015 06:29
//
// librib -- fast, cross-platform game engine in Coffeescript
//
// Copyright (c) 2013 Christopher Clarke
// Please see attached LICENSE file for your distrobution.
//
#include "Scripter.hh"
#include <stdio.h>
#include <iostream>
@beakr
beakr / 0_reuse_code.js
Created October 22, 2013 21:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# If you screwed up and need to reconfigure a mail server or something,
# just use dpkg-reconfigure!
#
# Here's an example for reconfiguring postfix.
$ sudo dpkg-reconfigure postfix
@beakr
beakr / arm-compile.sh
Created August 22, 2013 01:50
Compile ARM assembly on Mac.
# This command takes iPhone's LLVM GCC and compiles ARMV6 assembly. E.g. my_assembly.s
$ /Developer/Platforms/iPhoneOS.platform/usr/bin/llvm-gcc-4.2 -arch armv6 -c ${YOUR_FILE}.s
-- Wat.
-- No clue if this works, just writing Haskell.
f x y = x + y -- Random function
let resultOfF = f 2 2 -- 4
let someList = [1, 2, 3]
let someListWithOtherThing = resultOfF:someList
addLists x y = x ++ y
@beakr
beakr / parens.js
Created July 2, 2013 18:21
Use as many as you want.
print((((((((2 + 2))))))));
console.log(((8 + 2)));
@beakr
beakr / gist:5863114
Created June 25, 2013 22:38
The first hello world ever from the original document on the B language.
main() {
printf("hello, world");
}