Skip to content

ButtonR Class Accessors and Mutators

Alex Ricciardi edited this page Feb 5, 2023 · 3 revisions
    //----------------------------------------------------------------------------------
    //----------------------------------------------------------------------------------

    // Accessors Methods
    //----------------------------------------------------------------------------------


    /*----------------------------------------------------

        draw button
        Not inherited by child classes

     -----------------------------------------------------*/
    virtual void draw();


    //----------------------------------------------------------------------------------
    //----------------------------------------------------------------------------------

    // Mutators Methods
    //---------------------------------------------------------------------------------


     /*----------------------------------------------------------

        Builds the botton,
        computes size from the font size and length of the text

     -----------------------------------------------------------*/
    void buildBtn();


    /*----------------------------------------------------

        Updates button

     -----------------------------------------------------*/
    int update();

    /*----------------------------------------------------

        Sets font size and
        Resizes button to fit text
        Takes a string

     -----------------------------------------------------*/
    void setFontSize(float fontSize);

    /*----------------------------------------------------

        Sets font size and
        does NOT resizes button to fit text
        Takes a string

     -----------------------------------------------------*/
    void setFontSizeNoResize(float fontSize);

    /*----------------------------------------------------

         Sets text and
         Resizes button to fit text
         Takes a string

     -----------------------------------------------------*/
    void setText(string text);

    /*----------------------------------------------------

         Sets text and
         does NOT resizes button to fit text
         Takes a string

     -----------------------------------------------------*/
    void setTextNoResize(string text);

    /*----------------------------------------------------

         Sets text position
         does NOT resizes button to fit text

     -----------------------------------------------------*/
    void setTextPosition(float x, float y);

    /*----------------------------------------------------

        Sets the button position in the screen

     -----------------------------------------------------*/
    void setBtnPosition(float btnX, float btnY);

    /*----------------------------------------------------

        Sets sizes of the button,
        does not resize fonts

     -----------------------------------------------------*/
    void setBtnSize(float btnWidth, float btnHeight);

Clone this wiki locally