View difference between Paste ID: dGrUNjFa and dPgWuJg7
SHOW: | | - or go back to the newest paste.
1
	public void adjustStagePos()
2
	{
3
		int sW = (int)stageBG.getWidth();
4
		int sH = (int)stageBG.getHeight();
5
		
6
		// Device res is not compatible
7
		if ( w < sW || h < sH){
8
			
9
		}
10
		else{
11
			
12-
			int ratioW = (int)Math.floor(sW/w);
12+
			float ratioW = (float)Math.floor(w/sW);
13-
			int ratioH = (int)Math.floor(sH/h);
13+
			float ratioH = (float)Math.floor(h/sH);
14
			
15
			if ( ratioW == ratioH || ratioW < ratioH){
16-
				StageRatio = (float)sW/(float)w;
16+
				StageRatio = ratioW;
17
				StagePos[2] = w;
18-
				StagePos[3] = (int)Math.floor((float)h*StageRatio);
18+
				StagePos[3] = (int)Math.floor((float)sH * StageRatio);
19
				StagePos[0] = 0;
20
				StagePos[1] = (h - StagePos[3])/2;
21
				coordOffset = new int[]{ 0, (h - StagePos[3])/2 };
22
			}
23
		}