/*
 * JCode Gamers Minecraft Library.
 * Copyright (c) 2016 Poro Shadows (http://jcodegamers.net).
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package net.jcodegamers.jcgml.utility;

public enum ScreenSize {
    r21by9(21, 9),
    r16by9(16, 9),
    r4by3(4, 3),
    r3by2(3, 2);

    private int aspectWidth, aspectHeight;

    ScreenSize(int aspectWidth, int aspectHeight) {
        this.aspectWidth = aspectWidth;
        this.aspectHeight = aspectHeight;
    }

    public double getDiagonal(int width, int height) {
        return Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
    }

    public int getWidth(int height) {
        return height * (this.aspectWidth / this.aspectHeight);
    }

    public int getHeight(int width) {
        return width / (this.aspectWidth / this.aspectHeight);
    }

    public int getAspectWidth() {
        return aspectWidth;
    }

    public int getAspectHeight() {
        return aspectHeight;
    }
}