Package thegame.gui

Source Code of thegame.gui.SelectionMenuIconCell

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package thegame.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import net.sf.jiga.xtended.impl.Sprite;
import net.sf.jiga.xtended.impl.game.RenderingScene;
import net.sf.jiga.xtended.impl.game.gl.GLText;
import net.sf.jiga.xtended.impl.game.gl.SpriteGLHandler;
import net.sf.jiga.xtended.impl.game.gl.geom.GLGeom;
import thegame.FieldGui;

/**
*
* @author www.b23prodtm.info
*/
public class SelectionMenuIconCell extends SelectionMenuCell {

    Sprite icon;

    public SelectionMenuIconCell(FieldGui gui, String label, Sprite icon, Runnable doSelection, Runnable doEscape) {
        super(gui, label, doSelection, doEscape);
        this.icon = icon;
    }
    SpriteGLHandler glSprite = null;

    @Override
    protected void GLpaintComponent(RenderingScene gld, double z, int fx, Point fx_loc, Color fx_color) {
        Dimension iconSize = gui.ICONSIZE;
        Rectangle bounds = getBounds();
        if (glSprite == null) {
            Sprite icon = this.icon instanceof Sprite ? this.icon : RenderingScene._getLogo(gui.getScene(), gui.rb.getString("ICON"), iconSize);
            glSprite = RenderingScene._GLloadSprite(icon, gui.getScene());
        }
            Sprite._GLRenderSprite(gld, glSprite, bounds, z, fx, fx_loc, fx_color, 0, null, null,null);
            Color c = (isSelected() ? selectable.selectionColor.brighter() : isCellHasFocus() ? selectable.selectionColor : selectable.selectionColor.darker());
            GLGeom._GLdrawRoundRect(gld, hashCode(), true, 3f, bounds, z, GLGeom.getCWrgbaColors(c, gui.glow.glow), fx, fx_loc, fx_color);
            Dimension d = RenderingScene._GLtoGraphicalMetrics(name, gld);
            GLText._GLRenderText2D(gld, name, (float) bounds.x + (float) (bounds.getWidth() - d.width) / 2f, (float) bounds.getMaxY() + 4f, (float) z, fx_color, fx, fx_loc);
    }
   
}

TOP

Related Classes of thegame.gui.SelectionMenuIconCell

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.