-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathTankGame.java
43 lines (36 loc) · 1.25 KB
/
TankGame.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.github.kuangcp.tank;
import com.github.kuangcp.tank.frame.MainFrame;
import com.github.kuangcp.tank.resource.ResourceMgr;
import com.github.kuangcp.tank.util.executor.MonitorExecutor;
import com.github.kuangcp.tank.ws.WsBizHandler;
import com.github.kuangcp.websocket.WsServer;
import com.github.kuangcp.websocket.WsServerConfig;
import lombok.extern.slf4j.Slf4j;
import java.awt.*;
@Slf4j
public class TankGame {
/**
* -Xmx300m -Xms300m -XX:+UseG1GC
* <p>
* https://stackoverflow.com/questions/6736906/why-does-java-swings-setvisible-take-so-long
*/
public static void main(String[] args) {
MonitorExecutor.init();
try {
ResourceMgr.loadResource();
log.info("finish load resources");
startWsServer();
EventQueue.invokeLater(new MainFrame());
} catch (Exception e) {
log.error("", e);
}
}
private static void startWsServer() {
final WsServerConfig config = new WsServerConfig();
final WsServer wsServer = new WsServer(config, new WsBizHandler(config));
final Thread wsThread = new Thread(wsServer::start);
wsThread.setDaemon(true);
wsThread.setName("ws-server");
wsThread.start();
}
}