setParentGroup() Function Reference

setParentGroup(group)

Inserts the Qiso rendering group into a group created outside of Qiso. Useful for inserting Qiso into a Composer scene.


	local qiso = require "plugin.qisoengine"
	local composer = require "composer"

	local scene = composer.newScene()

	qiso.setAssetsFolder("assets")
	qiso.loadTiledMap("sample-tilemap")

	function scene:create( event )
		local sceneGroup = self.view

		-- Insert Qiso into the Composer scene. Do this before creating other elements that displaying over the top of Qiso.
		qiso.setParentGroup(sceneGroup)
	end

	function scene:show( event )
		local sceneGroup = self.view
		local phase = event.phase

		if( phase == "will" ) then
			-- Enable the main Qiso loop to render/update our world
			qiso.activate()
		end
	end

	function scene:hide( event )
		local sceneGroup = self.view
		local phase = event.phase

		if( phase == "did" ) then
			-- Disable Qiso until we come back to this scene
			qiso.deactivate()
		end
	end

	function scene:destroy( event )
		local sceneGroup = self.view
	end

	scene:addEventListener( "create", scene )
	scene:addEventListener( "show", scene )
	scene:addEventListener( "hide", scene )
	scene:addEventListener( "destroy", scene )

	return scene