Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit b665992

Browse files
Update README.md to fit new version features
1 parent 7ed4c34 commit b665992

1 file changed

Lines changed: 26 additions & 16 deletions

File tree

README.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
BGText is a [Blender Game Engine](https://en.wikipedia.org/wiki/Blender_Game_Engine) and [UPBGE](https://upbge.org/) utility aiming to enhance the experience with text objects.
55

66
Motivations
7-
=========
7+
===========
88

99
In the old days of BGE there was a feature known as bitmap text. It allowed you to setup a font texture to a plane, map its UV to a single character, enable the Text option on its material, add an Text property to the object and then show a text based on the property, pretty complicated. Then, it was replaced by the dynamic text, now based on True Type fonts, where you add a text, a property named Text to it and then show a text based on this property.
1010

@@ -29,32 +29,43 @@ Obs: UPBGE fixed the resolution issues on dynamic texts, allowing you to change
2929
I've used dynamic texts over a long time due to its ease, and I know some people that still uses the bitmap text due to the ability to stylize the text with outlines and other stuff. Based on this, I thought to work in some way to overcome those issues.
3030

3131
BGText's Features
32-
==============
32+
=================
3333

3434
BGText tries to mix the pros and fix most of the cons on bitmap texts and dynamic texts, also providing an easy interface to setup each feature (by using game properties). The main features are:
3535

3636
- Easy to use, but also complex if you need.
3737
- Text styles based on textures, so it's highly customizable.
38-
- Character size based on its absolute center.
38+
- Character size based on each character origin.
3939
- Horizontal and vertical character offset (distance between characters).
4040
- Automatic text wrap based on number of characters per line.
4141
- Left, center and right text alignment (justify).
4242
- Literal text or Python expressions (a huge time saver!).
4343
- Color based on predefined color names or RGBA vectors.
4444
- Static text or updated by an specified interval.
45+
- Update texts without the need of constant processing with the message `UpdateText`.
46+
- `UpdateText` messages can update `All` texts or the ones with specific `Id` properties.
4547

46-
BGText is compatible with both vanilla BGE and UPBGE. BGText uses a shape key action to switch each character value. This method is not the lightest one, as in UPBGE I could have made each character a single plane, copy its mesh at runtime (possible only in UPBGE) and warp its UV to change the character shown, but it's using the shape key method to keep compatibility between UPBGE and BGE.
48+
BGText is compatible with both vanilla BGE and UPBGE. BGText uses the replace mesh functionality to switch between characters values.
4749

4850
How To Use
49-
=========
51+
==========
5052

5153
It's simple: on your blend file, link the group BGText from BGText blend file (`File` > `Link`), then you're ready to use it. To setup the text, all you have to do is to add properties to the group instance of BGText, and when you play the game the given properties will be applied.
5254

53-
All the characters on BGText instance will automatically be parented to the group object, so you can do whatever logic you want to on top of the instance, even change the text at runtime (see the use of `Update` property below).
55+
All the characters on BGText instance will automatically be parented to the group object, so you can do whatever logic you want to on top of the instance, even change the text at runtime (see the use of `UpdateText` messages below).
5456

55-
Reference
57+
Messages
5658
========
5759

60+
BGText can trigger specific actions by using messages. To use this functionality, just send a message with a specific subject and you're ready to go.
61+
62+
- **Subject:** `UpdateText`
63+
- **Description:** Updates the text at command without the need of processing the text each frame with the `Update` property.
64+
- **Body:** `All` to update all texts or an `Id` value to update only texts with this value.
65+
66+
Reference
67+
=========
68+
5869
This reference shows which attributes you could use on BGText group instance to change its behavior. You don't need to add all the attributes, only those you want to setup.
5970

6071
- `Text`
@@ -86,7 +97,7 @@ This reference shows which attributes you could use on BGText group instance to
8697
- **Type:** `String`
8798

8899
- `Update`
89-
- **Description:** Updates values constantly (for example, time or life). The value is the number of skipped frames. If value is less than 0, it disables `Update`.
100+
- **Description:** Updates values constantly (for example, time). The value is the number of skipped frames. If value is less than 0, it disables `Update`.
90101
- **Type:** `Integer`
91102

92103
- `Style`
@@ -97,23 +108,22 @@ This reference shows which attributes you could use on BGText group instance to
97108
- **Description:** Name of color or vector. Currently supports `red`, `green`, `blue`, `white`, `black`, `yellow`, `purple`, `cyan` (case insensitive) or a tuple or list like `(1, 0.5, 0.1, 1)` representing RGBA values.
98109
- **Type:** `String`
99110

111+
- `Id`
112+
- **Description:** Identifier of current text. Can be used to update texts with specific identifiers with `UpdateText` messages.
113+
- **Type:** `String`
114+
100115
Known Issues
101-
===========
116+
============
102117

103118
There's some issues I noticed when using BGText, so they are on the list to be fixed or amenized on the future.
104119

105-
Current `Update` functionality is not optimal
106-
----------------------------------------------------------
107-
108-
When updating a text very fast (like a timer), a flickering can be noticed. It happens due to all characters are removed to add new ones, and this takes more processing time than it should. In the future, I plan to make only characters that need to be replaced to do so. So, for example, in a timer with miliseconds, the miliseconds characters will change constantly and the seconds will only be replaced when it needs to, instead of being replaced along with the miliseconds ones (as it currently is).
109-
110120
Script performance is not optimal
111121
--------------------------------------------
112122

113-
For portability reasons, I chose to use the Script mode on Python controller instead of Module mode. This fixes some script import issues and gives freedom for the developer to put BGText blend file wherever it wants to, but it comes with a price. As the Script mode makes the script be parsed at runtime, it's much slower than the module Mode, and this can be a serious issue when using lots of BGText instances with the `Update` attribute (which was already mentioned to be problematic). I don't plan to change the controller mode for the already mentioned reasons, but the `bgtext.py` script is already in a module format, so if the performance becomes a serious issue to you, you could only change the entry points on the Python controllers of BGText blend file to fit your needs.
123+
For portability reasons, I chose to use the Script mode on Python controller instead of Module mode. This fixes some script import issues and gives freedom for the developer to put BGText blend file wherever it wants to, but it comes with a price. As the Script mode makes the script be parsed at runtime, it's much slower than the module Mode, and this can be a serious issue when using lots of BGText instances with the `Update` property. I don't plan to change the controller mode for the already mentioned reasons, but the `bgtext.py` script is already in a module format, so if the performance becomes a serious issue to you, you could only change the entry points on the Python controllers of BGText blend file to fit your needs. The comments on the last lines of the `bgtext.py` will explain what to do.
114124

115125
Extras
116-
=====
126+
======
117127

118128
Along with the default font style textures, BGText comes with some image overlays for you to design your own font style textures. They are at the `source` directory, and comes with a single overlay (`TextStyleOverlay.png`) or multiple overlays (directory `TextStyleOverlay`). Those are useful when you're working with a image editor that supports layers.
119129

0 commit comments

Comments
 (0)