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
-- debug console | |
local widget = require("widget") | |
local lib = {} | |
local originalPrintFunc = print | |
local debugPrintFunc = nil | |
local showingDebugConsole = false |
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
-- ref: http://docs.coronalabs.com/daily/guide/graphics/effects.html#generator.radialgradient | |
local back, outer, inner = {0,1,0,1}, {0,.9,0,.05}, {0,1,0,.05} | |
-- backing colour rect | |
display.newRect( display.actualCenterX*.5, display.actualContentHeight*.25, 220, 220 ).fill = back | |
-- radial fill rect | |
local r = display.newRect( display.actualCenterX*.5, display.actualContentHeight*.25, 200, 200 ) | |
local function getRadius( r, xOffset, yOffset ) |
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 function shadow( width, height, size ) | |
local g = display.newGroup() | |
g.x, g.y = display.contentCenterX, display.contentCenterY | |
display.newRect( g, 0, 0, width+size, height+size ).fill = {1,1,1,0} | |
display.newRect( g, 0, 0, width, height ).fill = {0,0,0} | |
local c = display.capture( g ) | |
g = display.remove( g ) | |
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
-- circle lib | |
require("mathlib") | |
display.setDefault( "isAnchorClamped", false ) | |
local min, max = -10000000000000, 10000000000000 | |
local cache = {} | |
local circlelib = {} |
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 function angleOnTarget( e ) | |
local a = math.atan2( e.y-e.target.y, e.x-e.target.x ) * 180 / (4*math.atan(1)) | |
if (a<0) then a=a+360 end | |
return a | |
end | |
local function tap(e) | |
e.target.touchMode = "drag" | |
print("drag mode") | |
e.target.dragtimer = timer.performWithDelay( 400, function() |
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 widget = require("widget") | |
local function angleOf( ax, ay, bx, by, adjust, positive ) | |
local angle = math.atan2( by-ay, bx-ax ) * 180/math.pi | |
if (adjust) then | |
if (type(adjust) ~= "number") then adjust = -90 end | |
angle = angle - adjust | |
if (angle < -180) then angle=angle+360 end | |
if (angle > 180) then angle=angle-360 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
using System; | |
using System.Collections.Generic; | |
using System.Runtime.Caching; | |
namespace CacheServices | |
{ | |
public class Cache | |
{ | |
protected MemoryCache _cache = new MemoryCache("general"); |
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 lib = {} | |
function lib.newShadowLayer( shadowgroup ) | |
local function refresh() | |
if (shadowgroup and shadowgroup.numChildren) then | |
for i=1, shadowgroup.numChildren do | |
local shadow = shadowgroup[i] | |
local object = shadowgroup[i].shadowparent | |
if (not shadow.isBodyActive) then |
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
-- graphics extension library | |
require("mathlib") -- https://gist.github.com/HoraceBury/9431861 | |
require("displaylib") -- https://gist.github.com/HoraceBury/1e2ce033e3441823038eb88b551ad981 | |
-- https://math.stackexchange.com/questions/2269589/calculate-angle-of-the-next-point-on-a-circle | |
--[[ | |
Generates a table of points containing the outline of a circle with each point 'step' pixels from the previous. | |
Parameters: |
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
require("mathlib") | |
require("graphicslib") | |
require("tablelib") | |
local function asPoint( x, y ) | |
return { x=x, y=y } | |
end | |
local function getPoint( path, index ) | |
return { x=path[index], y=path[index+1] } |