Class HUD_element

java.lang.Object
me.iron.WarpSpace.Mod.HUD.client.HUD_element

class HUD_element
extends java.lang.Object
STARMADE MOD CREATOR: Max1M DATE: 20.02.2021 TIME: 15:14
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  HUD_element.ElementType
    type to group elements.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.util.List<HUD_element> children
    attached children that get scaled and moved with the original.
    private boolean drawCondition  
    SpriteList enumValue  
    CustomHudImage image  
    private HUD_element mother  
    private javax.vecmath.Vector3f moveStep  
    boolean playShutter  
    private javax.vecmath.Vector3f pos  
    private javax.vecmath.Vector3f pxPos  
    private javax.vecmath.Vector3f pxScale  
    private javax.vecmath.Vector3f scale  
    private TextElement textElement  
    private javax.vecmath.Vector3f textElementOffset  
    private javax.vecmath.Vector3f textElementPxPos  
    HUD_element.ElementType type  
  • Constructor Summary

    Constructors 
    Constructor Description
    HUD_element​(javax.vecmath.Vector3f pos, javax.vecmath.Vector3f scale, javax.vecmath.Vector3f moveStep, SpriteList enumValue, HUD_element.ElementType type)
    creates a HUD element
    HUD_element​(HUD_element reference, SpriteList image, HUD_element.ElementType type)  
  • Method Summary

    Modifier and Type Method Description
    void addChild​(HUD_element child)
    add a child element which is moved and scaled with this HUD element
    java.util.List<HUD_element> getChildren()
    get children objects that are attached to this HUDelement.
    javax.vecmath.Vector3f getMoveStep()  
    javax.vecmath.Vector3f getPos()
    returns copy of position
    javax.vecmath.Vector3f getPxPos()
    returns clone of position in pixels on screen.
    javax.vecmath.Vector3f getPxScale()
    returns copy of scale of image on current screen. !
    javax.vecmath.Vector3f getScale()
    returns copy of scale (% of screen) (screen or orgininal sprite?)
    TextElement getTextElement()
    return the attached textelement, null if doesnt exist
    javax.vecmath.Vector3f getTextElementOffset()  
    javax.vecmath.Vector3f getTextElementPxPos()  
    boolean isDrawCondition()
    check if draw condition is met
    void setDrawCondition​(boolean drawCondition)
    set draw condition for this hud element. doesnt work
    void setMoveStep​(javax.vecmath.Vector3f moveStep)
    not used yet. intended for lerped movement.
    void setPos​(javax.vecmath.Vector3f pos)
    sets position to new value, is inhertied from attached children.
    void SetPos​(javax.vecmath.Vector3f relPos, float lerpTime)
    set new position with time it takes to reach that pos !!
    void setPxPos​(javax.vecmath.Vector3f pxPos)
    sets pixelposition on screen to this value.
    void setPxScale​(javax.vecmath.Vector3f pxScale)
    sets value for scale on current screen.
    void setScale​(javax.vecmath.Vector3f scale)
    sets scale to new values.
    void setTextElement​(TextElement textElement)
    set textelement to be attached to this HUD element.
    void setTextElementOffset​(javax.vecmath.Vector3f offset, boolean absolute)
    offset textelement from
    void setTextElementPxPos​(javax.vecmath.Vector3f textElementPxPos)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • HUD_element

      public HUD_element​(javax.vecmath.Vector3f pos, javax.vecmath.Vector3f scale, javax.vecmath.Vector3f moveStep, SpriteList enumValue, HUD_element.ElementType type)
      creates a HUD element
      Parameters:
      pos - position in % on Full HD screen.
      scale - scale in % on full hd screen
      moveStep - x
      enumValue - x
      type - x
    • HUD_element

      public HUD_element​(HUD_element reference, SpriteList image, HUD_element.ElementType type)
      Parameters:
      reference - what position or scale group this belongs to. used for moving and scaling.
      image - image to use (from spritelist)
      type - up, down, background, etc, used for collectivley drawing or disabling.
  • Method Details

    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • SetPos

      public void SetPos​(javax.vecmath.Vector3f relPos, float lerpTime)
      set new position with time it takes to reach that pos !!doesnt lerp atm, planned feature
      Parameters:
      relPos - target position relative in % of screen. f.e. center = 0.5,0.5,0
      lerpTime - time to fullfill movement
    • getPos

      public javax.vecmath.Vector3f getPos()
      returns copy of position
      Returns:
      position
    • setPos

      public void setPos​(javax.vecmath.Vector3f pos)
      sets position to new value, is inhertied from attached children.
      Parameters:
      pos - position
    • getScale

      public javax.vecmath.Vector3f getScale()
      returns copy of scale (% of screen) (screen or orgininal sprite?) //TODO findout
      Returns:
      scale
    • setScale

      public void setScale​(javax.vecmath.Vector3f scale)
      sets scale to new values.
      Parameters:
      scale - scale in percent of original image (i think?) //TODO findout
    • getMoveStep

      public javax.vecmath.Vector3f getMoveStep()
    • setMoveStep

      public void setMoveStep​(javax.vecmath.Vector3f moveStep)
      not used yet. intended for lerped movement.
      Parameters:
      moveStep - x
    • getPxPos

      public javax.vecmath.Vector3f getPxPos()
      returns clone of position in pixels on screen.
      Returns:
      pixel pos (x,y,z)
    • setPxPos

      public void setPxPos​(javax.vecmath.Vector3f pxPos)
      sets pixelposition on screen to this value.
      Parameters:
      pxPos - absolute position on screen
    • getPxScale

      public javax.vecmath.Vector3f getPxScale()
      returns copy of scale of image on current screen. !not size of image in pixel, but abstract scale !!IDK what this is anymore. marked with todo
      Returns:
      ?
    • setPxScale

      public void setPxScale​(javax.vecmath.Vector3f pxScale)
      sets value for scale on current screen.
      Parameters:
      pxScale - scale in pixels
    • getChildren

      public java.util.List<HUD_element> getChildren()
      get children objects that are attached to this HUDelement.
      Returns:
      list of attached children
    • addChild

      public void addChild​(HUD_element child)
      add a child element which is moved and scaled with this HUD element
      Parameters:
      child - HUD element child to be attached
    • getTextElement

      public TextElement getTextElement()
      return the attached textelement, null if doesnt exist
      Returns:
      textelement
    • setTextElement

      public void setTextElement​(TextElement textElement)
      set textelement to be attached to this HUD element.
      Parameters:
      textElement - element which should be attached.
    • setTextElementOffset

      public void setTextElementOffset​(javax.vecmath.Vector3f offset, boolean absolute)
      offset textelement from
      Parameters:
      offset - vector3f offset from attached position.
      absolute - use absolute (true) or relative (false)
    • getTextElementOffset

      public javax.vecmath.Vector3f getTextElementOffset()
    • isDrawCondition

      public boolean isDrawCondition()
      check if draw condition is met
      Returns:
      true or false
    • setDrawCondition

      public void setDrawCondition​(boolean drawCondition)
      set draw condition for this hud element. doesnt work
      Parameters:
      drawCondition - condition on which to draw element.
    • getTextElementPxPos

      public javax.vecmath.Vector3f getTextElementPxPos()
    • setTextElementPxPos

      public void setTextElementPxPos​(javax.vecmath.Vector3f textElementPxPos)