ドキュメント

View Categories

TextComponent

< 1 min read

TextComponentはtextオブジェクトに設定したテキストを描画します。

text_component.hpp

class TextComponent : public Component
{
public:
  using TEXT = spa::gui::Text<>;

public:
  TextComponent
  (
    MOD mod,
    bool text_update,
    std::string text_str,
    unsigned int text_c_size,
    unsigned char text_color_R,
    unsigned char text_color_G,
    unsigned char text_color_B
  );

  TEXT* get();

  void mask();

  void configure();

  void recapture();

private:
  std::shared_ptr<TEXT> text;
};


text_updateは入力可能を設定します。text_strは初期値、text_c_sizeは文字サイズとtext_colorは文字の色を指定します。

予め用意したサイズのフォントを作成するためにtext_c_sizeは実際にはgui_config.hppにあるサイズを指定します。

gui_config.hpp

const std::vector<unsigned int> c_size{16, 18, 22, 36, 72, 144, 288};


getメソッドでtextオブジェクトのポインタを取得できます。text->textプロパティを書き換えることで表示するテキストを変更します。

maskメソッドはテキストをアスタリスクでマスキングします。

recaptureメソッドがあります。

ペンディング:現在pc-9800.ttfのみ。使えるフォントを増やす。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です