Community Curator/Source/TSWRes Tool2

function SEStickerSelTouch(Obj, TX, TY) if not Obj["Stickers"] then Obj["Stickers"] = {} end for k, v in ipairs(Obj["Stickers"]) do     local StX, StY = v["X"] + Obj["X"], v["Y"] + Obj["Y"] local Tapped = TRec(StX - v["Size"], StY - v["Size"], StX + v["Size"], StY + v["Size"], TX + CamX, TY + CamY) if Tapped then StickerSelected = v        table.remove(Obj["Stickers"], k)      end end end

function SCTouch(TX, TY) local PopitClosed = TRec(SizeX-96, SizeY-96, SizeX-32, SizeY-32,TX,TY) if PopitClosed then ToolClosed = true return end ObjSel(TX, TY) if ObjSelected then local Obj = ObjTab[ObjSelected] local ObjSti = Obj["Stickers"] local X, Y = ((Obj["X"] + TX) - CamX), ((Obj["Y"] - TY) + CamY) StickerSelected["X"] = (X) StickerSelected["Y"] = (Y) ObjSti[#ObjSti+1] = StickerSelected PopitRes.SplatterSound if PopitCuTool ~= "Sticker Cursor" then StickerSelected = nil end ObjSelected = nil end end

function SETouch(TX, TY) --print("Touched "..TX, TY) assert(TX) local PopitClosed = TRec(SizeX-96, SizeY-96, SizeX-32, SizeY-32,TX,TY) if not StickerSelected then if PopitClosed then ToolClosed = true return end ObjSel(TX, TY) if ObjSelected then local Obj = ObjTab[ObjSelected] SEStickerSelTouch(Obj, TX, TY) if StickerSelected then PopitRes.SplatterSound else PopitRes.SplatterSound PopitRes.UnavailSound end ObjSelected = nil else PopitRes.UnavailSound end else if PopitClosed then StickerSelected = nil PopitRes.DeleteSound return end SCTouch(TX, TY) end return TX, TY end

function ToolRes.StickerCursor PopitCuTool = "Sticker Cursor" ObjSelected = nil draw.tracktouches(Nil, CamMove, SCTouch) for i=1, math.huge do     GT.DrawCMFrame draw.doevents if ToolClosed then return end end end

function ToolRes.StickerEditor PopitCuTool = "Sticker Editor" ObjSelected = nil draw.tracktouches(Nil, CamMove, SETouch) for i=1, math.huge do     GT.DrawCMFrame draw.doevents if ToolClosed then return end end end

function MCTouch(TX, TY) --print("Touched "..TX, TY) assert(TX) local PopitClosed = TRec(SizeX-96, SizeY-96, SizeX-32, SizeY-32,TX,TY) if PopitClosed then ToolClosed = true return end ObjSel(TX, TY) if ObjSelected then local Obj = ObjTab[ObjSelected] Obj["Mat"] = SelectedMaterial PopitRes.SplatterSound ObjSelected = nil else PopitRes.UnavailSound end return TX, TY end

function ToolRes.MaterialChanger PopitCuTool = "Material Changer" ObjSelected = nil draw.tracktouches(Nil, CamMove, MCTouch) for i=1, math.huge do     GT.DrawCMFrame draw.doevents if ToolClosed then return end end end

PopitRes.MaterialChanger = ToolRes.MaterialChanger PopitRes.StickerCursor = ToolRes.StickerCursor PopitRes.StickerEditor = ToolRes.StickerEditor

return