View Program.cs
using System;
using NUnit.Framework;
using System.Data;
namespace RandomTests
{
[TestFixture]
public class NumberTests
{
public static void Main(string[] args)
View displaylib.lua
-- display lib
local newShapeList = {
"newCircle",
"newContainer",
"newEmbossedText",
"newEmitter",
"newGroup",
"newImage",
"newImageRect",
View cyclingants.lua
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] }
View graphicslib.lua
-- 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:
View _shadowlib.lua
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
View Cache.cs
using System;
using System.Collections.Generic;
using System.Runtime.Caching;
namespace CacheServices
{
public class Cache
{
protected MemoryCache _cache = new MemoryCache("general");
View dragitemscrollview.lua
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
View simple drag and rotate demo.lua
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()
View circlelib.lua
-- circle lib
require("mathlib")
display.setDefault( "isAnchorClamped", false )
local min, max = -10000000000000, 10000000000000
local cache = {}
local circlelib = {}
View shadow.lua
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 )