com.jme3.system.AppSettings.putFloat()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中com.jme3.system.AppSettings.putFloat()方法的一些代码示例,展示了AppSettings.putFloat()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppSettings.putFloat()方法的具体详情如下:
包路径:com.jme3.system.AppSettings
类名称:AppSettings
方法名:putFloat

AppSettings.putFloat介绍

[英]Set a float on the settings.
[中]在设置上设置一个浮动。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

} else if (key.endsWith("(float)")) {
  float fVal = Float.parseFloat(val);
  putFloat(key.substring(0, key.length() - 7), fVal);
} else {
  throw new IOException("Cannot parse key: " + key);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

settings.putInteger("TestInt", 123);
settings.putString("TestStr", "HelloWorld");
settings.putFloat("TestFloat", 123.567f);
settings.put("TestObj", new Mesh()); // Objects not supported by file settings

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Tests preference based AppSettings.
 */
private static void testPreferenceSettings() {
  AppSettings settings = new AppSettings(false);
  settings.putBoolean("TestBool", true);
  settings.putInteger("TestInt", 123);
  settings.putString("TestStr", "HelloWorld");
  settings.putFloat("TestFloat", 123.567f);
  settings.put("TestObj", new Mesh()); // Objects not supported by preferences
  
  try {
    settings.save(APPSETTINGS_KEY);
  } catch (BackingStoreException ex) {
    ex.printStackTrace();
  }
  
  AppSettings loadedSettings = new AppSettings(false);
  try {
    loadedSettings.load(APPSETTINGS_KEY);
  } catch (BackingStoreException ex) {
    ex.printStackTrace();
  }
  
  assertEqual(loadedSettings.getBoolean("TestBool"), true);
  assertEqual(loadedSettings.getInteger("TestInt"), 123);
  assertEqual(loadedSettings.getString("TestStr"), "HelloWorld");
  assertEqual(loadedSettings.get("TestFloat"), 123.567f);
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

} else if (key.endsWith("(float)")) {
  float fVal = Float.parseFloat(val);
  putFloat(key.substring(0, key.length() - 7), fVal);
} else {
  throw new IOException("Cannot parse key: " + key);

相关文章

AppSettings类方法