Module Simula

Class RTS_TextElement

All Implemented Interfaces:
Runnable, RTS_Drawing.Animable

public class RTS_TextElement extends RTS_Link implements RTS_Drawing.Animable
Additional System class TextElement.
 Link class TextElement(t,x,y); Value t; Text t; Long Real x,y;
 begin Integer COLOR,STROKE; Text T; Long Real X,Y;
       ref(Font) FONT; ! Java Class Font is not visible in Simula ;

       Procedure setColor(color); Integer color; COLOR := color;  
       Procedure setStroke(width); Real width; CURRENT_STROKE_WIDTH := width; 

       Procedure setFontStylePlain;      FONT :- FONT.deriveFont(Font.PLAIN);  
       Procedure setFontStyleBold;       FONT :- FONT.deriveFont(Font.BOLD); 
       Procedure setFontStyleItalic;     FONT :- FONT.deriveFont(Font.ITALIC); 
       Procedure setFontStyleBoldItalic; FONT :- FONT.deriveFont(Font.BOLD|Font.ITALIC); 
          
       Procedure setFontSize(size); Real size; FONT :- FONT.deriveFont(size); 
       Real Procedure getFontSize; getFontSize := FONT.getSize2D;
 
       Procedure setText(t); Value t; Text t; T :- t;
       Procedure moveTo(x,y,speed); Long Real x,y,speed; begin X := x; Y := y; ... end;
       Procedure instantMoveTo(x,y); Long Real x,y; begin X := x; Y := y; end;
       
       T :- t; X := x; Y := y;
       
       COLOR := CURRENT_DRAW_COLOR;
       STROKE := CURRENT_STROKE_WIDTH;
       FONT :- CURRENT_FONT;
       
       into(RENDERING_SET);

 end;
 
Link to GitHub: Source File.
Author:
Øystein Myhre Andersen
  • Field Details

    • animation

      final RTS_Drawing animation
      The current animation.
    • x

      double x
      The X coordinate
    • y

      double y
      The Y coordinate
    • str

      String str
      The current string text.
    • color

      Color color
      The current color.
    • font

      Font font
      The current Font.
    • stroke

      Stroke stroke
      The current stroke.
  • Constructor Details

    • RTS_TextElement

      public RTS_TextElement(RTS_RTObject SL, RTS_TXT txt, double x, double y)
      Create a new _TextElement.
      Parameters:
      SL - staticLink
      txt - the initial text
      x - the X coordinate
      y - the Y coordinate
    • RTS_TextElement

      public RTS_TextElement(RTS_RTObject SL, String str, double x, double y)
      Create a new _TextElement.
      Parameters:
      SL - staticLink
      str - the initial text
      x - the X coordinate
      y - the Y coordinate
  • Method Details

    • _STM

      public RTS_TextElement _STM()
      Description copied from class: RTS_RTObject
      Method representing the Statements in this Block
      This method is virtual and must be redefined in blocks.
      Overrides:
      _STM in class RTS_Link
      Returns:
      a pointer to this _RTObject
    • setFontStylePlain

      public void setFontStylePlain()
      Set font style plain.
    • setFontStyleBold

      public void setFontStyleBold()
      Set font style bold.
    • setFontStyleItalic

      public void setFontStyleItalic()
      Set font style talic.
    • setFontStyleBoldItalic

      public void setFontStyleBoldItalic()
      Set font style bold and italic.
    • setStroke

      public void setStroke(float size)
      Set stroke size.
      Parameters:
      size - stroke size
    • getFontSize

      public float getFontSize()
      Get font size.
      Returns:
      the font size
    • setFontSize

      public void setFontSize(float size)
      Set font size.
      Parameters:
      size - font size
    • setColor

      public void setColor(int rgb)
      Set color.
      Parameters:
      rgb - color
    • setText

      public void setText(RTS_TXT t)
      Set new text.
      Parameters:
      t - new text
    • instantMoveTo

      public void instantMoveTo(double x, double y)
      Instant move.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
    • moveTo

      public void moveTo(double x2, double y2, double speed)
      Rolling motion to a new position.
      Parameters:
      x2 - the X coordinate
      y2 - the Y coordinate
      speed - pixels per milli-second
    • paint

      public void paint(Graphics2D g)
      Description copied from interface: RTS_Drawing.Animable
      Paint this Animable
      Specified by:
      paint in interface RTS_Drawing.Animable
      Parameters:
      g - the graphic context