Log in or register to post comments

About VirtualButtons Question - How many buttons can be created?

August 21, 2012 - 7:54am #1

If I creat more then 11 buttons, the button's line will transform.

like this:  https://plus.google.com/u/0/photos/108284225964059372964/albums/5779135931284265329

These lines would interfere with the program to identify button.

How do I restore these lines?

Please help me!!

About VirtualButtons Question - How many buttons can be created?

August 27, 2012 - 6:52am #6

Who can help me solve this problem?

Please!!!

About VirtualButtons Question - How many buttons can be created?

August 21, 2012 - 11:20pm #5

Thank you, DavidBeard.

1. Yes, they do.

2. I don't modify the project's way to trace button.

I only add some codes in VirtualButtons.cpp and Wood.xml to creat new buttons.

VirtualButtons.cpp:

//some codes

 

enum BUTTONS {

BUTTON_1 = 1,

BUTTON_2 = 2,

BUTTON_3 = 4,

BUTTON_4 = 8,

BUTTON_5 = 16,

BUTTON_6 = 32,

BUTTON_7 = 64,

BUTTON_8 = 128

};

constchar* virtualButtonColors[] = { "LeftTop", "Left", "LeftButtom", "Top",

"Buttom", "RightTop", "Right", "RightButtom" };

constint NUM_BUTTONS = 8;

 

//some codes

 

JNIEXPORT voidJNICALL

Java_com_qualcomm_QCARSamples_VirtualButtons_VirtualButtons_addButtonToToggle(JNIEnv */*env*/,

jobject/*obj*/,

jintvirtualButtonIdx)

{

LOG("Java_com_qualcomm_QCARSamples_VirtualButtons_VirtualButtons_addButtonToToggle");

 

assert(virtualButtonIdx>= 0 &&virtualButtonIdx< NUM_BUTTONS);

 

switch (virtualButtonIdx)

{

case 0:

buttonMask |= BUTTON_1;

break;

case 1:

buttonMask |= BUTTON_2;

break;

case 2:

buttonMask |= BUTTON_3;

break;

case 3:

buttonMask |= BUTTON_4;

break;

case 4:

buttonMask |= BUTTON_5;

break;

case 5:

buttonMask |= BUTTON_6;

break;

case 6:

buttonMask |= BUTTON_7;

break;

case 7:

buttonMask |= BUTTON_8;

break;

}

updateBtns = true;

}

 

//some codes

 

if (buttonMask&BUTTON_1) {

LOG("Toggle Button 1");

 

toggleVirtualButton(imageTarget, virtualButtonColors[0],

-122.00f, -50.80f, -92.00f, -83.00f);

}

if (buttonMask&BUTTON_2) {

LOG("Toggle Button 2");

 

toggleVirtualButton(imageTarget, virtualButtonColors[1],

-92.00f, -50.80f, -62.00f, -83.00f);

}

if (buttonMask&BUTTON_3) {

LOG("Toggle Button 3");

 

toggleVirtualButton(imageTarget, virtualButtonColors[2],

-62.00f, -50.80f, -32.00f, -83.00f);

}

if (buttonMask&BUTTON_4) {

LOG("Toggle Button 4");

 

toggleVirtualButton(imageTarget, virtualButtonColors[3],

31.00f, -50.80f, 61.00f, -83.00f);

}

if (buttonMask&BUTTON_5) {

LOG("Toggle Button 5");

 

toggleVirtualButton(imageTarget, virtualButtonColors[4],

-122.00f, -50.80f, -92.00f, -83.00f);

}

if (buttonMask&BUTTON_6) {

LOG("Toggle Button 6");

 

toggleVirtualButton(imageTarget, virtualButtonColors[5],

-92.00f, -50.80f, -62.00f, -83.00f);

}

if (buttonMask&BUTTON_7) {

LOG("Toggle Button 7");

 

toggleVirtualButton(imageTarget, virtualButtonColors[6],

-62.00f, -50.80f, -32.00f, -83.00f);

}

if (buttonMask&BUTTON_8) {

LOG("Toggle Button 8");

 

toggleVirtualButton(imageTarget, virtualButtonColors[7],

31.00f, -50.80f, 61.00f, -83.00f);

}

 

//some codes

 

GLfloatvbVertices[24*8];

 

.......

 

About VirtualButtons Question - How many buttons can be created?

August 21, 2012 - 10:01am #4

Do the Virtual Buttons still function after you have added 11?

Can you post the code that you're using to trace the buttons?

About VirtualButtons Question - How many buttons can be created?

August 21, 2012 - 9:40am #3

Thank you, DavidBeard.

1. Sorry, I don't have Unity scene, because I directly modify the VirtualButtons project's VirtualButtons.cpp.

2. Those line look like before I've added the 12th button:

https://plus.google.com/u/0/photos/108284225964059372964/albums/5779135931284265329/5779164353223771138

 

About VirtualButtons Question - How many buttons can be created?

August 21, 2012 - 8:41am #2

Can you post a screen shot of your Unity scene in the Unity Editor?

What do those line look like before you've added the 12th button?

There is no maximum to the number of Virtual Buttons you can use, though they should be at least 1/10th the target area and covering image details to work properly.

Log in or register to post comments