Skip to content

Commit f854bcf

Browse files
authored
Merge pull request #85 from JavaBWAPI/add-drawTextX-docs
Add documentation for the Game::drawTextX methods
2 parents 35df384 + ca71f64 commit f854bcf

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/main/java/bwapi/Game.java

+48
Original file line numberDiff line numberDiff line change
@@ -1721,26 +1721,74 @@ public void drawText(final CoordinateType ctype, final int x, final int y, final
17211721
addShape(ShapeType.Text, ctype, x, y, 0, 0, formatted, textSize.id, 0, false);
17221722
}
17231723

1724+
/**
1725+
* Draw formatted text on the Map. (0, 0) coordinate is TopLeft.
1726+
* Use the %c delimiter to change the color of the following text to given `colors` until the next %c
1727+
* <p>
1728+
* Example:
1729+
* `drawTextMap(50, 50, "%cHello %cWorld", Text.Red, Text.Blue)`
1730+
* will draw the text `Hello` in Red and `World` in Blue at offset (50, 50) from the TopLeft of the Map.
1731+
*/
17241732
public void drawTextMap(final int x, final int y, final String string, final Text... colors) {
17251733
drawText(CoordinateType.Map, x, y, string, colors);
17261734
}
17271735

1736+
/**
1737+
* Draw formatted text on the Map. (0, 0) coordinate is TopLeft of the Map.
1738+
* Use the %c delimiter to change the color of the following text to given `colors` until the next %c
1739+
* <p>
1740+
* Example:
1741+
* `drawTextMap(new Position(50, 50), "%cHello %cWorld", Text.Red, Text.Blue)`
1742+
* will draw the text `Hello` in Red and `World` in Blue at offset (50, 50) from the TopLeft of the Map.
1743+
*/
17281744
public void drawTextMap(final Position p, final String string, final Text... colors) {
17291745
drawTextMap(p.x, p.y, string, colors);
17301746
}
17311747

1748+
/**
1749+
* Draw formatted text relative to the Mouse location. (0, 0) is the Mouse location.
1750+
* Use the %c delimiter to change the color of the following text to given `colors` until the next %c
1751+
* <p>
1752+
* Example:
1753+
* `drawTextMouse(50, 50, "%cHello %cWorld", Text.Red, Text.Blue)`
1754+
* will draw the text `Hello` in Red and `World` in Blue at offset (50, 50) from the Mouse location.
1755+
*/
17321756
public void drawTextMouse(final int x, final int y, final String string, final Text... colors) {
17331757
drawText(CoordinateType.Mouse, x, y, string, colors);
17341758
}
17351759

1760+
/**
1761+
* Draw formatted text relative to the Mouse location. (0, 0) is the Mouse location.
1762+
* Use the %c delimiter to change the color of the following text to given `colors` until the next %c
1763+
* <p>
1764+
* Example:
1765+
* `drawTextMouse(new Position(50, 50), "%cHello %cWorld", Text.Red, Text.Blue)`
1766+
* will draw the text `Hello` in Red and `World` in Blue at offset (50, 50) from the Mouse location.
1767+
*/
17361768
public void drawTextMouse(final Position p, final String string, final Text... colors) {
17371769
drawTextMouse(p.x, p.y, string, colors);
17381770
}
17391771

1772+
/**
1773+
* Draw formatted text relative to the Screen location. (0, 0) is TopLeft of the Screen.
1774+
* Use the %c delimiter to change the color of the following text to given `colors` until the next %c
1775+
* <p>
1776+
* Example:
1777+
* `drawTextScreen(50, 50, "%cHello %cWorld", Text.Red, Text.Blue)`
1778+
* will draw the text `Hello` in Red and `World` in Blue at offset (50, 50) from the TopLeft of the Screen.
1779+
*/
17401780
public void drawTextScreen(final int x, final int y, final String string, final Text... colors) {
17411781
drawText(CoordinateType.Screen, x, y, string, colors);
17421782
}
17431783

1784+
/**
1785+
* Draw formatted text relative to the Screen location. (0, 0) is TopLeft of the Screen.
1786+
* Use the %c delimiter to change the color of the following text to given `colors` until the next %c
1787+
* <p>
1788+
* Example:
1789+
* `drawTextScreen(new Position(50, 50), "%cHello %cWorld", Text.Red, Text.Blue)`
1790+
* will draw the text `Hello` in Red and `World` in Blue at offset (50, 50) from the TopLeft of the Screen.
1791+
*/
17441792
public void drawTextScreen(final Position p, final String string, final Text... colors) {
17451793
drawTextScreen(p.x, p.y, string, colors);
17461794
}

0 commit comments

Comments
 (0)