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


Java FileType类代码示例

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


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

示例1: main

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
public static void main(String[] args) {
		AmidakujiMain amidakuji = new AmidakujiMain();
		AmidakujiMain.width = 1080;
		AmidakujiMain.height = 720;
		
		LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
		cfg.title = "Amidakuji Version 0.4.3";
//		cfg.useGL20 = true;
		cfg.width = AmidakujiMain.width;
		cfg.height = AmidakujiMain.height;
		
		
		if(System.getProperty("os.name").toLowerCase().indexOf("mac os x") != -1) {
			System.setProperty("apple.laf.useScreenMenuBar", "true");
			System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Amidakuji");
			
			Application app = Application.getApplication();
			app.setDockIconImage(Toolkit.getDefaultToolkit().getImage(Main.class.getResource("/amidakuji_mac.png")));
		} else {
			cfg.addIcon("amidakuji.png", FileType.Internal);
			cfg.addIcon("amidakuji_lin.png", FileType.Internal);
		}
		
		new LwjglApplication(amidakuji, cfg);
	}
 
开发者ID:MJacred,项目名称:amidakuji,代码行数:26,代码来源:Main.java

示例2: writer

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
/** Returns a writer for writing to this file. Parent directories will be created if necessary.
 * @param append If false, this file will be overwritten if it exists, otherwise it will be appended.
 * @param charset May be null to use the default charset.
 * @throws GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or
 *            {@link FileType#Internal} file, or if it could not be written. */
public Writer writer (boolean append, String charset) {
	if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot write to a classpath file: " + file);
	if (type == FileType.Internal) throw new GdxRuntimeException("Cannot write to an internal file: " + file);
	parent().mkdirs();
	try {
		FileOutputStream output = new FileOutputStream(file(), append);
		if (charset == null)
			return new OutputStreamWriter(output);
		else
			return new OutputStreamWriter(output, charset);
	} catch (IOException ex) {
		if (file().isDirectory())
			throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex);
		throw new GdxRuntimeException("Error writing file: " + file + " (" + type + ")", ex);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:22,代码来源:FileHandle.java

示例3: 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

示例4: writer

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
/** Returns a writer for writing to this file. Parent directories will be created if necessary.
 * @param append If false, this file will be overwritten if it exists, otherwise it will be appended.
 * @param charset May be null to use the default charset.
 * @throw GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or
 *        {@link FileType#Internal} file, or if it could not be written. */
public Writer writer (boolean append, String charset) {
	if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot write to a classpath file: " + file);
	if (type == FileType.Internal) throw new GdxRuntimeException("Cannot write to an internal file: " + file);
	parent().mkdirs();
	try {
		FileOutputStream output = new FileOutputStream(file(), append);
		if (charset == null)
			return new OutputStreamWriter(output);
		else
			return new OutputStreamWriter(output, charset);
	} catch (IOException ex) {
		if (file().isDirectory())
			throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex);
		throw new GdxRuntimeException("Error writing file: " + file + " (" + type + ")", ex);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:22,代码来源:FileWrapper.java

示例5: list

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
public FileHandle[] list (FileFilter filter) {
	if (type == FileType.Internal) {
		try {
			String[] relativePaths = assets.list(file.getPath());
			FileHandle[] handles = new FileHandle[relativePaths.length];
			int count = 0;
			for (int i = 0, n = handles.length; i < n; i++) {
				String path = relativePaths[i];
				FileHandle child = new AndroidFileHandle(assets, new File(file, path), type);
				if (!filter.accept(child.file())) continue;
				handles[count] = child;
				count++;
			}
			if (count < relativePaths.length) {
				FileHandle[] newHandles = new FileHandle[count];
				System.arraycopy(handles, 0, newHandles, 0, count);
				handles = newHandles;
			}
			return handles;
		} catch (Exception ex) {
			throw new GdxRuntimeException("Error listing children: " + file + " (" + type + ")", ex);
		}
	}
	return super.list(filter);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:26,代码来源:AndroidFileHandle.java

示例6: exists

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
public boolean exists () {
	if (type == FileType.Internal) {
		String fileName = file.getPath();
		try {
			assets.open(fileName).close(); // Check if file exists.
			return true;
		} catch (Exception ex) {
			// This is SUPER slow! but we need it for directories.
			try {
				return assets.list(fileName).length > 0;
			} catch (Exception ignored) {
			}
			return false;
		}
	}
	return super.exists();
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:18,代码来源:AndroidFileHandle.java

示例7: build

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
public void build (Array<FileHandle> favorites, FileHandle file) {
	sortingPopupMenu.build();
	this.file = file;

	clearChildren();

	addItem(newDirectory);
	addItem(sortBy);
	addItem(refresh);
	addSeparator();

	if (file.type() == FileType.Absolute || file.type() == FileType.External) addItem(delete);

	if (file.type() == FileType.Absolute) {
		addItem(showInExplorer);

		if (file.isDirectory()) {
			if (favorites.contains(file, false))
				addItem(removeFromFavorites);
			else
				addItem(addToFavorites);
		}
	}
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:25,代码来源:FilePopupMenu.java

示例8: applicationDidFinishLaunching

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
@Override
public boolean applicationDidFinishLaunching() {
	FileUtils.getInstance().addSearchPath("/Users/xujun/remoteProject/Cocos2dJavaImages", FileType.Absolute, true);
	FileUtils.getInstance().addSearchPath("Resource", FileType.Internal, true);
	
	Director.getInstance().getOpenGLView().setDesignResolutionSize(1136, 640, ResolutionPolicy.EXACT_FIT);
	
	_testController = TestController.getInstance();
	_testController.start();
	return true;
}
 
开发者ID:mingwuyun,项目名称:cocos2d-java,代码行数:12,代码来源:TestAppDelegate_Tests.java

示例9: create

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
@Override
public void create () {
	Array<Controller> controllers = Controllers.getControllers();
	if (controllers.size > 0) {
		controller = controllers.first();
	}
	Controllers.addListener(controllerListener);

	setScreen(new MainMenu(this));
	music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3", FileType.Internal));
	music.setLooping(true);
	music.play();
	Gdx.input.setInputProcessor(new InputAdapter() {
		@Override
		public boolean keyUp (int keycode) {
			if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) {
				Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
			}
			return true;
		}
	});

	fps = new FPSLogger();
}
 
开发者ID:Motsai,项目名称:neblina-libgdx3d,代码行数:25,代码来源:Invaders.java

示例10: newResolver

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
@Override
public FileHandleResolver newResolver (FileType fileType) {
	switch (fileType) {
	case Absolute:
		return new AbsoluteFileHandleResolver();
	case Classpath:
		return new ClasspathFileHandleResolver();
	case External:
		return new ExternalFileHandleResolver();
	case Internal:
		return new InternalFileHandleResolver();
	case Local:
		return new LocalFileHandleResolver();
	}
	return null; // Should never happen
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:17,代码来源:GdxFileSystem.java

示例11: ArchiveFileHandle

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
public ArchiveFileHandle (FileHandle zipfilehandle, String filePath, boolean init) {
	super(filePath, FileType.Classpath);
	this.zipfilehandle = zipfilehandle;
	if (filePath.startsWith("/"))
		filePath = filePath.substring(1);
	if (init) {
		ZipInputStream stream = new ZipInputStream(zipfilehandle.read());
		try {
			ZipEntry entry;
			while ((entry = stream.getNextEntry()) != null)
				if (entry.getName().replace('\\', '/').equals(filePath)) {
					entrystream = stream;
					break;
				}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	this.filePath = filePath;
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:21,代码来源:ArchiveFileHandle.java

示例12: main

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
public static void main(String[] arg) {

		if (Assets.rebuildAtlas) {
			Settings settings = new Settings();
			settings.maxWidth = 2048;
			settings.maxHeight = 2048;
			settings.debug = Assets.drawDebugOutline;
			try {
				TexturePacker.process(settings, "assets-raw",
						"../android/assets", "assets");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.width = 1280;
		config.height = 720;
		config.addIcon("icon128.png", FileType.Internal);
		config.addIcon("icon32.png", FileType.Internal);
		config.addIcon("icon16.png", FileType.Internal);

		new LwjglApplication(new Main(), config);

	}
 
开发者ID:libgdx-jam,项目名称:GDXJam,代码行数:26,代码来源:DesktopLauncher.java

示例13: 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

示例14: main

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
public static void main(String[] arg) throws FileNotFoundException, IOException {
	LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
	config.title = GameConstants.WINDOW_TITLE;
	config.addIcon("gameicon.png", FileType.Internal);
	config.width = GameConstants.GAME_WIDTH;
	config.height = GameConstants.GAME_HEIGHT;
	config.fullscreen = false;
	readConfigFromPreference(config);
	config.vSyncEnabled = config.fullscreen;

	// check debug/run configuration ENVIRONMENT tab
	// if the "DEVEOPMENT" flag is true, then the graphics will be packed together
	// set the flag to false before exporting the jar
	String getenv = System.getenv("DEVELOPMENT");
	if (getenv != null && "true".equals(getenv)) {
		Settings settings = new Settings();
		settings.combineSubdirectories = true;
		TexturePacker.process(settings, "../core/assets/graphics/hud", "../core/assets/packedGraphics", "hud");
		TexturePacker.process(settings, "../core/assets/graphics/game", "../core/assets/packedGraphics", "gameGraphics");
		TexturePacker.process(settings, "../core/assets/graphics/menu", "../core/assets/packedGraphics", "menuGraphics");
	}

	new LwjglApplication(new GDXGame(), config);
}
 
开发者ID:Quillraven,项目名称:Protoman-vs-Megaman,代码行数:25,代码来源:DesktopLauncher.java

示例15: processField

import com.badlogic.gdx.Files.FileType; //导入依赖的package包/类
@Override
public void processField(final Field field, final LmlMacro annotation, final Object component,
        final Context context, final ContextInitializer initializer, final ContextDestroyer contextDestroyer) {
    try {
        final Object macroData = Reflection.getFieldValue(field, component);
        final LmlParser parser = interfaceService.get().getParser();
        final FileType fileType = annotation.fileType();
        if (macroData instanceof String) {
            parser.parseTemplate(Gdx.files.getFileHandle((String) macroData, fileType));
        } else if (macroData instanceof String[]) {
            for (final String macroPath : (String[]) macroData) {
                parser.parseTemplate(Gdx.files.getFileHandle(macroPath, fileType));
            }
        } else {
            throw new GdxRuntimeException("Invalid type of LML macro definition in component: " + component
                    + ". String or String[] expected, received: " + macroData + ".");
        }
    } catch (final ReflectionException exception) {
        throw new GdxRuntimeException(
                "Unable to extract macro paths from field: " + field + " of component: " + component + ".",
                exception);
    }
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn-mvc,代码行数:24,代码来源:LmlMacroAnnotationProcessor.java


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