<commit_before>--[[
Shilke2D has builtin support for drag and drop of objects.
It's based on the usage of different calls:

Shilke2D:startDrag(touch, object)
Shilke2D:stopDrag(touch, object)
Shilke2D:getDraggedObj(touch)

DisplayObj:globalTranslate(x,y)

The startDrag call binds a touch id to an specific object, so from this moment on, all events 
related to this touch id will be handled directly by registered object until the touch ending
(because ended or canceled). Without this call it's always the top most obj to be detected as 
hit.

the getDraggedObj returns the obj bound the the given touch id.

the stopDrag calls unbinds obj and touchid. It's usually not called because when the touch ends
the unbind is done automatically.

The globalTranslate method of DisplayObjs it's a translate done in another target space coordinate
system, by default the stage target space (that is also the touch coordinate system)

Using all this support together it's possible to easily achieve drag and drop features.
--]]

-- uncomment to debug touch and keyboard callbacks. works with Mobdebug
--__DEBUG_CALLBACKS__ = true

--include Shilke2D lib
require("Shilke2D/include")

local WIDTH,HEIGHT = 1024,680
local FPS = 60

--the working dir of the application
IO.setWorkingDir("Assets/PlanetCute")


--Setup is called once at the beginning of the application, just after Shilke2D initialization phase
--here everything should be set up for the following execution
function setup()
	
    local shilke = Shilke2D.current
	
	--the stage is the base displayObjContainer of the scene. Everything need to be connected to the
	--stage to be displayed.
	local stage = shilke.stage 
	
	--show as overlay fps and memory allocation<commit_msg>extended drag and drop sample<commit_after>--[[
Shilke2D has builtin support for drag and drop of objects.
It's based on the usage of different calls:

Shilke2D:startDrag(touch, object)
Shilke2D:stopDrag(touch, object)
Shilke2D:getDraggedObj(touch)

DisplayObj:globalTranslate(dx,dy)
DisplayObj:setGlobalPosition(x,y)

The startDrag call binds a touch id to an specific object, so from this moment on, all events 
related to this touch id will be handled directly by registered object until the touch ending
(because ended or canceled). Without this call it's always the top most obj to be detected as 
hit.

The getDraggedObj returns the obj bound the the given touch id.

The stopDrag calls unbinds obj and touchid. It's usually not called because when the touch ends
the unbind is done automatically.

The globalTranslate/setGlobalPosition methods of DisplayObj allow to modify obj position in another 
target space coordinate system. The default target space is the stage (that is also the default
touch coordinate system).

The globalTranslate method is usually the best choice because works well with large objects.

Using all this support together it's possible to easily achieve drag and drop features.
--]]

-- uncomment to debug touch and keyboard callbacks. works with Mobdebug
--__DEBUG_CALLBACKS__ = true

--include Shilke2D lib
require("Shilke2D/include")

local WIDTH,HEIGHT = 1024,680
local FPS = 60

--the working dir of the application
IO.setWorkingDir("Assets/PlanetCute")


--Setup is called once at the beginning of the application, just after Shilke2D initialization phase
--here everything should be set up for the following execution
function setup()
	
    local shilke = Shilke2D.current
	
	--the stage is the base displayObjContainer of the scene. Everything need to be connected to the
	--stage to be displayed.
	local stage = shilke.stage 
	
	--show as overlay fps and memory allocation
{'fraction_non_alphanumeric': 0.051056821301125446, 'fraction_numerical': 0.009332967334614329, 'mean_word_length': 4.563358778625954, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6499446', 'n_tokens_mistral': 1025, 'n_tokens_neox': 972, 'n_words': 501}