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
-- collision library | |
local collisionslib = {} | |
local categoryNames = {} | |
local categoryCounter = 1 | |
local function newCategory( name ) | |
categoryNames[ name ] = categoryCounter | |
categoryCounter = categoryCounter * 2 |
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
local t = [[ your html ]] | |
-- list of strings to replace (the order is important to avoid conflicts) | |
local cleaner = { | |
{ "&", "&" }, -- decode ampersands | |
{ "—", "-" }, -- em dash | |
{ "’", "'" }, -- right single quote | |
{ "“", "\"" }, -- left double quote | |
{ "”", "\"" }, -- right double quote | |
{ "–", "-" }, -- en dash |
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
-- table library extensions | |
if (dump == nil) then | |
dump = function(t) | |
print("=============") | |
for k,v in pairs(t) do | |
print("\t",k,v) | |
end | |
print("=============") | |
end |
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
-- utils | |
local composer = require("composer") | |
local utils = {} | |
function dump( ... ) | |
if (#arg > 1) then | |
print("========================DUMP ("..#arg..")========================") | |
for i=1, #arg do |
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
-- mathlib.lua | |
local function dump(tbl) | |
print("====================") | |
for k,v in pairs(tbl) do | |
print(k,v) | |
end | |
print("====================") | |
end |
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
-- polygon concave | |
require("mathlib") | |
stage = display.getCurrentStage() | |
local text = display.newText{ text="- - -", x=display.contentCenterX, y=100, fontSize=24 } | |
lines = display.newGroup() | |
lines:insert(display.newGroup()) |
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
-- arrow test | |
-- http://www.iforce2d.net/b2dtut/sticky-projectiles | |
-- video: http://screencast.com/t/vcPLSJR6xkIq | |
require("mathlib") | |
local sWidth, sHeight = display.actualContentWidth, display.actualContentHeight | |
local centerX, centerY = sWidth/2, sHeight/2 |
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
-- rgb | |
-- Colors referenced from http://www.tayloredmktg.com/rgb/ | |
local RGB = { | |
neoncyan = {16, 174, 239}, -- Neon Cyan | |
neonyellow = {231, 228, 37}, -- Neon Yellow | |
neonpink = {231, 83, 177}, -- Neon Pink | |
neongreen = {4, 228, 37}, -- Neon Green | |
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
-- io operations | |
local json = require("json") | |
local lfs = require( "lfs" ) | |
local iolib = {} | |
--[[ FACILITIES ]]-- | |
local function toDate( timestamp ) |
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
-- swipe library | |
--[[ Libraries ]]-- | |
local composer = require("composer") | |
--[[ Fields ]]-- | |
local mainstage = display.getCurrentStage() | |
local stage = composer.stage |
OlderNewer