parent
27b0107b7a
commit
0c4808ce8e
@ -0,0 +1,29 @@
|
||||
package com.example.tankbattle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
public class PropertyMgr {
|
||||
private static Properties properties = new Properties();
|
||||
static {
|
||||
try {
|
||||
properties.load(PropertyMgr.class.getClassLoader().getResourceAsStream("config.properties"));
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String get(String key) {
|
||||
if (properties == null) {
|
||||
return null;
|
||||
}
|
||||
return properties.getProperty(key);
|
||||
}
|
||||
|
||||
//int getInt(key)
|
||||
//getString(key)
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(PropertyMgr.get("initTankCount"));
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
# tanks count at initialization
|
||||
initTankCount=10
|
||||
tankSpeed=5
|
||||
bulletSpeed=10
|
||||
gameWidth=1080
|
||||
gameHeight=720
|
Loading…
Reference in new issue