View difference between Paste ID: PPRT1wfR and dGrUNjFa
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-
			float ratioW = (float)Math.floor(w/sW);
12+
			StageRatio = (float)Math.min((float)w/(float)sW,(float)h/(float)sH);
13-
			float ratioH = (float)Math.floor(h/sH);
13+
14
			StagePos[2] = (int)Math.floor((float)sW * StageRatio);
15-
			if ( ratioW == ratioH || ratioW < ratioH){
15+
			StagePos[3] = (int)Math.floor((float)sH * StageRatio);
16-
				StageRatio = ratioW;
16+
			StagePos[0] = 0;
17-
				StagePos[2] = w;
17+
			StagePos[1] = (h - StagePos[3])/2;
18-
				StagePos[3] = (int)Math.floor((float)sH * StageRatio);
18+
			coordOffset = new int[]{ (w - StagePos[2])/2, (h - StagePos[3])/2 };
19-
				StagePos[0] = 0;
19+