Package transientlibs.preui.agents.factories

Source Code of transientlibs.preui.agents.factories.ColourFactory

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package transientlibs.preui.agents.factories;


import transientlibs.slick2d.util.Log;
import transientlibs.preui.objects.gui.elements.TransientColour;
import transientlibs.preui.objects.gui.interfaces.IColour;

/**
*
** @author kibertoad
*/
public class ColourFactory {

    public IColour defaultButtonColour = getColour("transientgray");
    public IColour defaultHoveredButtonColour = getColour("red");
    public IColour red = getColour("red");

    /*
    public IColour produceColour(Color getColor) {
        return new TransientColour(getColor);
    }
    */

    public IColour getColour(String colorCode) {

        //float aF;
        //float rF;
        //float gF;
        //float bF;

        int r = 0;
        int g = 0;
        int b = 0;
        int a = 255;

        //Log.info("COLORRRR: "+colorCode);

        if (colorCode.equals("white")) {
            r = 255;
            g = 0;
            b = 56;
            //return new TransientColour(255, 150, 50, 50);
            //return new TransientColour(255, 255, 0, 56);
        } else if (colorCode.equals("red")) {
            //return new TransientColour(255, 153, 34, 34);
            r = 153;
            g = 34;
            b = 34;
        } else if (colorCode.equals("blue")) {
            r = 0;
            g = 0;
            b = 205;
            //return new TransientColour(255, 0, 0, 205);
        }
        else if (colorCode.equals("bluegray")) {
            //return new TransientColour(255, 119, 136, 153);
            r = 119;
            g = 136;
            b = 153;
        }

        else if (colorCode.equals("gray")) {
            //return new TransientColour(255, 119, 136, 153);
            r = 88;
            g = 88;
            b = 88;
        }
       
       
        else if (colorCode.equals("transientgray")) {
            //return new TransientColour(255, 186, 186, 186);
            r = 186;
            g = 186;
            b = 186;
        } else {
            Log.error("UNKNOWN COLOUR: " + colorCode);
            return null;
        }


        //aF = a / 255.0f;
        //rF = r / 255.0f;
        //gF = g / 255.0f;
        //bF = b / 255.0f;

        return new TransientColour(a, r, g, b);

    }
}
TOP

Related Classes of transientlibs.preui.agents.factories.ColourFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.