本文整理了Java中com.jme3.system.AppSettings
类的一些代码示例,展示了AppSettings
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppSettings
类的具体详情如下:
包路径:com.jme3.system.AppSettings
类名称:AppSettings
[英]AppSettings
provides a store of configuration to be used by the application.
By default only the JmeContext uses the configuration, however the user may set and retrieve the settings as well. The settings can be stored either in the Java preferences (using #save(java.lang.String) or a .properties file (using #save(java.io.OutputStream).
[中]AppSettings
提供应用程序要使用的配置存储。
默认情况下,只有JmeContext使用配置,但是用户也可以设置和检索设置。这些设置可以存储在Java首选项中(使用#save(Java.lang.String)或。属性文件(使用#save(java.io.OutputStream)。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public TestContextSwitching() {
AppSettings settings = new AppSettings(true);
settings.setOpenCLSupport(true);
settings.setVSync(true);
settings.setWidth(800);
settings.setHeight(600);
settings.setOpenCLPlatformChooser(CustomPlatformChooser.class);
//settings.setRenderer(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE);
setSettings(settings);
setShowSettings(false);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void reshape(int width, int height) {
super.reshape(width, height);
// Need to move text relative to app height
txt.setLocalTranslation(0, settings.getHeight(), 0);
txt.setText("Drag the corners of the application to resize it.\n" +
"Current Size: " + settings.getWidth() + "x" + settings.getHeight());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void setSettings(AppSettings settings) {
this.settings.copyFrom(settings);
frameRate = settings.getFrameRate();
if (frameRate <= 0)
frameRate = 60; // use default update rate.
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Set the resolution for the rendering display
* @param width The width
* @param height The height
* (Default: 640x480)
*/
public void setResolution(int width, int height) {
setWidth(width);
setHeight(height);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Process the attached settings and apply changes to this app state.
* @param settings the app settings to process.
*/
protected void processSettings(AppSettings settings){
if (settings != null){
if (settings.get(VRConstants.SETTING_DISABLE_VR) != null){
DISABLE_VR = settings.getBoolean(VRConstants.SETTING_DISABLE_VR);
}
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
final String renderer = settings.getRenderer();
if (settings.getBoolean("RendererDebug")) {
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
if (settings.isGammaCorrection()) {
glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_TRUE);
glfwWindowHint(GLFW_RESIZABLE, settings.isResizable() ? GLFW_TRUE : GLFW_FALSE);
glfwWindowHint(GLFW_DEPTH_BITS, settings.getDepthBits());
glfwWindowHint(GLFW_STENCIL_BITS, settings.getStencilBits());
glfwWindowHint(GLFW_SAMPLES, settings.getSamples());
glfwWindowHint(GLFW_STEREO, settings.useStereo3D() ? GLFW_TRUE : GLFW_FALSE);
glfwWindowHint(GLFW_REFRESH_RATE, settings.getFrequency());
if (settings.getBitsPerPixel() == 24) {
glfwWindowHint(GLFW_RED_BITS, 8);
glfwWindowHint(GLFW_GREEN_BITS, 8);
glfwWindowHint(GLFW_BLUE_BITS, 8);
} else if (settings.getBitsPerPixel() == 16) {
glfwWindowHint(GLFW_RED_BITS, 5);
glfwWindowHint(GLFW_GREEN_BITS, 6);
glfwWindowHint(GLFW_ALPHA_BITS, settings.getAlphaBits());
if (settings.isFullscreen()) {
monitor = glfwGetPrimaryMonitor();
if (settings.getWidth() <= 0 || settings.getHeight() <= 0) {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void createContext(AppSettings settings) throws LWJGLException{
DisplayMode displayMode;
if (settings.getWidth() <= 0 || settings.getHeight() <= 0){
displayMode = Display.getDesktopDisplayMode();
settings.setResolution(displayMode.getWidth(), displayMode.getHeight());
}else if (settings.isFullscreen()){
displayMode = getFullscreenDisplayMode(settings.getWidth(), settings.getHeight(),
settings.getBitsPerPixel(), settings.getFrequency());
if (displayMode == null) {
throw new RuntimeException("Unable to find fullscreen display mode matching settings");
displayMode = new DisplayMode(settings.getWidth(), settings.getHeight());
PixelFormat pf = new PixelFormat(settings.getBitsPerPixel(),
settings.getAlphaBits(),
settings.getDepthBits(),
settings.getStencilBits(),
samples,
0,
0,
0,
settings.useStereo3D());
frameRate = settings.getFrameRate();
allowSwapBuffers = settings.isSwapBuffers();
logger.log(Level.FINE, "Selected display mode: {0}", displayMode);
Display.setTitle(settings.getTitle());
Display.setResizable(settings.isResizable());
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
setSettings(new AppSettings(true));
loadSettings = true;
settings.setWidth(useDM.getWidth());
settings.setHeight(useDM.getHeight());
settings.setBitsPerPixel(useDM.getBitDepth());
settings.setFrequency(useDM.getRefreshRate());
settings.setSwapBuffers(true);
settings.setVSync(true); // allow vsync on this display
setSettings(settings);
settings.setFrequency(defDev.getDisplayMode().getRefreshRate());
settings.setDepthBits(24);
settings.setVSync(true);
try {
BufferedReader br = new BufferedReader(new FileReader(resfile));
settings.setWidth(Integer.parseInt(br.readLine()));
settings.setHeight(Integer.parseInt(br.readLine()));
try {
settings.setFullscreen(br.readLine().toLowerCase(Locale.ENGLISH).contains("full"));
} catch(Exception e) {
settings.setFullscreen(false);
settings.setWidth(1280);
settings.setHeight(720);
settings.setWidth(1280);
settings.setHeight(720);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public static void createCanvas(String appClass){
AppSettings settings = new AppSettings(true);
settings.setWidth(640);
settings.setHeight(480);
// settings.setRenderer(AppSettings.JOGL);
JmeSystem.setLowPermissions(true);
try{
Class<? extends LegacyApplication> clazz = (Class<? extends LegacyApplication>) Class.forName(appClass);
app = clazz.newInstance();
}catch (ClassNotFoundException ex){
ex.printStackTrace();
}catch (InstantiationException ex){
ex.printStackTrace();
}catch (IllegalAccessException ex){
ex.printStackTrace();
}
app.setSettings(settings);
app.createCanvas();
context = (JmeCanvasContext) app.getContext();
canvas = context.getCanvas();
canvas.setSize(settings.getWidth(), settings.getHeight());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void initGLCanvas() {
GLCapabilities caps;
if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
caps = new GLCapabilities(GLProfile.getMaxProgrammable(true));
} else {
caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
}
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
caps.setStencilBits(settings.getStencilBits());
caps.setDepthBits(settings.getDepthBits());
if (settings.getSamples() > 1) {
caps.setSampleBuffers(true);
caps.setNumSamples(settings.getSamples());
}
canvas = GLWindow.create(caps);
canvas.invoke(false, new GLRunnable() {
public boolean run(GLAutoDrawable glad) {
canvas.getGL().setSwapInterval(settings.isVSync() ? 1 : 0);
return true;
}
});
canvas.requestFocus();
canvas.setSize(settings.getWidth(), settings.getHeight());
canvas.addGLEventListener(this);
//FIXME not sure it is the best place to do that
renderable.set(true);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if (settings.isFullscreen()) {
frame.setUndecorated(true);
if (currentDisplayMode.getWidth() == settings.getWidth()
&& currentDisplayMode.getHeight() == settings.getHeight()) {
if (currentDisplayMode.getBitDepth() == settings.getBitsPerPixel()) {
if (currentDisplayMode.getRefreshRate() == settings.getFrequency()) {
matchingDisplayMode = currentDisplayMode;
} else if (currentDisplayMode.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN) {
if (currentDisplayMode.getRefreshRate() == settings.getFrequency()) {
multiBitsDepthSupportedDisplayMode = currentDisplayMode;
} else if (currentDisplayMode.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN) {
if (screenSize.width != settings.getWidth() || screenSize.height != settings.getHeight()) {
canvas.setSize(screenSize);
x = (Toolkit.getDefaultToolkit().getScreenSize().width - settings.getWidth()) / 2;
y = (Toolkit.getDefaultToolkit().getScreenSize().height - settings.getHeight()) / 2;
frame.setLocation(x, y);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
pixelFormat = new PixelFormat(settings.getBitsPerPixel(),
settings.getAlphaBits(),
settings.getDepthBits(),
settings.getStencilBits(),
samples);
width = settings.getWidth();
height = settings.getHeight();
try{
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
source.setWidth(width);
source.setHeight(height);
source.setBitsPerPixel(depth);
source.setFrequency(freq);
source.setFullscreen(fullscreen);
source.setVSync(vsync);
source.setGammaCorrection(gamma);
source.setSamples(multisample);
String appTitle = source.getTitle();
source.save(appTitle);
} catch (BackingStoreException ex) {
logger.log(Level.WARNING,
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
AppSettings settings = new AppSettings(true);
settings.setEmulateMouse(mouseEventsEnabled);
settings.setEmulateMouseFlipAxis(mouseEventsInvertX, mouseEventsInvertY);
settings.setUseJoysticks(joystickEventsEnabled);
settings.setEmulateKeyboard(keyEventsEnabled);
settings.setBitsPerPixel(eglBitsPerPixel);
settings.setAlphaBits(eglAlphaBits);
settings.setDepthBits(eglDepthBits);
settings.setSamples(eglSamples);
settings.setStencilBits(eglStencilBits);
settings.setResolution(disp.getWidth(), disp.getHeight());
settings.setAudioRenderer(audioRendererType);
settings.setFrameRate(frameRate);
代码示例来源:origin: net.sf.phat/phat-server
public static void main(String[] args) {
ScreenAVDTest test = new ScreenAVDTest();
PHATApplication phat = new PHATApplication(test);
phat.setDisplayFps(true);
phat.setDisplayStatView(false);
AppSettings settings = new AppSettings(true);
settings.setTitle("PHAT");
settings.setWidth(640);
settings.setHeight(480);
phat.setSettings(settings);
phat.start();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void run() {
// Fill in the combos once the window has opened so that the insets can be read.
// The assumption is made that the settings window and the display window will have the
// same insets as that is used to resize the "full screen windowed" mode appropriately.
updateResolutionChoices();
if (source.getWidth() != 0 && source.getHeight() != 0) {
displayResCombo.setSelectedItem(source.getWidth() + " x "
+ source.getHeight());
} else {
displayResCombo.setSelectedIndex(displayResCombo.getItemCount()-1);
}
updateAntialiasChoices();
colorDepthCombo.setSelectedItem(source.getBitsPerPixel() + " bpp");
}
});
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
setResizable(false);
AppSettings registrySettings = new AppSettings(true);
if(source.getTitle()!=null){
appTitle = source.getTitle();
}else{
appTitle = registrySettings.getTitle();
minWidth = source.getMinWidth();
minHeight = source.getMinHeight();
registrySettings.load(appTitle);
} catch (BackingStoreException ex) {
logger.log(Level.WARNING,
source.copyFrom(registrySettings);
} else if(!registrySettings.isEmpty()) {
source.mergeFrom(registrySettings);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private Config getRequestedConfig() {
int r, g, b;
if (settings.getBitsPerPixel() == 24) {
r = g = b = 8;
} else {
if (settings.getBitsPerPixel() != 16) {
logger.log(Level.SEVERE, "Invalid bitsPerPixel setting: {0}, setting to RGB565 (16)", settings.getBitsPerPixel());
settings.setBitsPerPixel(16);
}
r = 5;
g = 6;
b = 5;
}
logger.log(Level.FINE, "Requested Display Config:");
logger.log(Level.FINE, "RGB: {0}, alpha: {1}, depth: {2}, samples: {3}, stencil: {4}",
new Object[]{settings.getBitsPerPixel(),
settings.getAlphaBits(), settings.getDepthBits(),
settings.getSamples(), settings.getStencilBits()});
return new Config(
r, g, b,
settings.getAlphaBits(),
settings.getDepthBits(),
settings.getSamples(),
settings.getStencilBits());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void createCanvas(){
AppSettings settings = new AppSettings(true);
try {
InputStream in = appCfg.openStream();
settings.load(in);
in.close();
} catch (IOException ex){
settings.setWidth(getWidth());
settings.setHeight(getHeight());
settings.setAudioRenderer(null);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void createCanvas(){
AppSettings settings = new AppSettings(true);
try {
in = appCfg.openStream();
settings.load(in);
in.close();
} catch (IOException ex){
settings.putString("AssetConfigURL", assetCfg.toString());
settings.setWidth(getWidth());
settings.setHeight(getHeight());
内容来源于网络,如有侵权,请联系作者删除!