Difference between revisions of "TntVirtualPad"

From GiderosMobile
m (rename virtualpad to tntvirtualpad)
Line 8: Line 8:
  
 
=== Examples ===
 
=== Examples ===
'''TO DO'''
+
'''Add a virtual pad to the stage (or to your scene)'''
 
<source lang="lua">
 
<source lang="lua">
 
require "tntvirtualpad"
 
require "tntvirtualpad"
 +
 +
local texturevpad = TexturePack.new("gfx/tnt_virtual_pad/TNTVirtualPad.txt", "gfx/tnt_virtual_pad/TNTVirtualPad.png", true)
 +
local vPad = CTNTVirtualPad.new(stage, texturevpad, PAD.STICK_SINGLE, PAD.BUTTONS_ONE, 100, 0)
 +
vPad:setJoyStyle(PAD.COMPO_LEFTPAD, PAD.STYLE_FOLLOW)
 +
vPad:setScale(PAD.COMPO_LEFTPAD, 1.5)
 +
vPad:setScale(PAD.COMPO_BUTTON1, 1)
 +
vPad:setHideDelay(3)
 +
vPad:start()
 +
 +
--vPad:addEventListener(PAD.LEFTPAD_EVENT, self.myhero.onVKeyDown, self.myhero)
 +
--vPad:addEventListener(PAD.BUTTON1_EVENT, self.myhero.vshoot, self.myhero)
 
</source>
 
</source>
  

Revision as of 03:09, 3 December 2020

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2019.4

Description

Adds a virtual pad to your game/app screen.

Examples

Add a virtual pad to the stage (or to your scene)

require "tntvirtualpad"

local texturevpad = TexturePack.new("gfx/tnt_virtual_pad/TNTVirtualPad.txt", "gfx/tnt_virtual_pad/TNTVirtualPad.png", true)
local vPad = CTNTVirtualPad.new(stage, texturevpad, PAD.STICK_SINGLE, PAD.BUTTONS_ONE, 100, 0)
vPad:setJoyStyle(PAD.COMPO_LEFTPAD, PAD.STYLE_FOLLOW)
vPad:setScale(PAD.COMPO_LEFTPAD, 1.5)
vPad:setScale(PAD.COMPO_BUTTON1, 1)
vPad:setHideDelay(3)
vPad:start()

--vPad:addEventListener(PAD.LEFTPAD_EVENT, self.myhero.onVKeyDown, self.myhero)
--vPad:addEventListener(PAD.BUTTON1_EVENT, self.myhero.vshoot, self.myhero)

Methods

Events

Constants