Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/main/java/bwapi/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class Game {
private short[] mapSplitTilesRegion1;
private short[] mapSplitTilesRegion2;
// USER DEFINED
private TextSize textSize = TextSize.Default;
private Text.Size textSize = Text.Size.Default;

Game(Client client) {
this.client = client;
Expand Down Expand Up @@ -1487,7 +1487,7 @@ public List<TilePosition> getStartLocations() {

/**
* Prints text to the screen as a notification. This function allows text
* formatting using {@link TextColor#formatText}.
* formatting using {@link Text#formatText}.
* <p>
* That text printed through this function is not seen by other players or in replays.
*
Expand Down Expand Up @@ -2394,16 +2394,16 @@ public boolean hasPath(final Position source, final Position destination) {
}

public void setTextSize() {
setTextSize(TextSize.Default);
setTextSize(Text.Size.Default);
}

/**
* Sets the size of the text for all calls to {@link #drawText} following this one.
*
* @param size The size of the text. This value is one of Text#Size. If this value is omitted, then a default value of {@link TextSize#Default} is used.
* @see TextSize
* @param size The size of the text. This value is one of Text#Size. If this value is omitted, then a default value of {@link Text.Size#Default} is used.
* @see Text.Size
*/
public void setTextSize(final TextSize size) {
public void setTextSize(final Text.Size size) {
textSize = size;
}

Expand Down
28 changes: 14 additions & 14 deletions src/main/java/bwapi/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -520,34 +520,34 @@ public Color getColor() {
*
* @return character code to use for text in Broodwar.
*/
public TextColor getTextColor() {
public Text getTextColor() {
switch (playerData.getColor()) {
case 111: // red
return TextColor.BrightRed;
return Text.BrightRed;
case 165: // blue
return TextColor.Blue;
return Text.Blue;
case 159: // teal
return TextColor.Teal;
return Text.Teal;
case 164: // purp
return TextColor.Purple;
return Text.Purple;
case 156: // orange with fix from @n00byEdge
return TextColor.Orange;
return Text.Orange;
case 19: // brown
return TextColor.Brown;
return Text.Brown;
case 84: // white
return TextColor.PlayerWhite;
return Text.PlayerWhite;
case 135: // yellow
return TextColor.PlayerYellow;
return Text.PlayerYellow;
case 185: // green p9
return TextColor.DarkGreen;
return Text.DarkGreen;
case 136: // p10
return TextColor.LightYellow;
return Text.LightYellow;
case 134: // p11
return TextColor.Tan;
return Text.Tan;
case 51: // p12
return TextColor.GreyBlue;
return Text.GreyBlue;
default:
return TextColor.Default;
return Text.Default;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* <p>
* Such codes are used in calls to {@link Game#drawText}, {@link Game#printf}
*/
public enum TextColor {
public enum Text {
/**
* Uses the previous color that was specified before the current one.
*/
Expand Down Expand Up @@ -117,14 +117,14 @@ public enum TextColor {

final byte id;

TextColor(final int id) {
Text(final int id) {
this.id = (byte) id;
}

/**
* Format text with a textcolor to display on broodwar
*/
public static String formatText(final String text, final TextColor format) {
public static String formatText(final String text, final Text format) {
final byte[] data = text.getBytes();
final int len = text.length();
final byte[] formatted = new byte[len + 1];
Expand All @@ -143,4 +143,32 @@ boolean isColor() {
final int c = this.id;
return (2 <= c && c <= 8) || (14 <= c && c <= 17) || (21 <= c && c <= 31);
}

/**
* Enumeration of available text sizes.
*/
public enum Size {
/**
* The smallest text size in the game.
*/
Small(0),
/**
* The standard text size, used for most things in the game such as chat messages.
*/
Default(1),
/**
* A larger text size. This size is used for the in-game countdown timer seen in @CTF and @UMS game types.
*/
Large(2),
/**
* The largest text size in the game.
*/
Huge(3);

final int id;

Size(final int id) {
this.id = id;
}
}
}
29 changes: 0 additions & 29 deletions src/main/java/bwapi/TextSize.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/java/marinehell/MarineHell.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void onStart() {

@Override
public void onFrame() {
// game.setTextSize(10);
// game.setText.Size(10);
game.drawTextScreen(10, 10, "Playing as " + self.getName() + " - " + self.getRace());
game.drawTextScreen(10, 20, "Units: " + self.getUnits().size() + "; Enemies: " + enemyBuildingMemory.size());
game.drawTextScreen(10, 30,
Expand Down