Skip to content

Commit 73dc887

Browse files
committed
add small example in description
1 parent e7abfbf commit 73dc887

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,32 @@ or if you already have maven installed
7272

7373
`mvn package`
7474

75+
## HelloBot
76+
77+
A simple `Hello World` bot is as easy as:
78+
79+
```Java
80+
import bwapi.BWClient;
81+
import bwapi.DefaultBWListener;
82+
import bwapi.Game;
83+
84+
class HelloBot extends DefaultBWListener {
85+
private BWClient bwClient;
86+
87+
@Override
88+
public void onFrame() {
89+
Game game = bwClient.getGame();
90+
game.drawTextMap(100, 100, "Hello World!");
91+
}
92+
93+
public static void main(String[] args) {
94+
HelloBot bot = new HelloBot();
95+
bot.bwClient = new BWClient(bot);
96+
bot.bwClient.startGame();
97+
}
98+
}
99+
```
100+
75101
## Documentation
76102

77103
The API documentation can be found [here](https://javabwapi.github.io/JBWAPI/).

src/main/java/bwapi/GameTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class GameInstance {
1515
+ 4 // LastKeepAliveTime
1616
;
1717

18-
public GameInstance(int serverProcessID, boolean isConnected, int lastKeepAliveTime) {
18+
GameInstance(int serverProcessID, boolean isConnected, int lastKeepAliveTime) {
1919
this.serverProcessID = serverProcessID;
2020
this.isConnected = isConnected;
2121
this.lastKeepAliveTime = lastKeepAliveTime;

0 commit comments

Comments
 (0)