It looks like you're new here. If you want to get involved, click one of these buttons!
main = Core.class(Sprite) local vPad local function is32bit() return string.dump(is32bit):byte(9) == 4 end if is32bit() then require("Helper/tntvpad32") else require("Helper/tntvpad64") end function main:init() self.name = "scene_main" print(self.name .." init") vPad = CTNTVirtualPad.new(self, "Assets/vpad", PAD.STICK_SINGLE, PAD.BUTTONS_FOUR, 20, 0) vPad:setJoyStyle(PAD.COMPO_LEFTPAD, PAD.STYLE_MOVABLE) vPad:setPosition(PAD.COMPO_LEFTPAD, 100, 100) vPad:start() -- World & DebugDraw _WORLD = b2.World.new(0, 9.8, true) _DEBUGDRAW = b2.DebugDraw.new() _WORLD:setDebugDraw(_DEBUGDRAW) ... |
Comments
tntvpad_analogpad.png, 0, 0, 64, 64, 0, 0, 0, 0
tntvpad_base.png, 64, 0, 94, 94, 0, 0, 0, 0
tntvpad_buttondown.png, 0, 64, 64, 64, 0, 0, 0, 0
tntvpad_buttonup.png, 158, 0, 64, 64, 0, 0, 0, 0
I'm curious if maybe it's trying to add at position 0 with the layerIndex parameter.
stage and top of that main layer which 1 seems logical.
init function is
function CTNTVirtualPad:init(parent, textureFileName, padSticks, padButtons, borderSpace, layerIndex)
where parent is sprite parent ex: stage
and layerIndex is the layer level of parent.
every pad component is added
using addChilAt(parent, layerIndex)
so you can control your vpad layer level.
try example 2 of vpad
and play with:
back is layer 1 on stage
carro is layer 2 on stage
and vpad is layer 3 on stage
as is in the example the "carro" sprite is "under" vpad (vpad is level 3 top)
change vpad:init with level 2 and carros is over vpad...
hope it help...
www.tntengine.com
I have two layers added to stage: grid Layer(which will be removed later) and main layer
and on main layer I have the TNTvirtual pad.
I am using
vPad = CTNTVirtualPad.new(stage, "Assets/tntskinpad", PAD.STICK_SINGLE, PAD.BUTTONS_FOUR, 30,2)
to add vpad but it is somehow adding the pads behind the other layers on main.lua
(I am using 1.30 version of it) and since I dont have the option to add the vpad manually anyone have a solution for this ?
The solution I found is: I am creating a third layer named uiLayer which is a empty sprite, adding it to the stage above main.lua and I add the vPad with
you "hack" is not that bad....
anyway another solution is:
just tested on camera2 sources and work...
but i like more your hack...
www.tntengine.com
But thanks anyway @gregbug