Skip to content

Commit 6909bf6

Browse files
committed
merge develop
2 parents f7d9963 + 61cc103 commit 6909bf6

File tree

5 files changed

+54
-53
lines changed

5 files changed

+54
-53
lines changed

src/main/java/bwapi/Game.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ public class Game {
9696
private short[] mapSplitTilesRegion1;
9797
private short[] mapSplitTilesRegion2;
9898
// USER DEFINED
99-
private TextSize textSize = TextSize.Default;
99+
100+
private Text.Size textSize = Text.Size.Default;
100101
private boolean latcom = true;
101102

103+
102104
Game(Client client) {
103105
this.client = client;
104106
this.gameData = client.data();
@@ -1490,7 +1492,7 @@ public List<TilePosition> getStartLocations() {
14901492

14911493
/**
14921494
* Prints text to the screen as a notification. This function allows text
1493-
* formatting using {@link TextColor#formatText}.
1495+
* formatting using {@link Text#formatText}.
14941496
* <p>
14951497
* That text printed through this function is not seen by other players or in replays.
14961498
*
@@ -2400,16 +2402,16 @@ public boolean hasPath(final Position source, final Position destination) {
24002402
}
24012403

24022404
public void setTextSize() {
2403-
setTextSize(TextSize.Default);
2405+
setTextSize(Text.Size.Default);
24042406
}
24052407

24062408
/**
24072409
* Sets the size of the text for all calls to {@link #drawText} following this one.
24082410
*
2409-
* @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.
2410-
* @see TextSize
2411+
* @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.
2412+
* @see Text.Size
24112413
*/
2412-
public void setTextSize(final TextSize size) {
2414+
public void setTextSize(final Text.Size size) {
24132415
textSize = size;
24142416
}
24152417

src/main/java/bwapi/Player.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -546,34 +546,34 @@ public Color getColor() {
546546
*
547547
* @return character code to use for text in Broodwar.
548548
*/
549-
public TextColor getTextColor() {
549+
public Text getTextColor() {
550550
switch (playerData.getColor()) {
551551
case 111: // red
552-
return TextColor.BrightRed;
552+
return Text.BrightRed;
553553
case 165: // blue
554-
return TextColor.Blue;
554+
return Text.Blue;
555555
case 159: // teal
556-
return TextColor.Teal;
556+
return Text.Teal;
557557
case 164: // purp
558-
return TextColor.Purple;
558+
return Text.Purple;
559559
case 156: // orange with fix from @n00byEdge
560-
return TextColor.Orange;
560+
return Text.Orange;
561561
case 19: // brown
562-
return TextColor.Brown;
562+
return Text.Brown;
563563
case 84: // white
564-
return TextColor.PlayerWhite;
564+
return Text.PlayerWhite;
565565
case 135: // yellow
566-
return TextColor.PlayerYellow;
566+
return Text.PlayerYellow;
567567
case 185: // green p9
568-
return TextColor.DarkGreen;
568+
return Text.DarkGreen;
569569
case 136: // p10
570-
return TextColor.LightYellow;
570+
return Text.LightYellow;
571571
case 134: // p11
572-
return TextColor.Tan;
572+
return Text.Tan;
573573
case 51: // p12
574-
return TextColor.GreyBlue;
574+
return Text.GreyBlue;
575575
default:
576-
return TextColor.Default;
576+
return Text.Default;
577577
}
578578
}
579579

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* <p>
66
* Such codes are used in calls to {@link Game#drawText}, {@link Game#printf}
77
*/
8-
public enum TextColor {
8+
public enum Text {
99
/**
1010
* Uses the previous color that was specified before the current one.
1111
*/
@@ -117,14 +117,14 @@ public enum TextColor {
117117

118118
final byte id;
119119

120-
TextColor(final int id) {
120+
Text(final int id) {
121121
this.id = (byte) id;
122122
}
123123

124124
/**
125125
* Format text with a textcolor to display on broodwar
126126
*/
127-
public static String formatText(final String text, final TextColor format) {
127+
public static String formatText(final String text, final Text format) {
128128
final byte[] data = text.getBytes();
129129
final int len = text.length();
130130
final byte[] formatted = new byte[len + 1];
@@ -143,4 +143,32 @@ boolean isColor() {
143143
final int c = this.id;
144144
return (2 <= c && c <= 8) || (14 <= c && c <= 17) || (21 <= c && c <= 31);
145145
}
146+
147+
/**
148+
* Enumeration of available text sizes.
149+
*/
150+
public enum Size {
151+
/**
152+
* The smallest text size in the game.
153+
*/
154+
Small(0),
155+
/**
156+
* The standard text size, used for most things in the game such as chat messages.
157+
*/
158+
Default(1),
159+
/**
160+
* A larger text size. This size is used for the in-game countdown timer seen in @CTF and @UMS game types.
161+
*/
162+
Large(2),
163+
/**
164+
* The largest text size in the game.
165+
*/
166+
Huge(3);
167+
168+
final int id;
169+
170+
Size(final int id) {
171+
this.id = id;
172+
}
173+
}
146174
}

src/main/java/bwapi/TextSize.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/test/java/marinehell/MarineHell.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public void onStart() {
7575

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

0 commit comments

Comments
 (0)