Skip to content

Instantly share code, notes, and snippets.

@jeremyckahn
Created March 4, 2014 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyckahn/9340171 to your computer and use it in GitHub Desktop.
Save jeremyckahn/9340171 to your computer and use it in GitHub Desktop.
var backcoloractortxt = rekapi.addActor(
new Rekapi.Actor({
'render': function (context, state) {
context.beginPath();
var titleheight = 40;
context.font = titleheight*state.scale+"px Arial";
context.measureText("Bardon Update").width;
var w = context.measureText("HomePrezzo").width;
context.font = (titleheight/2)*state.scale+"px Arial";
var w2 = context.measureText("Bardon Update").width;
if (w2 > w) {w=w2;}
w = (w+50)/2;
context.strokeStyle = state.color;
context.rect(state.x-w,state.y-20,w*2,titleheight*2+20);
context.stroke();
context.fillStyle = state.colorback;
context.fill();
context.textAlign = "center";
context.textBaseline = "top";
context.fillStyle = state.color;
context.font = titleheight*state.scale+"px Arial";
context.fillText("HomePrezzo", state.x, state.y);
context.font = (titleheight/2)*state.scale+"px Arial";
context.fillText("Bardon Update", state.x, state.y+titleheight*state.scale);
context.closePath();
}
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment