Skip to content

Instantly share code, notes, and snippets.

View egbulmer's full-sized avatar

Elliot Bulmer egbulmer

  • Immersive Technologies
  • Perth, Western Australia
  • 11:09 (UTC +08:00)
View GitHub Profile
@egbulmer
egbulmer / player.rs
Created June 14, 2018 12:17
Godot Rust: Working through “Dodge the Creeps!”
// player.rs
use gd;
use gd::{ GodotString, Vector2 };
use gd::init::{ Property, PropertyHint, PropertyUsage };
const DEFAULT_SPEED: f64 = 400.0;
godot_class! {
class Player: gd::Area2D {
@egbulmer
egbulmer / README.md
Last active April 2, 2017 00:34
Godot application launcher on Elementary OS

I thought this might be useful for people running Elementary OS that want to see Godot in the application launcher or in the dock.

  1. Save godot.desktop to ~/.local/share/applications.
  2. Edit the Exec entry to point to your local program.
  3. Download and extract icons zipfile:
unzip -d ~/.local/share icons.zip
@egbulmer
egbulmer / struct-by-value.ss
Created March 30, 2017 11:56
Chez Scheme FFI - Structs returned by value
(load-shared-object "./libsbv.so")
(define-ftype color
(struct
[r float]
[g float]
[b float]
[a float]))
(define make-rgba
@egbulmer
egbulmer / hypothetical-three-cljs.clj
Last active January 23, 2016 02:46
Example of hypothetical `render-scene` call
; This a hypothetical example of a Render call for a ClojureScript wrapper of
; the Three.JS rendering library.
; Replica of the scene in the introductory Three.JS tutorial:
; http://threejs.org/docs/index.html#Manual/Introduction/Creating_a_scene
(render-scene
[:mesh {:geometry [:box 1 1 1]
:material [:mesh-basic {:color 0x00ff00}]])
@egbulmer
egbulmer / last-node-zipper.cljs
Created April 12, 2015 03:51
Last location in zip function is not being updated.
(defn lprocess
"Process all locations that match the predicate function with the supplied
mapping function. Locations that do not match are unchanged."
[pred func ent]
(->>
(iterate (fn [l]
(if (pred l)
(zip/next (func l))
(zip/next l))) (zip/vector-zip ent))
(take-while (complement zip/end?))
@egbulmer
egbulmer / unexpected-token.clj
Created April 3, 2015 01:31
Strange behaviour of function vars in the case macro
(defn foo [] (print "foo!"))
(defn bar [] (print "bar!"))
(defn print-foo [fb]
(apply (case fb
:foo #'foo
:bar #'bar) []))
; Will throw this error when defined:
@egbulmer
egbulmer / sprite-style-extract.cljs
Last active August 29, 2015 14:18
An extract of the sprite rendering code from my sprite-style demo.
(ns sprite-style.entities
(:require
[sprite-style.math :as math]
[sprite-style.protocols :refer [Entity Renderable]]
[sprite-style.pixi :as pixi]
[sprite-style.vector :as vec :refer [v-]]))
(defn load-anim [name angle frames]
[angle (pixi/load-clip (str name "-" angle) ".png" frames)])