bitmap-text-object.rst 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .. include:: ../_header.rst
  2. BitmapText
  3. ----------
  4. The `Phaser.GameObjects.BitmapText <https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.BitmapText.html>`_ is widely used in Phaser_ game development, to display texts.
  5. You can create a `Bitmap Text <bitmap-text-object.html>`_ object in two ways:
  6. * Dragging a `BitmapText built-in block <blocks-view-integration.html>`_ and dropping it on the scene.
  7. * Dragging a `BitmapFontFile <https://photonstorm.github.io/phaser3-docs/Phaser.Loader.FileTypes.BitmapFontFile.html>`_ key from the |BlocksView|_ and dropping it in the scene. The `BitmapFontFile`_ should be present in an |AssetPackFile|_.
  8. .. image:: ../images/scene-editor-bitmap-text-12212020.webp
  9. :alt: Drop BitmapFont key to create a BitmapText object.
  10. `Bitmap Text`_ objects are created in code using the `bitmapText factory <https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.GameObjectFactory.html#bitmapText__anchor>`_:
  11. .. code::
  12. this.add.bitmapText(100, 150, "desyrel", "Hello bitmap text!", 70, 0);
  13. The Bitmap Text properties
  14. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. The `Bitmap Text`_ type contains many of the `common object properties <common-object-properties.html>`_:
  16. * `Variable properties <variable-properties.html>`_
  17. * `Lists properties <lists-properties.html>`_
  18. * `Transform properties <transform-properties.html>`_
  19. * `Origin properties <origin-properties.html>`_
  20. * `Flip properties <flip-properties.html>`_
  21. * `Visible property <visible-property.html>`_
  22. * `Alpha properties <alpha-properties.html>`_
  23. It also contains the `Text property <text-property.html>`_, that is dedicated to all the objects with texts, and its specific properties:
  24. * The `font <https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.BitmapText.html#font__anchor>`_ property shows the key of the BitmapFont in the |AssetPackFile|_. To change the font, click on the button. It opens the **Select Bitmap Font** dialog.
  25. .. image:: ../images/scene-editor-select-bitmap-font-dialog-12212020.webp
  26. :alt: Select Bitmap Font dialog.
  27. * The `fontSize <https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.BitmapText.html#fontSize__anchor>`_ property.
  28. * The `align <https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.BitmapText.html#align__anchor>`_ property.
  29. * The `letterSpacing <https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.BitmapText.html#letterSpacing__anchor>`_ property.
  30. * The `dropShadow <https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.BitmapText.html#setDropShadow__anchor>`_ related properties.