当前位置: 首页>>代码示例>>Java>>正文


Java FileType.Local方法代码示例

本文整理汇总了Java中com.badlogic.gdx.Files.FileType.Local方法的典型用法代码示例。如果您正苦于以下问题:Java FileType.Local方法的具体用法?Java FileType.Local怎么用?Java FileType.Local使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.Files.FileType的用法示例。


在下文中一共展示了FileType.Local方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
/** Returns a stream for reading this file as bytes.
 * @throws GdxRuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */
public InputStream read () {
	if (type == FileType.Classpath || (type == FileType.Internal && !file().exists())
		|| (type == FileType.Local && !file().exists())) {
		InputStream input = FileHandle.class.getResourceAsStream("/" + file.getPath().replace('\\', '/'));
		if (input == null) throw new GdxRuntimeException("File not found: " + file + " (" + type + ")");
		return input;
	}
	try {
		return new FileInputStream(file());
	} catch (Exception ex) {
		if (file().isDirectory())
			throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex);
		throw new GdxRuntimeException("Error reading file: " + file + " (" + type + ")", ex);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:18,代码来源:FileHandle.java

示例2: read

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
/** Returns a stream for reading this file as bytes.
 * @throw GdxRuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */
public InputStream read () {
	if (type == FileType.Classpath || (type == FileType.Internal && !file.exists())
		|| (type == FileType.Local && !file.exists())) {
		InputStream input = FileWrapper.class.getResourceAsStream("/" + file.getPath().replace('\\', '/'));
		if (input == null) throw new GdxRuntimeException("File not found: " + file + " (" + type + ")");
		return input;
	}
	try {
		return new FileInputStream(file());
	} catch (Exception ex) {
		if (file().isDirectory())
			throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex);
		throw new GdxRuntimeException("Error reading file: " + file + " (" + type + ")", ex);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:18,代码来源:FileWrapper.java

示例3: start

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
/**
 * @throws InitException If a fatal error occurs during initialization.
 */
public void start() throws InitException {
    DesktopGdxFileSystem gdxFileSystem = openResourceFileSystem(new File("."));
    IWritableFileSystem outputFileSystem = new DesktopOutputFileSystem(FileType.Local, "save/");

    final Launcher launcher = new Launcher(gdxFileSystem, outputFileSystem) {
        @Override
        public void create() {
            DesktopGraphicsUtil.setWindowIcon(gdxFileSystem);
            windowedSize = DesktopGraphicsUtil.limitInitialWindowSize(Gdx.graphics);

            super.create();
        }

        @Override
        public void resize(int width, int height) {
            super.resize(width, height);

            if (!Gdx.graphics.isFullscreen()) {
                windowedSize = Dim.of(width, height);
            }
        }

        @Override
        protected void handleInput(INativeInput input) {
            super.handleInput(input);

            DesktopLauncher.this.handleInput(input);
        }
    };

    NovelPrefsStore prefs = launcher.loadPreferences();
    handleCommandlineOptions(prefs);

    Lwjgl3ApplicationConfiguration config = createConfig(launcher, prefs);
    Lwjgl3Application app = new Lwjgl3Application(launcher, config);
    app.addLifecycleListener(new LifecycleListener() {
        @Override
        public void resume() {
            LOG.info("App resume");
        }

        @Override
        public void pause() {
            LOG.info("App pause");
        }

        @Override
        public void dispose() {
            LOG.info("App dispose");
        }
    });
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:56,代码来源:DesktopLauncher.java

示例4: file

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
@Override
public File file () {
	if (type == FileType.Internal) return new File(IOSFiles.internalPath, file.getPath());
	if (type == FileType.External) return new File(IOSFiles.externalPath, file.getPath());
	if (type == FileType.Local) return new File(IOSFiles.localPath, file.getPath());
	return file;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:8,代码来源:IOSFileHandle.java

示例5: file

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
public File file () {
    if (type == FileType.Local) return new File(Gdx.files.getLocalStoragePath(), file.getPath());
    return super.file();
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:5,代码来源:LibgdxLoggerAndroidFileHandle.java

示例6: file

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
@Override
public File file() {
    if (type == FileType.Internal) return new File(internalPath, file.getPath());
    if (type == FileType.External) return new File(externalPath, file.getPath());
    if (type == FileType.Local) return new File(localPath, file.getPath());
    return file;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:8,代码来源:LibgdxLoggerIosFileHandle.java

示例7: file

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
public File file () {
	if (type == FileType.External) return new File(DesktopFileHandle.externalPath, file.getPath());
	if (type == FileType.Local) return new File(DesktopFileHandle.localPath, file.getPath());
	return file;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:6,代码来源:StandaloneFileSystem.java

示例8: file

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
public File file () {
	if (type == FileType.External) return new File(JglfwFiles.externalPath, file.getPath());
	if (type == FileType.Local) return new File(JglfwFiles.localPath, file.getPath());
	return file;
}
 
开发者ID:Arcnor,项目名称:gdx-backend-jglfw,代码行数:6,代码来源:JglfwFileHandle.java

示例9: file

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
public File file () {
	if (type == FileType.External) return new File(HeadlessFiles.externalPath, file.getPath());
	if (type == FileType.Local) return new File(HeadlessFiles.localPath, file.getPath());
	return file;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:HeadlessFileHandle.java

示例10: file

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
public File file () {
	if (type == FileType.External) return new File(LwjglFiles.externalPath, file.getPath());
	if (type == FileType.Local) return new File(LwjglFiles.localPath, file.getPath());
	return file;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:LwjglFileHandle.java

示例11: file

import com.badlogic.gdx.Files.FileType; //导入方法依赖的package包/类
public File file () {
	if (type == FileType.Local) return new File(Gdx.files.getLocalStoragePath(), file.getPath());
	return super.file();
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:AndroidFileHandle.java


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