videosettings.java.svn-base
来自「一个JAVA程序员的游戏」· SVN-BASE 代码 · 共 136 行
SVN-BASE
136 行
/*
* VideoSettings.java
*
* Created on 21. Januar 2007, 18:31
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package kanjitori.preferences;
import com.jme.system.PropertiesIO;
import java.io.Serializable;
/**
*
* @author Pirx
*/
public class VideoSettings implements Serializable {
private static final long serialVersionUID = 1;
public static String[] FREQUENCIES =
new String[]{"60", "70", "72", "75", "85", "100", "120", "140"};
public static String[] RESOLUTIONS = new String[]{"640x480", "800x600",
"1024x768", "1280x1024", "1600x1200", "1440x900"};
public static String[] COLORS = new String[] {"16", "32"};
private int freq = 60;
private String renderer = "LWJGL";
private int width = 640;
private int height = 480;
private int depth = 16;
private boolean fullScreen = true;
/** Creates a new instance of VideoSettings */
public VideoSettings() {
}
public int getFreq() {
return freq;
}
public void setFreq(int freq) {
this.freq = freq;
}
public String getRenderer() {
return renderer;
}
public void setRenderer(String renderer) {
this.renderer = renderer;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getDepth() {
return depth;
}
public void setDepth(int depth) {
this.depth = depth;
}
public boolean isFullScreen() {
return fullScreen;
}
public void setFullScreen(boolean fullScreen) {
this.fullScreen = fullScreen;
}
public void overwrite(PropertiesIO properties) {
properties.set("FREQ", ""+freq);
properties.set("RENDERER", renderer);
properties.set("WIDTH", "" + width);
properties.set("HEIGHT", "" + height);
properties.set("DEPTH", "" + depth);
properties.set("FULLSCREEN", "" + fullScreen);
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("freq: ").append(this.freq).append(", ");
sb.append("depth: ").append(this.depth).append(", ");
sb.append("width: ").append(this.width).append(", ");
sb.append("height: ").append(this.height).append(", ");
sb.append("fullscreen: ").append(this.fullScreen);
return sb.toString();
}
public int getColorIndex() {
for (int i = 0; i < COLORS.length; i++) {
if (COLORS[i].equals("" + getDepth())) {
return i;
}
}
return -1;
}
public int getFreqIndex() {
for (int i = 0; i < FREQUENCIES.length; i++) {
if (FREQUENCIES[i].equals("" + getFreq())) {
return i;
}
}
return -1;
}
public int getResIndex() {
for (int i = 0; i < RESOLUTIONS.length; i++) {
if (RESOLUTIONS[i].equals("" + getWidth()+ "x" + getHeight())) {
return i;
}
}
return -1;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?