Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void adjustStagePos()
- {
- int sW = (int)stageBG.getWidth();
- int sH = (int)stageBG.getHeight();
- // Device res is not compatible
- if ( w < sW || h < sH){
- }
- else{
- int ratioW = (int)Math.floor(sW/w);
- int ratioH = (int)Math.floor(sH/h);
- if ( ratioW == ratioH || ratioW < ratioH){
- StageRatio = (float)sW/(float)w;
- StagePos[2] = w;
- StagePos[3] = (int)Math.floor((float)h*StageRatio);
- StagePos[0] = 0;
- StagePos[1] = (h - StagePos[3])/2;
- coordOffset = new int[]{ 0, (h - StagePos[3])/2 };
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement