I'm using the virtual button sample application.
I want to put buttons on different positions from the sample. What should I do?
Looking at the code in the jni folder (VirtualButtons.cpp), I found "VirtualButton_UpdateCallback" class. there are lines as follows.
......
if (buttonMask & BUTTON_1)
{
LOG("Toggle Button 1");
toggleVirtualButton(imageTarget, virtualButtonColors[0],
-108.68f, -53.52f, -75.75f, -65.87f);
}
if (buttonMask & BUTTON_2)
{
LOG("Toggle Button 2");
toggleVirtualButton(imageTarget, virtualButtonColors[1],
-45.28f, -53.52f, -12.35f, -65.87f);
}
......
Do I have to modify the four numbers (left, top, right, bottom)? and what I have to do then?
Thanks in advance.
No, virtual buttons are always rectangular. You could probably make it appear to be a circular button with the right design on your image target, and just make the rect fit inside (or encompass) the button on the sheet.
In the VirtualButtons sample the relevant code is in the EAGLView renderFrameQCAR method. That method is called every frame, and button->isPressed() will return true for each frame the button is pressed. You may want to capture the point at which a button changes from not pressed to pressed, and perform an action at that time.
- Kim