Skip to content

Commit 616f125

Browse files
committed
make TextSize part of Text as Size to adhere to BWAPI structure
1 parent 8f6c162 commit 616f125

File tree

4 files changed

+34
-35
lines changed

4 files changed

+34
-35
lines changed

src/main/java/bwapi/Game.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class Game {
9696
private short[] mapSplitTilesRegion1;
9797
private short[] mapSplitTilesRegion2;
9898
// USER DEFINED
99-
private TextSize textSize = TextSize.Default;
99+
private Text.Size textSize = Text.Size.Default;
100100

101101
Game(Client client) {
102102
this.client = client;
@@ -2394,16 +2394,16 @@ public boolean hasPath(final Position source, final Position destination) {
23942394
}
23952395

23962396
public void setTextSize() {
2397-
setTextSize(TextSize.Default);
2397+
setTextSize(Text.Size.Default);
23982398
}
23992399

24002400
/**
24012401
* Sets the size of the text for all calls to {@link #drawText} following this one.
24022402
*
2403-
* @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.
2404-
* @see TextSize
2403+
* @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.
2404+
* @see Text.Size
24052405
*/
2406-
public void setTextSize(final TextSize size) {
2406+
public void setTextSize(final Text.Size size) {
24072407
textSize = size;
24082408
}
24092409

src/main/java/bwapi/Text.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)