scale specific coordinates?

0 favourites
  • 2 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hi there, could someone please point me in the right direction for figuring out the x and y coordinates taking into account scale? The code I have works perfectly until I change the fullscreen mode from crop to anything else. I would like to scale the code much like the button does but I don't see details on how many of the items such as layerToCanvas actually work.

    Heres my code

    Acts.prototype.Like_Button = function (l_verb, l_color, l_under, l_layout,l_faces,l_url,l_code)

    {

    var left = fbInst.x;

    var top = fbInst.y;

    var verb1, color1, under1, layout1, faces1, url1, code1;

    if (l_under == 0){under1 = true;}else{under1= false;}

    if (l_faces == 0){faces1 = true;}else{faces1= false;}

    if (l_verb == 0){verb1 = 'like';}else{verb1= 'recommend';}

    if (l_color == 0){color1 = 'light';}else{color1= 'dark';}

    if (l_layout == 0){layout1 = 'standard';}

    else if (l_layout == 1){layout1 = 'button_count';}

    else if (l_layout == 2){layout1 = 'button';}

    else{layout1= 'box_count';}

    var div1 = document.createElement("div");

    div1.style.position="absolute";

    div1.style.left=left+"px";

    div1.style.top = top+"px";

    div1.style.width = fbInst.width+"px";

    div1.style.height = fbInst.height+"px";

    div1.style.zIndex="10000000";

    div1.innerHTML = '<div class="fb-like" kid_directed_site="'+under1+'" colorscheme= "'+color1+'"data-href="'+l_url+'" data-layout="'+layout1+'" data-action="'+verb1+'" data-show-faces="'+faces1+'" data-share="true" data-ref="'+l_code+'"></div>';

    document.body.appendChild (div1);

    FB.XFBML.parse();

    };

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Just look at the source to one of the other plugins like Text Box or Progress Bar. They show how to correctly position a DOM element over the canvas.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)