Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit b45261f

Browse files
committed
optimise for small screens
1 parent 9b96882 commit b45261f

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

icons.xcf

-1.26 MB
Binary file not shown.

www/img/desert.png

-846 Bytes
Loading

www/img/field.png

443 Bytes
Loading

www/img/forest.png

-281 Bytes
Loading

www/img/hills.png

-1.8 KB
Loading

www/img/mountain.png

739 Bytes
Loading

www/img/ocean.png

-3 Bytes
Loading

www/img/pasture.png

-862 Bytes
Loading

www/js/catan/js/ui.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@
3939
var tileWidth = 200,
4040
tileHeight = 230;
4141

42-
var mapScale = Math.min(width/(7*tileWidth), height/((17/3)*tileHeight));
42+
var mapScale = Math.min(width/(7*tileWidth), height/((19/3)*tileHeight));
4343

4444
// create an empty container
4545
var tileContainer = new PIXI.DisplayObjectContainer();
4646

4747
// tiles are rotated so width correspond to height
48-
tileContainer.position.x = (width / 2) - ((7 * tileWidth * mapScale) / 2);
49-
tileContainer.position.y = (height / 2) - (((16/3) * tileHeight * mapScale) / 2);
48+
tileContainer.position.x = (width / 2) - (((9/3) * tileWidth * mapScale) / 2);
49+
tileContainer.position.y = (height / 2) - ((8 * tileHeight * mapScale) / 2);
50+
tileContainer.pivot.x = 0.5;
51+
tileContainer.pivot.y = 0.5;
52+
tileContainer.rotation = Math.PI/6;
5053
tileContainer.scale.x = mapScale;
5154
tileContainer.scale.y = mapScale;
5255
var tiles = [];
@@ -72,28 +75,28 @@
7275
tile.scale.y = 1;
7376
tile.anchor.x = 0.5;
7477
tile.anchor.y = 0.5;
75-
// turn left or right randomly
76-
tile.rotation = (Catan.Tools.randInterval(0,1) * 2 - 1) * Math.PI/6;
78+
tile.rotation = - (Catan.Tools.randInterval(0,6) * 2 + 1) * Math.PI/6;
7779
tiles.push(tile);
7880
tileContainer.addChild(tile);
7981

8082
if (hexagon.isLand() && hexagon.hasNumber()) {
8183
var token = new PIXI.Sprite(textures.token);
8284
token.position.x = cx;
8385
token.position.y = cy;
84-
token.scale.x = 0.8;
85-
token.scale.y = 0.8;
86+
token.scale.x = 1.1;
87+
token.scale.y = 1.1;
8688
token.anchor.x = 0.5;
8789
token.anchor.y = 0.5;
8890
tileContainer.addChild(token);
8991

90-
var textSize = Catan.Tools.tdsc(hexagon.number) * 5 + 15;
92+
var textSize = Catan.Tools.tdsc(hexagon.number) * 5 + 45;
9193
var textColor = Catan.Tools.tdsc(hexagon.number) >= 5 ? 'red' : 'black';
9294
var text = new PIXI.Text(hexagon.number, {font: textSize + "px Arial", fill:textColor});
9395
text.position.x = cx;
9496
text.position.y = cy;
9597
text.anchor.x = 0.5;
9698
text.anchor.y = 0.5;
99+
text.rotation = -Math.PI/6;
97100
tileContainer.addChild(text);
98101
}
99102

@@ -102,12 +105,11 @@
102105
var harbor = new PIXI.Sprite(textures[hexagon.land]);
103106
harbor.position.x = cx;
104107
harbor.position.y = cy;
105-
harbor.scale.x = 0.3;
106-
harbor.scale.y = 0.3;
108+
harbor.scale.x = 0.4;
109+
harbor.scale.y = 0.4;
107110
harbor.anchor.x = 0.5;
108111
harbor.anchor.y = 0.5;
109-
// turn left or right randomly
110-
harbor.rotation = (Catan.Tools.randInterval(0,1) * 2 - 1) * Math.PI/6;
112+
harbor.rotation = - (Catan.Tools.randInterval(0,6) * 2 + 1) * Math.PI/6;
111113
tileContainer.addChild(harbor);
112114
}
113115
};
@@ -118,6 +120,4 @@
118120
renderer.render(stage);
119121
};
120122

121-
122-
123123
})(Catan, PIXI);

0 commit comments

Comments
 (0)