Skip to content

Instantly share code, notes, and snippets.

View usysrc's full-sized avatar
🔨

usysrc

🔨
View GitHub Profile
@usysrc
usysrc / .lua
Last active August 26, 2016 13:27
LuaForkWishes
-- Better Lua
-- my wishes for a Lua fork or patches for gamedev
-- vars are local scope by default
function defineVars()
a = 1
end
print(a) -- prints nil
-- define globals
-- recursion in lua
-- global
rec = function(i)
rec(i+1)
end
-- forward definition
local func
func = function(i)
@usysrc
usysrc / adlib
Created October 31, 2014 13:19
The Ad Lib Music Synthesizer Card, P R O G R A M M I N G G U I D E, Written by Tero Töttö
┌──────────────────────────────────────────────────────────────────────────────┐
│ │
│ The Ad Lib Music Synthesizer Card │
│ │
│ P R O G R A M M I N G G U I D E │
│ │
│ │
│ Written by Tero Töttö │
│ │
@usysrc
usysrc / rltiles.lua
Last active February 25, 2018 17:55
roguelike ascii tile display
local data = love.image.newImageData("Alloy_curses_12x12.png")
data:mapPixel(function(x,y,r,g,b,a)
if r == 255 and b == 255 and g ~= 255 then
r,g,b,a = 0,0,0,0
end
return r,g,b,a
end)
local img = love.graphics.newImage(data)
local spritebatch = love.graphics.newSpriteBatch(img, 87*25, "stream")
@usysrc
usysrc / mvm.lua
Created April 10, 2014 22:25
micro vm in lua
local MEM = {}
local PC = 0
local registers = {
A = 0,
B = 0,
C = 0,
D = 0
}
local fetch = function()
@usysrc
usysrc / deadfish.lua
Created March 17, 2014 14:03
deadfish intepreter
-- deadfish interpreter
-- also accepts xkcd
local acc = 0
local commands = {
i = function() acc = acc + 1 end,
d = function() acc = acc - 1 end,
s = function() acc = acc * acc end,
o = function() print(tonumber(acc)) end,
@usysrc
usysrc / blink.lua
Created December 30, 2013 16:56
Blinking
@usysrc
usysrc / temprec.lua
Last active December 25, 2015 04:19
code scetch and not very fast
--[[
Temporal Recursion in Lua
headchant 2013
follwing: http://extempore.moso.com.au/temporal_recursion.html
tested with luajit: stable 2.0.2
--]]
--[[
88 MP/H, fixed timestep
@usysrc
usysrc / roguelike.ps1
Last active December 21, 2015 03:09
a minimal roguelike base in powershell
Function writetext
{
Param ([int]$x, [int]$y, [string]$text)
[Console]::SetCursorPosition($x, $y)
[Console]::Write($text)
}
# set background color of the shell to black
(Get-Host).UI.RawUI.BackgroundColor = "black"
@usysrc
usysrc / dabblet.css
Created July 29, 2012 13:38
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
#content{
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
font-family: 'Press Start 2P', cursive;
font-weight: 400;