This file contains hidden or 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
class Array | |
def unzip | |
#r = Array.new(self[0].size) {[]} | |
#each { |arr| | |
each_with_object(Array.new(self[0].size){[]}) {|arr, r| | |
arr.each_with_index { |x, i| | |
r[i] << x | |
} | |
} |
This file contains hidden or 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
require'gosu';include Gosu | |
class Component | |
class << self | |
# @field should be set for each base class, | |
# entities that include this component or a derivative | |
# respond to this as a message | |
def field() @field or superclass.field end | |
def iface() (@interface or []) + (superclass.iface rescue []) end |
This file contains hidden or 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
proc curry[A, Ret] ( | |
func: proc(someA: A): Ret, | |
valueA: A): proc: Ret = | |
return proc: Ret = func(valueA) | |
proc curry[A,B, Ret] ( | |
func: proc(someA: A, someB: B): Ret, | |
valueA: A): proc(someB: B): Ret = | |
return proc(someB: B): Ret = func(valueA, someB) | |
proc curry[A,B,C, Ret] ( |
This file contains hidden or 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
import fowltek/vector_math | |
type | |
TVector2f = TVector2[float] | |
TPos = TVector2f | |
TVel = TVector2f | |
PSprite = ref object |
This file contains hidden or 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
## entitty has been moved to the fowltek package |
This file contains hidden or 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
import fowltek/entitty | |
entitty_imports | |
import fowltek/vector_math | |
type Pos = Tvector2[float] | |
type Vel = object | |
vec: TVector2[float] | |
Pos.setInitializer proc(x: PEntity) = |
This file contains hidden or 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
import fowltek/entitty, fowltek/sdl2/engine | |
entitty_imports | |
import_all_sdl2_modules | |
import fowltek/vector_math | |
type TVector2f* = TVector2[float] | |
proc getPos* : TVector2f {.unicast.} | |
proc update* (dt: float) {.multicast.} | |
proc draw* (R: PRenderer) {.unicast.} |
This file contains hidden or 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
import macros | |
macro foo: stmt = | |
var y = newIntLitNode(0) | |
result = quote do: | |
let x = `y` | |
result.treerepr.echo | |
if result[0][0][0].kind != nnkIdent: | |
quit "Invalid node kind "& $result[0][0][0].kind |
This file contains hidden or 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
import macros | |
from strutils import format | |
macro constStr* (name; str: expr[string]): stmt {.immediate.}= | |
##need a check for top level statement?? | |
result = """{.emit: "prog_char $1_data[] PROGMEM = \"$2\"; ".} | |
var $1_data {.importc, nodecl.}: array[$3, char] | |
template $1: cstring = $1_data[0].addr""".format(name, str, str.strval.len).parseStmt | |
result.repr.echo |
This file contains hidden or 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
# | |
#* $Id: lua.h,v 1.283 2012/04/20 13:18:26 roberto Exp $ | |
#* Lua - A Scripting Language | |
#* Lua.org, PUC-Rio, Brazil (http://www.lua.org) | |
#* See Copyright Notice at the end of this file | |
# | |
const | |
LUA_VERSION_MAJOR* = "5" | |
LUA_VERSION_MINOR* = "2" | |
LUA_VERSION_NUM* = 502 |