Java Code Examples for com.badlogic.gdx.Files.FileType

The following examples show how to use com.badlogic.gdx.Files.FileType. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: uracer-kotd   Source File: URacerDesktop.java    License: Apache License 2.0 6 votes vote down vote up
private static LwjglApplicationConfiguration createLwjglConfig (BootConfig boot) {
	LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

	// set to uracer defaults
	config.addIcon("data/base/icon.png", FileType.Internal);
	config.title = URacer.Name + " (" + URacer.versionInfo + ")";
	config.resizable = false;
	config.samples = 0;
	config.audioDeviceSimultaneousSources = 32;

	if (Config.Debug.PauseDisabled) {
		config.backgroundFPS = 0;
		config.foregroundFPS = 0;
	} else {
		config.backgroundFPS = 60;
		config.foregroundFPS = 60;
	}

	// apply boot config
	config.width = boot.getInt(BootConfigFlag.WIDTH);
	config.height = boot.getInt(BootConfigFlag.HEIGHT);
	config.vSyncEnabled = boot.getBoolean(BootConfigFlag.VSYNC);
	config.fullscreen = boot.getBoolean(BootConfigFlag.FULLSCREEN);

	return config;
}
 
Example 2
Source Project: vis-ui   Source File: FilePopupMenu.java    License: Apache License 2.0 6 votes vote down vote up
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);
		}
	}
}
 
Example 3
Source Project: bladecoder-adventure-engine   Source File: Main.java    License: Apache License 2.0 6 votes vote down vote up
public static void main(final String[] args) {
	LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();

	cfg.title = "Adventure Editor v" + Versions.getVersion();

	cfg.resizable = true;
	cfg.vSyncEnabled = true;
	// cfg.samples = 2;
	// cfg.useGL30 = true;

	if (Main.class.getResource("/images/ic_app64.png") != null)
		cfg.addIcon("images/ic_app64.png", FileType.Internal);

	if (Main.class.getResource("/images/ic_app32.png") != null)
		cfg.addIcon("images/ic_app32.png", FileType.Internal);

	if (Main.class.getResource("/images/ic_app16.png") != null)
		cfg.addIcon("images/ic_app16.png", FileType.Internal);

	parseArgs(args);

	new Main(new Editor(), cfg);
}
 
Example 4
Source Project: gdx-ai   Source File: GdxFileSystem.java    License: Apache License 2.0 6 votes vote down vote up
@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
}
 
Example 5
Source Project: buffer_bci   Source File: Invaders.java    License: GNU General Public License v3.0 6 votes vote down vote up
@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) {
				if (!Gdx.graphics.isFullscreen()) Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayModes()[0]);
			}
			return true;
		}
	});

	fps = new FPSLogger();
}
 
Example 6
Source Project: uracer-kotd   Source File: EngineSoundSet.java    License: Apache License 2.0 5 votes vote down vote up
public EngineSoundSet () {
	rpm = 0;
	gear = 1;

	//@off
	feIdle = FIS.load(Gdx.files.getFileHandle("data/audio/car-engine/fuzzy/engineVolIdle.fcl", FileType.Internal).read(), true);
	feOnLow = FIS.load(Gdx.files.getFileHandle("data/audio/car-engine/fuzzy/engineVolOnLow.fcl", FileType.Internal).read(), true);
	feOnMid= FIS.load(Gdx.files.getFileHandle("data/audio/car-engine/fuzzy/engineVolOnMid.fcl", FileType.Internal).read(), true);
	feOnHigh = FIS.load(Gdx.files.getFileHandle("data/audio/car-engine/fuzzy/engineVolOnHigh.fcl", FileType.Internal).read(), true);
	feOffLow = FIS.load(Gdx.files.getFileHandle("data/audio/car-engine/fuzzy/engineVolOffLow.fcl", FileType.Internal).read(), true);
	feOffMid= FIS.load(Gdx.files.getFileHandle("data/audio/car-engine/fuzzy/engineVolOffMid.fcl", FileType.Internal).read(), true);
	feOffHigh = FIS.load(Gdx.files.getFileHandle("data/audio/car-engine/fuzzy/engineVolOffHigh.fcl", FileType.Internal).read(), true);
	//@on
}
 
Example 7
Source Project: libgdx-2d-tutorial   Source File: DesktopLauncher.java    License: MIT License 5 votes vote down vote up
public static void main (String[] arg) {
	LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
	config.foregroundFPS = 60;
	config.width = SpaceGame.WIDTH;
	config.height = SpaceGame.HEIGHT;
	config.resizable = true;
	config.addIcon("icon_128.png", FileType.Internal);
	config.addIcon("icon_32.png", FileType.Internal);
	config.addIcon("icon_16.png", FileType.Internal);
	new LwjglApplication(new SpaceGame(), config);
}
 
Example 8
public void run() {
	if(DesktopLauncher.class.getResource("/icons/icon128.png")!=null)
		cfg.addIcon("icons/icon128.png", FileType.Internal);
	
	if(DesktopLauncher.class.getResource("/icons/icon32.png")!=null)
		cfg.addIcon("icons/icon32.png", FileType.Internal);
	
	if(DesktopLauncher.class.getResource("/icons/icon16.png")!=null)
		cfg.addIcon("icons/icon16.png", FileType.Internal);		
	
	new LwjglApplication(this, cfg);
}
 
Example 9
Source Project: gdx-ai   Source File: StandaloneFileSystem.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public FileHandleResolver newResolver (final FileType fileType) {
	return new FileHandleResolver() {

		@Override
		public FileHandle resolve (String fileName) {
			return new DesktopFileHandle(fileName, fileType);
		}
	};
}
 
Example 10
Source Project: uracer-kotd   Source File: PlayerEngineSoundEffect.java    License: Apache License 2.0 4 votes vote down vote up
public PlayerEngineSoundEffect (TrackProgressData progressData) {
	feLoad = FIS.load(Gdx.files.getFileHandle("data/audio/car-engine/fuzzy/engineLoad.fcl", FileType.Internal).read(), true);
	load = 0;
	throttle = 0;
	soundset = new EngineF40(progressData);
}
 
Example 11
Source Project: uracer-kotd   Source File: Sounds.java    License: Apache License 2.0 4 votes vote down vote up
public static void init () {
	carDrift = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-tires/drift-loop.ogg", FileType.Internal));

	//@off

	carImpacts[0] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-crashes/impact-2.ogg", FileType.Internal)); // low1
	carImpacts[1] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-crashes/impact-3.ogg", FileType.Internal)); // low2
	carImpacts[2] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-crashes/impact-7.ogg", FileType.Internal)); // low3
	carImpacts[3] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-crashes/impact-8.ogg", FileType.Internal)); // low4
	carImpacts[4] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-crashes/impact-1.ogg", FileType.Internal)); // mid1
	carImpacts[5] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-crashes/impact-4.ogg", FileType.Internal)); // mid2
	carImpacts[6] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-crashes/impact-6.ogg", FileType.Internal)); // mid3
	carImpacts[7] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-crashes/impact-5.ogg", FileType.Internal)); // high

	musTensive[0] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "tensive/prologue-1.ogg", FileType.Internal));
	musTensive[1] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "tensive/prologue-2.ogg", FileType.Internal));
	musTensive[2] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "tensive/prologue-3.ogg", FileType.Internal));
	musTensive[3] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "tensive/prologue-4.ogg", FileType.Internal));
	musTensive[4] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "tensive/inciso-1.ogg", FileType.Internal));
	musTensive[5] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "tensive/inciso-2.ogg", FileType.Internal));
	musTensive[6] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "tensive/inciso-3.ogg", FileType.Internal));

	// f40
	carEngine_f40[0] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f40/idle.wav", FileType.Internal));
	carEngine_f40[1] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f40/onlow.wav", FileType.Internal));
	carEngine_f40[2] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f40/onmid.wav", FileType.Internal));
	carEngine_f40[3] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f40/onhigh.wav", FileType.Internal));
	carEngine_f40[4] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f40/offlow.wav", FileType.Internal));
	carEngine_f40[5] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f40/offmid.wav", FileType.Internal));
	carEngine_f40[6] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f40/offhigh.wav", FileType.Internal));

	// a1 Boxster
	carEngine_a1[0] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/a1/idle_ext.wav", FileType.Internal));
	carEngine_a1[1] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/a1/on_2000_ext.wav", FileType.Internal));
	carEngine_a1[2] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/a1/on_3000_ext.wav", FileType.Internal));
	carEngine_a1[3] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/a1/on_6000_ext.wav", FileType.Internal));
	carEngine_a1[4] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/a1/off_2000_ext.wav", FileType.Internal));
	carEngine_a1[5] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/a1/off_3000_ext.wav", FileType.Internal));
	carEngine_a1[6] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/a1/off_6000_ext.wav", FileType.Internal));

	// f1 RF1V8
	carEngine_f1[0] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f1/idle.wav", FileType.Internal));
	carEngine_f1[1] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f1/onlow.wav", FileType.Internal));
	carEngine_f1[2] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f1/onmid.wav", FileType.Internal));
	carEngine_f1[3] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f1/onhigh.wav", FileType.Internal));
	carEngine_f1[4] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f1/offlow.wav", FileType.Internal));
	carEngine_f1[5] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f1/offmid.wav", FileType.Internal));
	carEngine_f1[6] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/f1/offhigh.wav", FileType.Internal));

	// muscle
	carEngine_msc[0] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/muscle/idle.wav", FileType.Internal));
	carEngine_msc[1] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/muscle/onlow.wav", FileType.Internal));
	carEngine_msc[2] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/muscle/onmid.wav", FileType.Internal));
	carEngine_msc[3] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/muscle/onhigh.wav", FileType.Internal));
	carEngine_msc[4] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/muscle/offlow.wav", FileType.Internal));
	carEngine_msc[5] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/muscle/offmid.wav", FileType.Internal));
	carEngine_msc[6] = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "car-engine/muscle/offhigh.wav", FileType.Internal));

	// menu sfx
	menuClick = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "menu-sfx/click1.ogg", FileType.Internal));
	menuRollover = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "menu-sfx/rollover2.ogg", FileType.Internal));
	menuSwitch = Gdx.audio.newSound(Gdx.files.getFileHandle(Storage.Audio + "menu-sfx/switch2.ogg", FileType.Internal));
	
	//@on
}
 
Example 12
Source Project: libgdx-snippets   Source File: FileUtils.java    License: MIT License 4 votes vote down vote up
public static FileHandle newFileHandle(File file, FileType type) {
	return new FileHandleHelper(file, type);
}
 
Example 13
Source Project: libgdx-snippets   Source File: FileUtils.java    License: MIT License 4 votes vote down vote up
FileHandleHelper(File file, FileType type) {
	super(file, type);
}
 
Example 14
Source Project: gdx-ai   Source File: BehaviorTreeLibrary.java    License: Apache License 2.0 4 votes vote down vote up
/** Creates a {@code BehaviorTreeLibrary} with the given debug level and using the new internal resolver returned by the call
 * {@link FileSystem#newResolver(FileType) GdxAI.getFileSystem().newResolver(FileType.Internal)}.
 * @param parseDebugLevel the debug level the parser will use */
public BehaviorTreeLibrary (int parseDebugLevel) {
	this(GdxAI.getFileSystem().newResolver(FileType.Internal), parseDebugLevel);
}
 
Example 15
Source Project: gdx-ai   Source File: GdxFileSystem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FileHandle newFileHandle (String fileName, FileType type) {
	return Gdx.files.getFileHandle(fileName, type);
}
 
Example 16
Source Project: gdx-ai   Source File: GdxFileSystem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FileHandle newFileHandle (File file, FileType type) {
	return Gdx.files.getFileHandle(file.getPath(), type);
}
 
Example 17
Source Project: gdx-ai   Source File: StandaloneFileSystem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FileHandle newFileHandle (String fileName) {
	return new DesktopFileHandle(fileName, FileType.Absolute);
}
 
Example 18
Source Project: gdx-ai   Source File: StandaloneFileSystem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FileHandle newFileHandle (File file) {
	return new DesktopFileHandle(file, FileType.Absolute);
}
 
Example 19
Source Project: gdx-ai   Source File: StandaloneFileSystem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FileHandle newFileHandle (String fileName, FileType type) {
	return new DesktopFileHandle(fileName, type);
}
 
Example 20
Source Project: gdx-ai   Source File: StandaloneFileSystem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FileHandle newFileHandle (File file, FileType type) {
	return new DesktopFileHandle(file, type);
}
 
Example 21
Source Project: gdx-ai   Source File: StandaloneFileSystem.java    License: Apache License 2.0 4 votes vote down vote up
public DesktopFileHandle (String fileName, FileType type) {
	super(fileName, type);
}
 
Example 22
Source Project: gdx-ai   Source File: StandaloneFileSystem.java    License: Apache License 2.0 4 votes vote down vote up
public DesktopFileHandle (File file, FileType type) {
	super(file, type);
}
 
Example 23
Source Project: gdx-ai   Source File: StandaloneFileSystem.java    License: Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 24
Source Project: gdx-ai   Source File: FileSystem.java    License: Apache License 2.0 votes vote down vote up
public FileHandleResolver newResolver(FileType fileType); 
Example 25
Source Project: gdx-ai   Source File: FileSystem.java    License: Apache License 2.0 votes vote down vote up
public FileHandle newFileHandle(String fileName, FileType type); 
Example 26
Source Project: gdx-ai   Source File: FileSystem.java    License: Apache License 2.0 votes vote down vote up
public FileHandle newFileHandle(File file, FileType type);