• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LwjglPreferences类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.badlogic.gdx.backends.lwjgl.LwjglPreferences的典型用法代码示例。如果您正苦于以下问题:Java LwjglPreferences类的具体用法?Java LwjglPreferences怎么用?Java LwjglPreferences使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LwjglPreferences类属于com.badlogic.gdx.backends.lwjgl包,在下文中一共展示了LwjglPreferences类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.badlogic.gdx.backends.lwjgl.LwjglPreferences; //导入依赖的package包/类
public static void main (String[] arg) {
	String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
	if (version == null) {
		version = "1.0";
	}
	LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

	if (SharedLibraryLoader.isMac) {
		config.preferencesDirectory = "Library/Application Support/Pixel Dungeon/";
	} else if (SharedLibraryLoader.isLinux) {
		config.preferencesDirectory = ".watabou/pixel-dungeon/";
	} else if (SharedLibraryLoader.isWindows) {
		config.preferencesDirectory = "Saved Games/Pixel Dungeon/";
	}
	// FIXME: This is a hack to get access to the preferences before we have an application setup
	com.badlogic.gdx.Preferences prefs = new LwjglPreferences(Preferences.FILE_NAME, config.preferencesDirectory);

	boolean isFullscreen = prefs.getBoolean(Preferences.KEY_WINDOW_FULLSCREEN, false);
	config.fullscreen = isFullscreen;
	if (!isFullscreen) {
		config.width = prefs.getInteger(Preferences.KEY_WINDOW_WIDTH, Preferences.DEFAULT_WINDOW_WIDTH);
		config.height = prefs.getInteger(Preferences.KEY_WINDOW_HEIGHT, Preferences.DEFAULT_WINDOW_HEIGHT);
	}

	config.addIcon( "ic_launcher_128.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_32.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_16.png", Files.FileType.Internal );

	// TODO: It have to be pulled from build.gradle, but I don't know how it can be done
	config.title = "Pixel Dungeon";

	new LwjglApplication(new PixelDungeon(
			new DesktopSupport(version, config.preferencesDirectory, new DesktopInputProcessor())
	), config);
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:36,代码来源:DesktopLauncher.java


示例2: getPreferences

import com.badlogic.gdx.backends.lwjgl.LwjglPreferences; //导入依赖的package包/类
@Override
public Preferences getPreferences(String name) {
    if (preferences.containsKey(name)) {
        return preferences.get(name);
    } else {
        Preferences prefs = new LwjglPreferences(new LwjglFileHandle(new File(prefersDir, name), prefsFileType));
        preferences.put(name, prefs);
        return prefs;
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:11,代码来源:CustomLwjglCanvas.java


示例3: loadWindowParams

import com.badlogic.gdx.backends.lwjgl.LwjglPreferences; //导入依赖的package包/类
private void loadWindowParams(LwjglApplicationConfiguration configuration) {
    FileHandle file = new FileHandle(LwjglFiles.externalPath + configuration.preferencesDirectory + "/window_params.xml");
    if (!file.exists()) return;

    DisplayMode displayMode = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode();
    int screenWidth = displayMode.getWidth();
    int screenHeight = displayMode.getHeight();

    Preferences prefs = new LwjglPreferences(file);
    configuration.width = MathUtils.clamp(prefs.getInteger("width", configuration.width), 320, screenWidth);
    configuration.height = MathUtils.clamp(prefs.getInteger("height", configuration.height), 320, screenHeight);
    configuration.x = MathUtils.clamp(prefs.getInteger("x", configuration.x), 0, screenWidth - configuration.width);
    configuration.y = MathUtils.clamp(prefs.getInteger("y", configuration.y), 0, screenHeight - configuration.height);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:15,代码来源:WindowParamsPersistingApplicationWrapper.java


示例4: main

import com.badlogic.gdx.backends.lwjgl.LwjglPreferences; //导入依赖的package包/类
public static void main (String[] arg) {
	String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
	if (version == null) {
		version = "???";
	}
	LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

	if (SharedLibraryLoader.isMac) {
		config.preferencesDirectory = "Library/Application Support/BravePixel/Pixel Dungeon/";
	} else if (SharedLibraryLoader.isLinux) {
		config.preferencesDirectory = ".bravepixel/pixel-dungeon/";
	} else if (SharedLibraryLoader.isWindows) {
		config.preferencesDirectory = "Saved Games/BravePixel/PixelDungeon";
	}
	// FIXME: This is a hack to get access to the preferences before we have an application setup
	com.badlogic.gdx.Preferences prefs = new LwjglPreferences(Preferences.FILE_NAME, config.preferencesDirectory);

	boolean isFullscreen = prefs.getBoolean(Preferences.KEY_WINDOW_FULLSCREEN, false);
	config.fullscreen = isFullscreen;
	if (!isFullscreen) {
		config.width = prefs.getInteger(Preferences.KEY_WINDOW_WIDTH, Preferences.DEFAULT_WINDOW_WIDTH);
		config.height = prefs.getInteger(Preferences.KEY_WINDOW_HEIGHT, Preferences.DEFAULT_WINDOW_HEIGHT);
	}

	config.addIcon( "ic_launcher_128.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_32.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_16.png", Files.FileType.Internal );


	// TODO: It have to be pulled from build.gradle, but I don't know how it can be done
	config.title = "Pixel Dungeon";

	new LwjglApplication(new PixelDungeon(
			new DesktopSupport(version, config.preferencesDirectory, new DesktopInputProcessor())
	), config);
}
 
开发者ID:skynet67,项目名称:pixel-dungeon-rebirth,代码行数:37,代码来源:DesktopLauncher.java


示例5: LocalGameServices

import com.badlogic.gdx.backends.lwjgl.LwjglPreferences; //导入依赖的package包/类
public LocalGameServices() {
    prefs = new LwjglPreferences("dice.local.game-services", ".prefs/");
    dispatcher.setState(ServicesState.valueOf(prefs.getString(KEY, ServicesState.DISCONNECTED.toString())));
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:5,代码来源:LocalGameServices.java


示例6: getPrefs

import com.badlogic.gdx.backends.lwjgl.LwjglPreferences; //导入依赖的package包/类
static protected Preferences getPrefs()
{
	return new LwjglPreferences(CONFIG_FILE, ".prefs/");
}
 
开发者ID:arksu,项目名称:origin,代码行数:5,代码来源:Config.java


示例7: LwjglApplicationChanger

import com.badlogic.gdx.backends.lwjgl.LwjglPreferences; //导入依赖的package包/类
public LwjglApplicationChanger()
{
	super( new LwjglPreferences( "game-settings", "settings" ) );
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:5,代码来源:LwjglApplicationChanger.java


示例8: main

import com.badlogic.gdx.backends.lwjgl.LwjglPreferences; //导入依赖的package包/类
public static void main (String[] arg) {
	String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
	if (version == null) {
		version = "0.6.2d";
	}

	int versionCode;
	try {
		versionCode = Integer.parseInt(DesktopLauncher.class.getPackage().getImplementationVersion());
	} catch (NumberFormatException e) {
		versionCode = 228;
	}

	LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

	if (SharedLibraryLoader.isMac) {
		config.preferencesDirectory = "Library/Application Support/Shattered Pixel Dungeon/";
	} else if (SharedLibraryLoader.isLinux) {
		config.preferencesDirectory = ".shatteredpixel/shattered-pixel-dungeon/";
	} else if (SharedLibraryLoader.isWindows) {
		String winVer = System.getProperties().getProperty("os.name");
		if (winVer.contains("XP")) {
			config.preferencesDirectory = "Application Data/.shatteredpixel/Shattered Pixel Dungeon/";
		} else {
			config.preferencesDirectory = "AppData/Roaming/.shatteredpixel/Shattered Pixel Dungeon/";
		}
	}
	// FIXME: This is a hack to get access to the preferences before we have an application setup
	com.badlogic.gdx.Preferences prefs = new LwjglPreferences(Preferences.FILE_NAME, config.preferencesDirectory);

	boolean isFullscreen = prefs.getBoolean(Preferences.KEY_WINDOW_FULLSCREEN, false);
	//config.fullscreen = isFullscreen;
	if (!isFullscreen) {
		config.width = prefs.getInteger(Preferences.KEY_WINDOW_WIDTH, Preferences.DEFAULT_WINDOW_WIDTH);
		config.height = prefs.getInteger(Preferences.KEY_WINDOW_HEIGHT, Preferences.DEFAULT_WINDOW_HEIGHT);
	}

	config.addIcon( "ic_launcher_128.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_32.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_16.png", Files.FileType.Internal );

	// TODO: It have to be pulled from build.gradle, but I don't know how it can be done
	config.title = "Shattered Pixel Dungeon";

	new LwjglApplication(new ShatteredPixelDungeon(
			new DesktopSupport(version, versionCode, config.preferencesDirectory, new DesktopInputProcessor())
	), config);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:49,代码来源:DesktopLauncher.java


示例9: TestList

import com.badlogic.gdx.backends.lwjgl.LwjglPreferences; //导入依赖的package包/类
public TestList() {
    setLayout(new BorderLayout());


    final JList list = new JList(C2dTests.getNames());
    final JButton button = new JButton("Run Test");
    JScrollPane pane = new JScrollPane(list);

    DefaultListSelectionModel m = new DefaultListSelectionModel();
    m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m.setLeadAnchorNotificationEnabled(false);
    list.setSelectionModel(m);

    list.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent event) {
            if (event.getClickCount() == 2) button.doClick();
        }
    });

    final Preferences prefs = new LwjglPreferences(new FileHandle(new LwjglFiles().getExternalStoragePath() + ".prefs/c2d-tests"));
    list.setSelectedValue(prefs.getString("last", null), true);

    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String testName = (String) list.getSelectedValue();
            Engine test = C2dTests.newTest(testName);
            LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
            config.fullscreen = false;
            config.width = (int) Engine.getWidth();
            config.height = (int) Engine.getHeight();
            config.title = testName;
            config.vSyncEnabled = true;

            prefs.putString("last", testName);
            prefs.flush();

            new LwjglApplication(test, config);
        }
    });

    add(pane, BorderLayout.CENTER);
    add(button, BorderLayout.SOUTH);
}
 
开发者ID:lycying,项目名称:c2d-engine,代码行数:45,代码来源:C2dDesktop.java



注:本文中的com.badlogic.gdx.backends.lwjgl.LwjglPreferences类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SVNUrl类代码示例发布时间:2022-05-22
下一篇:
Java HostedRoom类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap