Package fm.ak.client.twod

Source Code of fm.ak.client.twod.Dialog

package fm.ak.client.twod;

import fm.ak.client.Main;
import fm.ak.client.StaticFont;
import fm.ak.otse.Otse;
import fm.ak.otse.font.Text;
import fm.ak.otse.twod.Component;
import fm.ak.otse.Renderable;
import fm.ak.otse.twod.ComponentRenderer;
import java.util.ArrayList;

/**
* a popup if you will
*/
public class Dialog extends Component {

    public static final String WELCOME_MESSAGE = "welcome to alpha i hope you find me interesting, if not i barely feel responsible";
    /**
     * The fixed width of a dialog box.
     */
    public static final int WIDTH = 350;
    /**
     * The fixed height of a dialog box.
     */
    public static final int HEIGHT = 150;
    private String Tekst;
    private Text MessageShadow;
    private Text Message;
    private ArrayList<Component> Strips = new ArrayList();

    public Dialog(String t) {

        super("$dialog", (Main.width / 2) - WIDTH / 2, (Main.height / 2) - HEIGHT / 2, WIDTH, HEIGHT);

        System.out.println("constructing dialog");

        setSheetSprite(Main.main.gooey, "entirety");

        index = 99;

        //setIsVisible(false);

        //tw = (float) WIDTH / Main.gooey.getImageWidth();
        //th = (float) HEIGHT / Main.gooey.getImageHeight();

        int x = (Main.width / 2) - WIDTH / 2;
        int y = (Main.height / 2) - HEIGHT / 2;
        int spacing = 0;

        Message = Text.create(StaticFont.SegoeUILight14, t, x + 20, y + 20, spacing, WIDTH - 40, 0, Renderable.Fades.NONE, 0.0352941176470588f, 0.0392156862745098f, 0.0431372549019608f, 1);
        Message.index += 3;

        MessageShadow = Text.create(StaticFont.SegoeUILight14, t, x + 21, y + 21, spacing, WIDTH - 40, 0, Renderable.Fades.NONE, 0.1686274509803922f, 0.2509803921568627f, 0.3137254901960784f, 1);
        MessageShadow.index += 2;


        for (int i = 0; i < Message.getLineWidth().length; i++) {
            System.out.println("Line " + i + " Message.getLineWidth()[i] " + Message.getLineWidth()[i]);
            Component Strip = new Component("$dialog text strip #" + i, x + 20, y + ((i + 1) * 20), Message.getLineWidth()[i], Message.getFont().getMetrics().Height);
            Strip.index += 1;
            Strip.rgba(0.0784313725490196f, 0.1725490196078431f, 0.2470588235294118f, 255);
            Strips.add(Strip);
        }
       
        ComponentRenderer cr = Otse.getInstance().getComponentRenderer();

        //synchronized (queue) {
            cr.queue.addAll(Strips);
        //}

        System.out.println("end constructing dialog");

    }
}
TOP

Related Classes of fm.ak.client.twod.Dialog

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.