Class PainterBase

    • Field Detail

      • area

        protected Rectangle area
        The paint area.
      • mouseArea

        protected int mouseArea
        The current area the mouse is over.
      • oldMouseArea

        protected int oldMouseArea
        The last area the mouse was over.
      • offset

        protected int offset
        Indent for text
      • xfactor

        protected double xfactor
        The x scaling factor (based on a resolution of 1024x768).
      • yfactor

        protected double yfactor
        The y scaling factor (based on a resolution of 1024x768)..
      • options

        protected Options options
        The options.
      • areas

        protected int[] areas
        The mouse areas with menu items
      • gameInfo

        protected UpdateInfo gameInfo
        The game.
      • bigFont

        protected Font bigFont
        A big font.
      • medFont

        protected Font medFont
        A medium size font.
      • smallFont

        protected Font smallFont
        A small font.
      • verysmallFont

        protected Font verysmallFont
        A small font.
      • state

        protected GameState state
        The game state. Updated directly before painting.
    • Constructor Detail

      • PainterBase

        public PainterBase()
        Base constructor. Does nothing.
    • Method Detail

      • getBaseWidth

        public int getBaseWidth()
        Gets the base width of this painter.
        Specified by:
        getBaseWidth in interface Painter
        Returns:
        1920.
      • getBaseHeight

        public int getBaseHeight()
        Gets the base height of this painter.
        Specified by:
        getBaseHeight in interface Painter
        Returns:
        1061.
      • setArea

        public void setArea​(Rectangle area)
        Sets the size for this Painter. All graphic operations should be restricted to this area.
        Specified by:
        setArea in interface Painter
        Parameters:
        area - The area.
      • getArea

        public Rectangle getArea()
        Gets the size for this Painter.
        Specified by:
        getArea in interface Painter
        Returns:
        The size of the area.
      • getWidth

        public int getWidth()
        Gets this fields width.
        Returns:
        The width
      • getHeight

        public int getHeight()
        Gets this fields height.
        Returns:
        The height
      • setOptions

        public void setOptions​(Options opt)
        Sets the options.
        Specified by:
        setOptions in interface Painter
        Parameters:
        opt - The new options.
      • getRepaintFactor

        protected int getRepaintFactor()
        Gets a factor for repaint cycles depending on the current frame rate (1 for 20 FPS).
        Returns:
        e.g. 1 fo 20FPS, 6 for 120 FPS
      • draw

        protected void draw​(Graphics g,
                            java.lang.String s,
                            int indent,
                            int yPosition,
                            int c,
                            Font f)
        Draws a string on a virtual 20*25 coordinate system.
        Parameters:
        g - The Graphics to draw on.
        s - The string.
        indent - The x indent.
        yPosition - The y Position.
        c - The color.
        f - The Font.
      • drawShaded

        protected void drawShaded​(Graphics g,
                                  java.lang.String s,
                                  int x,
                                  int y,
                                  int c,
                                  Font f)
        Draws a shaded string.
        Parameters:
        g - The Graphics to draw on.
        s - The string.
        x - The x indent.
        y - The y Position.
        c - The color.
        f - The Font.
      • drawShaded

        protected void drawShaded​(Graphics g,
                                  java.lang.String s,
                                  int x,
                                  int y,
                                  int c,
                                  int shadeColor,
                                  Font f)
        Draws a shaded string.
        Parameters:
        g - The Graphics to draw on.
        s - The string.
        x - The x indent.
        y - The y Position.
        c - The color.
        shadeColor - The shade color.
        f - The Font.
      • getIndent

        public int getIndent()
        The x indent
        Returns:
        The indent.
      • paint

        public abstract void paint​(Graphics g,
                                   GameState state)
        Paints on the screen. Override this method for own graphic effects.
        Specified by:
        paint in interface Painter
        Parameters:
        g - The graphics to paint on.
        state - The game state.
      • setController

        public void setController​(StarpointController controller)
        Sets the reference to the Controller.
        Parameters:
        controller - Controller
      • setFontSize

        protected void setFontSize()
        Sets the standard fonts.
      • getXFactor

        public double getXFactor()
        Gets the x scaling factor
        Specified by:
        getXFactor in interface Painter
        Returns:
        the xfactor
      • getYFactor

        public double getYFactor()
        Gets the y scaling factor
        Specified by:
        getYFactor in interface Painter
        Returns:
        the yfactor
      • isInputController

        public boolean isInputController()
        Returns true, if the painter implements InputController.
        Returns:
        true, if implementing interface InputController.
      • setLevel

        public void setLevel​(Level currentLevel)
        Sets the level.
        Parameters:
        currentLevel - The level.
      • setState

        public void setState​(GameState state)
        Sets the game state reference during painting routine.
        Specified by:
        setState in interface Painter
        Parameters:
        state - The state.
      • onStartGame

        public void onStartGame​(GameState state)
        Called when a new game is started.
        Specified by:
        onStartGame in interface Painter
        Parameters:
        state - The game state.
      • getEditor

        public StarpointEditor getEditor()
        Gets the editor.
        Returns:
        The editor.
      • isActive

        public boolean isActive()
        Checks, if this painter is currently active and wants to handle events.
        Specified by:
        isActive in interface Painter
        Returns:
        true as default.