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
//our simple data structure | |
function Spatial(x,y,vx,vy){ | |
this.x = x; | |
this.y = y; | |
this.vx = vx || Math.random(); | |
this.vy = vy || Math.random(); | |
} | |
//use partial application here so that we can compose this in our main update | |
function processEvents(keys){ |
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
;; Testing some potential basic game functions | |
;; moved-by : list list -> list | |
;; computes a new position by adding an x,y pair to an x,y pair | |
;; example: (moved-by '(1,1) '(0,1)) -> '(1,2) | |
(defn moved-by [position amount] | |
(map + position amount)) | |
;; test moved-by: (moved-by '(1,1) '(0,1)) -> '(1,2) | |
(println (= '(1 2) (moved-by '(1,1) '(0,1)))) |
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
/** Simple touch input helper class that provides similar data to HaxePunk's mouse. | |
takes arguments defining a box within which to register touches. Only registers first touch. | |
*/ | |
class TouchInput{ | |
public var pressed:Bool = false; | |
public var released:Bool = false; | |
public var down:Bool = false; | |
public var touchX:Float = 0; | |
public var touchY:Float = 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
//data | |
var person = {name: "Dave", exampleattr: "true", friends: ["one","two","three"]}; | |
//map data to selectors | |
var mapping = { | |
name: "#people .person", | |
exampleattr: {"#people .person" : "someattr"}, | |
friends: "#people .friends" | |
}; | |
//input |
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
restore_pane_process() { | |
local pane_full_command="$1" | |
local session_name="$2" | |
local window_number="$3" | |
local pane_index="$4" | |
local dir="$5" | |
if _process_should_be_restored "$pane_full_command" "$session_name" "$window_number" "$pane_index"; then | |
# These two commands don't seem to be needed if addressing session:window.pane absolutely (see below) | |
tmux switch-client -t "${session_name}:${window_number}" | |
tmux select-pane -t "$pane_index" |