Well i have to admit that was a challenge, i had to go back 4 the old school stuff and learn over again bit-wise operations

, and it was totally worth it (Help me with one of the game im witting now)
Shortly use this function to convert 4 Boolean to an integer.
Code:
/** Written by vlad. Contact me for question or help at http://4ybak47.deviantart.com/
convertCornersToInt( [topleft] , [topright] , [buttonleft] , [buttonright] ).
Example : object.Corner.Corners = convertCornersToInt(true,true,false,false);*/
function convertCornersToInt(tl,tr,bl,br)
{
return tl | tr << 1 | bl << 2 | br << 3;
}
If you wish some explanations here is my code while i was testing the function above.
Code:
//print(true << 2);
//convertCornersToInt(true,true,true,true);
//print(convertCornersToInt(true,false,false,false));
//Works!!!
////widgetContainer.Corner.Corners = convertCornersToInt(false,true,false,true);
/** Written by vlad. Contact me for question or help at http://4ybak47.deviantart.com/
**function usage Example :
//Curve only the top two corners.
object.Corner.Corners = convertCornersToInt(true,true,false,false);
**Variables:
//tl - topleft : Boolean [true / false]
//tr - topright : Boolean [true / false]
//bl - buttonleft : Boolean [true / false]
//br - buttonright : Boolean [true / false]
*/
function convertCornersToInt(tl,tr,bl,br)
{
//obj.Corner.Corners = "topleft,topright,buttonleft,buttonright";
//printBinary(4);
//printBinary(15);
// var b = true;
//printBinary(b ? 1 : 0);
//printBinary(cb2i(true));
//printBinary(tl);
// tl = 1, tl << 1 = 10, tl << 2 = 100, tl << 3 = 1000
//printBinary(cb2i(tl) << 2);
return tl | tr << 1 | bl << 2 | br << 3;
}
//Usage : check the binary value of the number n.
function printBinary(n)
{
print("~~~~~~~~~~~~~~~~~~~");
print(" Binary ( " + parseInt(n).toString(2) + " )");
print(" Number ( " + parseInt(n).toString() + " )");
print(" Value ( " + n.toString() + " )");
print("~~~~~~printBinary~~~~~~");
}
//Convert boolean to int / binary [1,0]
function cb2i(bool)
{
return bool ? 1 : 0;
}