mirror of
https://github.com/ysoftdevs/pf2016.git
synced 2026-11-19 07:08:49 +01:00
Use FontAwesome instead of image button
This commit is contained in:
1 parent
47ecce5e92
commit
048a417542
10 files changed
+682
-7
No files matched your search
@@ -36,16 +36,27 @@ levelSelectorState.create = function() {
|
||||
|
||||
for (var i=1; i<levels.length+1; i++) {
|
||||
|
||||
var sprite = new Kiwi.GameObjects.Sprite(this, this.textures.button, 40+counterX*140, 50+counterY*80);
|
||||
sprite.levelIndex = i;
|
||||
this.addChild( sprite );
|
||||
var button = new Kiwi.Plugins.Primitives.Rectangle( {
|
||||
x: 110+counterX*120,
|
||||
y: 50+counterY*70,
|
||||
state: this,
|
||||
width: 100,
|
||||
height: 50,
|
||||
color: '2160e1',
|
||||
strokeColor: '050e20',
|
||||
centerOnTransform: true
|
||||
} );
|
||||
this.addChild(button);
|
||||
|
||||
button.levelIndex = i;
|
||||
|
||||
if (this.levelStatus[i-1] == 'locked') {
|
||||
sprite.cellIndex = 1;
|
||||
} else {
|
||||
var text = new Kiwi.GameObjects.Textfield( this, i.toString(), 100+counterX*140, 60+counterY*80, "#1d5f0e", 32, 'normal', 'Impact' );
|
||||
var text = new Kiwi.GameObjects.Textfield( this, "\uf023", 100+counterX*120, 32+counterY*70, "#cb6f25", 32, 'normal', 'FontAwesome' );
|
||||
this.addChild(text);
|
||||
sprite.input.onUp.add( this.buttonReleased, this );
|
||||
} else {
|
||||
var text = new Kiwi.GameObjects.Textfield( this, i.toString(), 100+counterX*120, 30+counterY*70, "#fbd712", 32, 'normal', 'Impact' );
|
||||
this.addChild(text);
|
||||
button.input.onUp.add( this.buttonReleased, this );
|
||||
}
|
||||
|
||||
counterX++;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Kiwi.Plugins.Primitives={name:"Primitives",version:"1.0.4",minimumKiwiVersion:"1.3.0"},Kiwi.PluginManager.register(Kiwi.Plugins.Primitives),Kiwi.Plugins.Primitives.create=function(a){},Kiwi.Plugins.Primitives.Polygon=function(a){var b=a.state;this._initProperties(),Kiwi.Entity.call(this,b,0,0),this.parseParams(a),this.game.renderOption===Kiwi.RENDERER_WEBGL&&(this.glRenderer=this.game.renderer.requestSharedRenderer("PrimitiveRenderer"),this.atlas=this.glRenderer.getAtlas()),this.rebuildBounds()},Kiwi.extend(Kiwi.Plugins.Primitives.Polygon,Kiwi.Entity),Object.defineProperty(Kiwi.Plugins.Primitives.Polygon.prototype,"indices",{get:function(){return this._indices},set:function(a){var b;if(this._indices=[],a.length>2)for(b=0;b<a.length;b++)this._indices.push(a[b])}}),Object.defineProperty(Kiwi.Plugins.Primitives.Polygon.prototype,"vertices",{get:function(){return this._vertices},set:function(a){var b;for(this._vertices=[],b=0;b<a.length;b++)this._vertices.push([a[b][0],a[b][1]])}}),Object.defineProperty(Kiwi.Plugins.Primitives.Polygon.prototype,"strokeIndices",{get:function(){return this._strokeIndices},set:function(a){var b;if(this._strokeIndices=[],a.length>1){for(b=0;b<a.length;b++)this._strokeIndices.push(a[b]);this.createstroke(this._strokeIndices,this._vertices)}}}),Object.defineProperty(Kiwi.Plugins.Primitives.Polygon.prototype,"strokePolyIndices",{get:function(){return this._strokePolyIndices},set:function(a){var b;if(this._strokePolyIndices=[],a.length>2)for(3===a.length&&this._strokePolyIndices.push(a[0]),b=0;b<a.length;b++)this._strokePolyIndices.push(a[b])}}),Object.defineProperty(Kiwi.Plugins.Primitives.Polygon.prototype,"strokePolyVertices",{get:function(){return this._strokePolyVertices},set:function(a){var b;for(this._strokePolyVertices=[],b=0;b<a.length;b++)this._strokePolyVertices.push([a[b][0],a[b][1]])}}),Kiwi.Plugins.Primitives.Polygon.prototype._buildMiter=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=[],p=[],q=b[0];return j=a[0].distanceTo(a[1]),k=b[0].distanceTo(b[1]),l=Math.min(j,k),h=Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x),i=Math.atan2(b[1].y-b[0].y,b[1].x-b[0].x),h=Kiwi.Utils.GameMath.normalizeAngle(h),i=Kiwi.Utils.GameMath.normalizeAngle(i),d=i-h,d>Math.PI?d=2*Math.PI-d:d<-Math.PI&&(d=2*-Math.PI-d),d*=.5,Math.abs(h-i)>Math.PI&&(i>h?h+=2*Math.PI:i+=2*Math.PI),c=Kiwi.Utils.GameMath.normalizeAngle(.5*(h+i)),e=Math.cos(c),f=-Math.sin(c),g=this.strokeWidth/(2*Math.cos(d)),g>l&&(g=l),m=new Kiwi.Geom.Point(f*g,e*g),n=new Kiwi.Geom.Point(f*-g,e*-g),m.x+=q.x,m.y+=q.y,n.x+=q.x,n.y+=q.y,o=[0,1,0,1],p=[[m.x,m.y],[n.x,n.y]],{indices:o,vertices:p}},Kiwi.Plugins.Primitives.Polygon.prototype._buildStroke=function(a,b){var c,d,e,f,g,h,i,j,k,l=[],m=0,n=a.length,o=[];if(n>1){for(i=new Kiwi.Geom.Point(b[a[0]][0],b[a[0]][1]),j=new Kiwi.Geom.Point(b[a[1]][0],b[a[1]][1]),h=this._buildMiter([i,j],[i,j]),l=l.concat(h.indices),o=o.concat(h.vertices),m+=h.vertices.length,f=1;n-1>f;f++){for(i=new Kiwi.Geom.Point(b[a[f-1]][0],b[a[f-1]][1]),j=new Kiwi.Geom.Point(b[a[f]][0],b[a[f]][1]),k=new Kiwi.Geom.Point(b[a[f+1]][0],b[a[f+1]][1]),h=this._buildMiter([i,j],[j,k]),g=0;g<h.indices.length;g++)h.indices[g]+=m;l=l.concat(h.indices),o=o.concat(h.vertices),m+=h.vertices.length}for(e=a.length-1,c=b[a[e]][0]-b[a[e-1]][0],d=b[a[e]][1]-b[a[e-1]][1],i=new Kiwi.Geom.Point(b[a[e]][0],b[a[e]][1]),j=new Kiwi.Geom.Point(b[a[e]][0]+c,b[a[e]][1]+d),h=this._buildMiter([i,j],[i,j]),g=0;g<h.indices.length;g++)h.indices[g]+=m;return l=l.concat(h.indices),o=o.concat(h.vertices),{indices:l,vertices:o}}return null},Kiwi.Plugins.Primitives.Polygon.prototype.clone=function(){var a={color:this.color,indices:this._indices,state:this.state,strokeColor:this.strokeColor,strokeIndices:this._strokeIndices,vertices:this._vertices,x:this.x,y:this.y,rotation:this.rotation,scaleX:this.scaleX,scaleY:this.scaleY,anchorPointX:this.anchorPointX,anchorPointY:this.anchorPointY,alpha:this.alpha,visible:this.visible};return new Kiwi.Plugins.Primitives.Polygon(a)},Kiwi.Plugins.Primitives.Polygon.prototype.computeMinMaxXY=function(a){var b,c,d=a.length,e=0,f=0,g=0,h=0;for(b=0;d>b;b++)c=a[b],c[0]<g&&(g=c[0]),c[0]>e&&(e=c[0]),c[1]<h&&(h=c[1]),c[1]>f&&(f=c[1]);return{maxX:e,maxY:f,minX:g,minY:h}},Kiwi.Plugins.Primitives.Polygon.prototype.combine=function(a,b){if("undefined"==typeof b&&(b=!0),this.poly===this)return!1;var c,d=this.transform.getConcatenatedMatrix().invert(),e=a.transform.getConcatenatedMatrix(),f=new Kiwi.Geom.Point(0,0),g=a.indices.length,h=a.vertices.length,j=a.strokePolyIndices.length,k=a.strokePolyVertices.length;if(g>2){for(c=this._vertices.length,this._indices.length>0&&(this._indices.push(this._indices[this._indices.length-1]),this._indices.push(a.indices[0]+c)),i=0;i<g;i++)this._indices.push(a.indices[i]+c);for(i=0;i<h;i++)f.setTo(a.vertices[i][0]-a.anchorPointX,a.vertices[i][1]-a.anchorPointY),f=e.transformPoint(f),f=d.transformPoint(f),this._vertices.push([f.x+this.anchorPointX,f.y+this.anchorPointY])}if(j>2){for(c=this._strokePolyVerticesLine truncated
|
||||
Reference in new issue
Block a user