mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
Fixed Code.Draw receiving the index in the current line rather than the current token
Closes #3
This commit is contained in:
parent
856d69b7db
commit
c360c90f28
2 changed files with 11 additions and 7 deletions
|
@ -21,6 +21,7 @@ Improvements
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
- **Fixed a formatting Code only knowing about the last Token that it is applied in**
|
- **Fixed a formatting Code only knowing about the last Token that it is applied in**
|
||||||
|
- Fixed Code.Draw receiving the index in the current line rather than the current token
|
||||||
- Fixed StaticSpriteBatch handling rotated sprites incorrectly
|
- Fixed StaticSpriteBatch handling rotated sprites incorrectly
|
||||||
|
|
||||||
Removals
|
Removals
|
||||||
|
|
|
@ -123,17 +123,20 @@ namespace MLEM.Formatting {
|
||||||
var token = this.Tokens[t];
|
var token = this.Tokens[t];
|
||||||
var drawFont = token.GetFont(font);
|
var drawFont = token.GetFont(font);
|
||||||
var drawColor = token.GetColor(color);
|
var drawColor = token.GetColor(color);
|
||||||
for (var l = 0; l < token.SplitDisplayString.Length; l++) {
|
|
||||||
var line = token.SplitDisplayString[l];
|
|
||||||
for (var i = 0; i < line.Length; i++) {
|
|
||||||
var c = line[i];
|
|
||||||
if (l == 0 && i == 0)
|
|
||||||
token.DrawSelf(time, batch, pos + innerOffset, drawFont, color, scale, depth);
|
|
||||||
|
|
||||||
|
var indexInToken = 0;
|
||||||
|
for (var l = 0; l < token.SplitDisplayString.Length; l++) {
|
||||||
|
foreach (var c in token.SplitDisplayString[l]) {
|
||||||
var cString = c.ToCachedString();
|
var cString = c.ToCachedString();
|
||||||
token.DrawCharacter(time, batch, c, cString, i, pos + innerOffset, drawFont, drawColor, scale, depth);
|
|
||||||
|
if (indexInToken == 0)
|
||||||
|
token.DrawSelf(time, batch, pos + innerOffset, drawFont, color, scale, depth);
|
||||||
|
token.DrawCharacter(time, batch, c, cString, indexInToken, pos + innerOffset, drawFont, drawColor, scale, depth);
|
||||||
|
|
||||||
innerOffset.X += drawFont.MeasureString(cString).X * scale;
|
innerOffset.X += drawFont.MeasureString(cString).X * scale;
|
||||||
|
indexInToken++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only split at a new line, not between tokens!
|
// only split at a new line, not between tokens!
|
||||||
if (l < token.SplitDisplayString.Length - 1) {
|
if (l < token.SplitDisplayString.Length - 1) {
|
||||||
innerOffset.X = token.InnerOffsets[l] * scale;
|
innerOffset.X = token.InnerOffsets[l] * scale;
|
||||||
|
|
Loading…
Reference in a new issue