Class PainterPlayerInfos

  • All Implemented Interfaces:
    Painter
    Direct Known Subclasses:
    PainterInventory

    public class PainterPlayerInfos
    extends PainterBase
    Player display for the Starpoint game. Paints the figures level scores in the upper part and the panels for each player below. Base size is 400*1021 pixels. Paints 1 - 4 panels for figure information. Adjusts itself for correct number of panels (one for each player in 1 or multiplayer game, one for (the first four) figures in demo game). Capable of 3 different designs options. Slot display is scaled down depending on number of panels to display. Animations are painted for - changes in the current levels rank - for level score to player score transfer when level is won - for extra lives - for new slots. These animations are handled by own state caches.
    • Field Detail

      • XOFFSETS_STATEBARS

        protected final int[][] XOFFSETS_STATEBARS
      • YOFFSETS_STATEBARS

        protected final int[][] YOFFSETS_STATEBARS
      • XOFFSETS_STATE

        protected final int[][] XOFFSETS_STATE
      • YOFFSETS_STATE

        protected final int[][] YOFFSETS_STATE
      • XOFFSETS_ITEM

        protected final int[] XOFFSETS_ITEM
      • YOFFSETS_ITEM

        protected final int[] YOFFSETS_ITEM
      • YOFFSETS_FIGUREINFO

        protected final int[] YOFFSETS_FIGUREINFO
      • YOFFSETS_MAXENERGY

        protected final int[] YOFFSETS_MAXENERGY
      • DRAW_ENERGYS_AS_CIRCLE

        protected final boolean[] DRAW_ENERGYS_AS_CIRCLE
      • DRAW_HEATS_AS_CIRCLE

        protected final boolean[] DRAW_HEATS_AS_CIRCLE
      • DRAW_STATEBARSS_VERTICAL

        protected final boolean[] DRAW_STATEBARSS_VERTICAL
      • XOFFSETS_ENERGY

        protected final int[] XOFFSETS_ENERGY
      • YOFFSETS_ENERGY

        protected final int[] YOFFSETS_ENERGY
      • XRADIUSS_ENERGYBAR

        protected final int[] XRADIUSS_ENERGYBAR
      • YRADIUSS_ENERGYBAR

        protected final int[] YRADIUSS_ENERGYBAR
      • HEIGHTS_ENERGY

        protected final int[] HEIGHTS_ENERGY
      • ENERGY_FACTORS

        protected int[] ENERGY_FACTORS
      • XOFFSETS_HEAT

        protected final int[] XOFFSETS_HEAT
      • YOFFSETS_HEAT

        protected final int[] YOFFSETS_HEAT
      • XRADIUSS_HEATBAR

        protected final int[] XRADIUSS_HEATBAR
      • YRADIUSS_HEATBAR

        protected final int[] YRADIUSS_HEATBAR
      • HEIGHTS_HEAT

        protected final int[] HEIGHTS_HEAT
      • HEAT_FACTORS

        protected double[] HEAT_FACTORS
      • XOFFSET_INVENTORY

        protected int XOFFSET_INVENTORY
      • XOFFSET_LEVELINFO

        protected int XOFFSET_LEVELINFO
      • WIDTH_LEVELINFO

        protected int WIDTH_LEVELINFO
      • YOFFSET_LEVELINFO

        protected int YOFFSET_LEVELINFO
      • XRADIUS_ENERGYBAR

        protected int XRADIUS_ENERGYBAR
      • YRADIUS_ENERGYBAR

        protected int YRADIUS_ENERGYBAR
      • XRADIUS_HEATBAR

        protected int XRADIUS_HEATBAR
      • YRADIUS_HEATBAR

        protected int YRADIUS_HEATBAR
      • XOFFSET_STATEBAR

        protected int[] XOFFSET_STATEBAR
      • YOFFSET_STATEBAR

        protected int[] YOFFSET_STATEBAR
      • YOFFSET_STATE

        protected int[] YOFFSET_STATE
      • XOFFSET_STATE

        protected int[] XOFFSET_STATE
      • YOFFSET_ITEM

        protected int YOFFSET_ITEM
      • XOFFSET_ITEM

        protected int XOFFSET_ITEM
      • XOFFSET_FIGUREINFO

        protected int XOFFSET_FIGUREINFO
      • WIDTH_FIGUREINFO

        protected int WIDTH_FIGUREINFO
      • YOFFSET_FIGUREINFO

        protected int YOFFSET_FIGUREINFO
      • HEIGHT_HEAT

        protected int HEIGHT_HEAT
      • XOFFSET_HEAT

        protected int XOFFSET_HEAT
      • YOFFSET_HEAT

        protected int YOFFSET_HEAT
      • HEIGHT_ENERGY

        protected int HEIGHT_ENERGY
      • ENERGY_FACTOR

        protected static double ENERGY_FACTOR
        Factor for energy bar, players energy is divided by factor to calculate energy bar width.
      • HEAT_FACTOR

        protected static double HEAT_FACTOR
        Factor for heat bar, players heat is divided by factor to calculate energy bar width.
      • XOFFSET_ENERGY

        protected int XOFFSET_ENERGY
        X Offset for energy display.
      • YOFFSET_ENERGY

        protected int YOFFSET_ENERGY
      • YOFFSET_MAXENERGY

        protected int YOFFSET_MAXENERGY
      • DRAW_ENERGY_AS_CIRCLE

        protected boolean DRAW_ENERGY_AS_CIRCLE
      • DRAW_HEAT_AS_CIRCLE

        protected boolean DRAW_HEAT_AS_CIRCLE
      • DRAW_STATEBARS_VERTICAL

        protected boolean DRAW_STATEBARS_VERTICAL
      • PLAYERPANEL_HEIGHT_IMG

        protected final int PLAYERPANEL_HEIGHT_IMG
        Height of upper part of player panel.
        See Also:
        Constant Field Values
      • LEVELINFO_HEIGHT

        protected int LEVELINFO_HEIGHT
        Height of Levelinfo-panel.
      • LEVELINFO_HEIGHTS

        protected static final int[] LEVELINFO_HEIGHTS
        Y Offset for first player-panel.
      • SLOTWIDTHS

        protected double[] SLOTWIDTHS
        Widths of the slots depending on panel count.
      • SLOTHEIGHTS

        protected int[] SLOTHEIGHTS
        Heights of the slots depending on panel count.
      • SLOTS_IN_ROWS

        protected int[] SLOTS_IN_ROWS
        Number of slots displayed in one row depending on panel count.
      • SLOT_FACTORS

        protected double[] SLOT_FACTORS
        Slots scaling factor depending on panel count.
      • NORMAL

        protected static final int NORMAL
        Constant while level over effects are shown for paint mode.
        See Also:
        Constant Field Values
      • PLAYERPANEL_HEIGHT_ABSS

        protected int[] PLAYERPANEL_HEIGHT_ABSS
        Height of upper part of player panel.
      • PLAYERPANEL_HEIGHT_ABS

        protected int PLAYERPANEL_HEIGHT_ABS
        Height of upper part of player panel.
      • PLAYERPANEL_HEIGHT

        public int PLAYERPANEL_HEIGHT
        Height of player panels.
      • SLOTWIDTH

        protected double SLOTWIDTH
        Width of slot panel.
      • SLOTHEIGHT

        protected int SLOTHEIGHT
        Height of slot panel.
      • SLOTS_IN_ROW

        protected int SLOTS_IN_ROW
        Number of slots in one row.
      • SLOT_FACTOR

        protected double SLOT_FACTOR
        Factor for slot scaling.
      • slotCounts

        protected java.util.Map<FigureState,​java.lang.Integer> slotCounts
        Map storing the slot counts for each player for new slot animation.
      • slotAnims

        protected java.util.Map<FigureState,​java.util.Map<java.lang.Integer,​java.lang.Integer>> slotAnims
        Map storing the animation indices for new solt animation.
      • oldRank

        protected java.util.Map<FigureState,​java.lang.Integer> oldRank
        Map storing the ranks for each player for rank change animation.
      • rankAnims

        protected java.util.Map<FigureState,​java.lang.Integer> rankAnims
        Map storing the animation indices for new solt animation.
    • Constructor Detail

      • PainterPlayerInfos

        public PainterPlayerInfos()
        Creates a new player canvas.
    • Method Detail

      • determineScalingConstants

        protected void determineScalingConstants​(GameState state)
        Sets the scaling factors and sizes of single panels.
        Parameters:
        state -
      • paintLevelInfoPanel

        protected void paintLevelInfoPanel​(Graphics g2)
        Parameters:
        g2 -
      • paintRoundCount

        protected void paintRoundCount​(Graphics g,
                                       GameState state,
                                       Font f)
        Paints the round counter.
        Parameters:
        g - The Graphics.
        state -
        f - The Font.
      • getFigureScoreColor

        protected int getFigureScoreColor​(FigureState fig)
        Parameters:
        fig -
        Returns:
      • getRankYCoordinate

        protected int getRankYCoordinate​(FigureState fig,
                                         int fakt,
                                         int i)
        Parameters:
        fig -
        fakt -
        i -
        Returns:
      • getDisplayScore

        protected int getDisplayScore​(GameState state,
                                      FigureState fig,
                                      int index)
        Parameters:
        fig -
        Returns:
      • checkForScoreAnimation

        protected boolean checkForScoreAnimation​(GameState state,
                                                 FigureState fig,
                                                 int index)
        Checks, if score animation is to display for this figure.
        Parameters:
        fig -
        index -
        Returns:
      • isBetter

        public boolean isBetter​(FigureState f,
                                FigureState test)
        Checks, if the figure f is better than the test figure according to rank in level players.
        Parameters:
        f -
        test -
        Returns:
      • updatePlayers

        public void updatePlayers​(Graphics g2,
                                  GameState state)
        Draws the figure panels to the screen
        Parameters:
        g2 - The graphics
        state - The state to display
      • paintFigureState

        protected void paintFigureState​(Graphics g2,
                                        GameState state,
                                        FigureState f,
                                        int yOffset,
                                        int index)
        Paints the panel for one player.
        Parameters:
        g2 - The graphics
        state - The state to display
        f - The figure state.
        yOffset - Y offset for painting.
        index - The figures index.
      • drawPlayerPanel

        protected void drawPlayerPanel​(Graphics g2,
                                       int colorIndex,
                                       int yoffset)
        Parameters:
        g2 -
        colorIndex -
        yoffset -
      • drawSlots

        protected void drawSlots​(Graphics g2,
                                 FigureState f,
                                 int i,
                                 int offset)
        Draws the inventory.
        Parameters:
        g2 - The Graphics.
        f - The figure.
        i -
      • getPanelCount

        public int getPanelCount​(GameState state)
        Checks, if the big panel should be shown.
        Returns:
        true, if big player panel should be shown.
      • getDemoPanelCount

        protected int getDemoPanelCount​(GameState state)
        Gets the number of panels to show in demo
        Returns:
      • getPanelColorIndex

        protected int getPanelColorIndex​(FigureState f)
        Gets the panel index depending on the player color.
        Parameters:
        f - The figure.
        Returns:
        The panel index.
      • drawItem

        protected void drawItem​(Graphics g2,
                                int player,
                                ItemState itemState,
                                int offset)
        Draws the Item.
        Parameters:
        g2 - The graphics
        player - The figure
        itemState - The item
        offset - The y offset.
      • drawEnergy

        protected void drawEnergy​(Graphics g2,
                                  int player,
                                  int energy,
                                  int offset)
        Draws the energy level
        Parameters:
        g2 - The graphics
        player - The figure
        energy - The energy level
        offset - The offset.
      • drawEnergyBar

        protected void drawEnergyBar​(Graphics g2,
                                     int energy,
                                     int offset)
        Parameters:
        g2 -
        energy -
        offset -
      • drawEnergyCircle

        protected void drawEnergyCircle​(Graphics g,
                                        int energy,
                                        int offset)
        Parameters:
        g -
        energy -
        offset -
      • drawRoundBar

        protected void drawRoundBar​(Graphics g,
                                    int offset,
                                    int maxAngle,
                                    int xoffset,
                                    int yoffset,
                                    int xradius,
                                    int yradius,
                                    int height,
                                    double factor,
                                    int barIndex,
                                    boolean crossed,
                                    boolean framed)
        Parameters:
        g -
        offset -
        maxAngle -
        height -
        yradius -
        xradius -
        yoffset -
        xoffset -
      • drawMaxEnergy

        protected void drawMaxEnergy​(Graphics g2,
                                     GameState state,
                                     FigureState f,
                                     int offset)
        Draws the max energy level
        Parameters:
        g2 - The graphics
        f - The figure
        offset - The y offset for painting.
      • drawMaxEnergyBar

        protected void drawMaxEnergyBar​(Graphics g2,
                                        GameState state,
                                        FigureState f,
                                        int offset)
        Draws the max energy level as bar.
        Parameters:
        g2 - The graphics
        f - The figure
        offset - The y offset for painting.
      • drawMaxEnergyCircle

        protected void drawMaxEnergyCircle​(Graphics g,
                                           FigureState f,
                                           int offset)
        Draws the max energy level as circle.
        Parameters:
        g - The graphics
        f - The figure
        offset - The y offset for painting.
      • drawHeating

        protected void drawHeating​(Graphics g2,
                                   FigureState f,
                                   int i,
                                   int offset)
        Draws the heat level
        Parameters:
        g2 - The graphics
        f - The figure
        i - Figure index
        offset - The y offset for painting.
      • drawHeatingBar

        protected void drawHeatingBar​(Graphics g2,
                                      FigureState f,
                                      int i,
                                      int offset)
        Draws the heat level as bar.
        Parameters:
        g2 - The graphics
        f - The figure
        i - Figure index
        offset - The y offset for painting.
      • drawHeatingCircle

        protected void drawHeatingCircle​(Graphics g,
                                         FigureState f,
                                         int i,
                                         int offset)
        Draws the heat level as circle.
        Parameters:
        g - The graphics
        f - The figure
        i - Figure index
        offset - The y offset for painting.
      • drawFigureInfo

        protected void drawFigureInfo​(Graphics g2,
                                      GameState state,
                                      FigureState fig,
                                      int offset,
                                      boolean drawScore,
                                      int index)
        Draws the figure info (name, points ).
        Parameters:
        g2 - The graphics.
        state - The GameState.
        fig - The figure.
        offset - Offset depending on Figure index.
        drawScore - Flag, if score should be drawn.
        index - The figure index.
      • getDisplayPointSum

        protected long getDisplayPointSum​(GameState state,
                                          FigureState fig,
                                          int index)
        Gets the point sum to display. Implements level over score animation.
        Parameters:
        fig - The Figure.
        Returns:
        The point sum to display, with count down after level over.
      • drawLifes

        protected void drawLifes​(Graphics g2,
                                 FigureState fig,
                                 int offset)
        Draws the players lifes.
        Parameters:
        g2 - The graphics.
        fig - The figure.
        offset - Offset depending on Figure index.
      • drawState

        protected void drawState​(Graphics g2,
                                 GameState state,
                                 FigureState f,
                                 int i,
                                 int offset)
        Draws shielding etc.
        Parameters:
        g2 - The graphics
        f - The figure
        i - Figure index
        offset - Offset depending on Figure index.
      • drawStateBars

        protected void drawStateBars​(Graphics g2,
                                     GameState state,
                                     FigureState f,
                                     int offset)
        Draws the state indicators for shielding, hover, invisibility and invulnerability.
        Parameters:
        g2 - The graphics.
        f - The figure
        offset - The y offset.
      • getShieldValueString

        protected java.lang.String getShieldValueString​(FigureState f,
                                                        int j)
        Gets the String to display for shield display.
        Parameters:
        f - The Figure
        j - The shielding index.
        Returns:
        The String to display
      • drawStringCentered

        protected void drawStringCentered​(Graphics g2,
                                          java.lang.String s,
                                          int xoffset,
                                          int yoffset,
                                          int color,
                                          int bgColor,
                                          Font f)
        Parameters:
        g2 -
        s -
        xoffset -
        yoffset -
        color -
        bgColor -
        f -
      • drawVerticalStateBar

        protected void drawVerticalStateBar​(Graphics g2,
                                            int xoffset,
                                            int yoffset,
                                            int factor,
                                            int maxx,
                                            java.lang.String image,
                                            double scalingFactor)
        Parameters:
        g2 -
        maxx -
        scalingFactor -
      • drawHorizontalStateBar

        protected void drawHorizontalStateBar​(Graphics g2,
                                              int xoffset,
                                              int yoffset,
                                              int factor,
                                              int maxx,
                                              java.lang.String image,
                                              double scalingFactor)
        Parameters:
        g2 -
        maxx -
        scalingFactor -
      • createOrGetSlotAnimations

        protected java.util.Map<java.lang.Integer,​java.lang.Integer> createOrGetSlotAnimations​(FigureState f)
        Parameters:
        f -
      • paintItemAsInfo

        public void paintItemAsInfo​(Graphics g,
                                    ItemState itemState,
                                    int xCenter,
                                    int yCenter,
                                    double factor)
        Paints the thing on infopanels on the screen.
        Parameters:
        g - The graphics to paint on.
        itemState - The item.
        xCenter - The x center coordinate.
        yCenter - The y center coordinate.
        factor - Scaling factor.
      • panelDesignHasChanged

        protected boolean panelDesignHasChanged​(GameState state)