本文整理匯總了Java中com.badlogic.gdx.Files類的典型用法代碼示例。如果您正苦於以下問題:Java Files類的具體用法?Java Files怎麽用?Java Files使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Files類屬於com.badlogic.gdx包,在下文中一共展示了Files類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import com.badlogic.gdx.Files; //導入依賴的package包/類
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = FlappyChapa.WIDTH;
config.height = FlappyChapa.HEIGHT;
config.title = FlappyChapa.TITLE;
config.addIcon("icons/chapaicon.png", Files.FileType.Internal);
config.addIcon("icons/chapaicon1.png", Files.FileType.Internal);
config.addIcon("icons/chapaicon2.png", Files.FileType.Internal);
new LwjglApplication(new FlappyChapa(), config);
}
示例2: main
import com.badlogic.gdx.Files; //導入依賴的package包/類
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = 1280;
config.height = 720;
config.title = Constants.NAME;
config.backgroundFPS = 30;
if (System.getProperties().getProperty("os.name").toLowerCase().contains("mac")) {
config.addIcon("image/icon-512.png", Files.FileType.Internal);
config.addIcon("image/icon-256.png", Files.FileType.Internal);
}
config.addIcon("image/icon-32.png", Files.FileType.Internal);
config.addIcon("image/icon-16.png", Files.FileType.Internal);
ArgumentParser argParser = new ArgumentParser(arg);
Control[] controls = new Control[argParser.touchControl ? 3 : 2];
controls[0] = new ControlKeyboard();
controls[1] = new ControlController();
if (argParser.touchControl)
controls[2] = new ControlTouch();
new LwjglApplication(new Client(controls, new Audio(), argParser), config);
}
示例3: main
import com.badlogic.gdx.Files; //導入依賴的package包/類
public static void main (String[] arg) {
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "Inspiration";
cfg.useGL30 = false;
cfg.width = 640;
cfg.height = 480;
// cfg.width = 800;
// cfg.height = 600;
// fullscreen
// cfg.fullscreen = true;
// vSync
// cfg.vSyncEnabled = true;
cfg.addIcon("icon.png", Files.FileType.Internal);
Gdx.app = new LwjglApplication(new Inspiration(), cfg);
//Gdx.app.setLogLevel(Application.LOG_INFO);
Gdx.app.setLogLevel(Application.LOG_DEBUG);
//Gdx.app.setLogLevel(Application.LOG_ERROR);
//Gdx.app.setLogLevel(Application.LOG_NONE);
}
示例4: main
import com.badlogic.gdx.Files; //導入依賴的package包/類
public static void main (String[] arg) {
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "Inspiration";
cfg.useGL30 = false;
cfg.width = 640;
cfg.height = 480;
// cfg.width = 800;
// cfg.height = 600;
// fullscreen
// cfg.fullscreen = true;
// vSync
// cfg.vSyncEnabled = true;
cfg.addIcon("icon.png", Files.FileType.Internal);
Gdx.app = new LwjglApplication(new Inspiration(), cfg);
//Gdx.app.setLogLevel(Application.LOG_INFO);
// Gdx.app.setLogLevel(Application.LOG_DEBUG);
//Gdx.app.setLogLevel(Application.LOG_ERROR);
//Gdx.app.setLogLevel(Application.LOG_NONE);
}
示例5: Configuration
import com.badlogic.gdx.Files; //導入依賴的package包/類
private Configuration(final Files files, final String moduleName) {
if (configuration != null) {
this.options = configuration.options;
} else {
loadOptions(files);
}
configuration = this;
this.moduleName = moduleName;
this.moduleFolder = FOLDER_MODULES + moduleName + "/";
String file = moduleFolder + "config.xml";
try {
loadFromXML(files.internal(file));
loadingScreensConfiguration = new LoadingScreens(files.internal(Configuration.getFolderUI()
+ "loadingScreens.xml"));
} catch (final IOException e) {
throw new GdxRuntimeException("Cannot read configuration file " + file + ", aborting.", e);
}
}
示例6: start
import com.badlogic.gdx.Files; //導入依賴的package包/類
public static void start(Arguments arguments) {
LoggerUtils.setupExternalFileOutput();
final LwjglApplicationConfiguration configuration = new LwjglApplicationConfiguration();
configuration.title = AppConstants.APP_TITLE;
configuration.addIcon("icon128.png", Files.FileType.Classpath);
configuration.addIcon("icon32.png", Files.FileType.Classpath);
configuration.addIcon("icon16.png", Files.FileType.Classpath);
configuration.preferencesDirectory = AppConstants.EXTERNAL_DIR;
configuration.width = 1024;
configuration.height = 600;
configuration.allowSoftwareMode = arguments.softOpenGL;
AppParams appParams = new AppParams();
appParams.startupProject = arguments.project;
App app = new App(new DesktopClassScanner(), appParams);
new LwjglApplication(new WindowParamsPersistingApplicationWrapper(app, configuration), configuration);
}
示例7: create
import com.badlogic.gdx.Files; //導入依賴的package包/類
@Override
public void create() {
CurrentResourceLocator.set(new GdxResourceLocator(Files.FileType.Local));
DrawUtil.init();
setupDummyLoader();
loadAssetLists();
setupGdx();
SoundInstance.init();
consoleSkin = new Skin(Gdx.files.internal("data/skins/basic.json"));
consoleView.init(consoleSkin);
addScreenListener(consoleView);
inputMultiplexer.addProcessor(consoleView.getInputProcessor());
inputMultiplexer.addProcessor(HotkeyManager.getInputProcessor());
changeState(new LoadGameState(assetManager, this::onLoadComplete), null, null);
this.console.register(distanceModel);
distanceModel.addListener((CVar) -> distanceModel.get().activate());
this.console.register(emitterMode);
emitterMode.addListener(this::onEmitterModeChanged);
}
示例8: create
import com.badlogic.gdx.Files; //導入依賴的package包/類
@Override
public void create () {
if (spriteBatch != null) return;
spriteBatch = new SpriteBatch();
Matrix4 transform = new Matrix4();
transform.setToTranslation(0, Gdx.graphics.getHeight(), 0);
transform.mul(new Matrix4().setToScaling(1, -1, 1));
spriteBatch.setTransformMatrix(transform);
pixS1 = new Pixmap(Gdx.files.getFileHandle("data/test4.png", Files.FileType.Internal));
pixS2 = new Pixmap(Gdx.files.getFileHandle("data/test3.png", Files.FileType.Internal));
pixD = new Pixmap(64, 128, Pixmap.Format.RGBA8888);
pixD.drawPixmap(pixS1, 0, 0, 0, 0, 76, 76);
pixD.drawPixmap(pixS2, 0, 0, 0, 0, 76, 76);
logoSprite = new Sprite(new Texture(pixD));
logoSprite.flip(false, true);
pixS1.dispose();
pixS2.dispose();
pixD.dispose();
}
示例9: main
import com.badlogic.gdx.Files; //導入依賴的package包/類
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "Tiny Voxel";
config.width = 1280;
config.height = 720;
config.useGL30 = false;
// config.vSyncEnabled = true;
config.vSyncEnabled = false;
config.foregroundFPS = 0; // Setting to 0 disables foreground fps throttling
config.backgroundFPS = 0; // Setting to 0 disables background fps throttling
config.stencil = 0;
//cfg.fullscreen = true;
config.addIcon("textures/icon.png", Files.FileType.Internal);
Config.set(new DesktopConfig());
new LwjglApplication(new Game(new KeyBoardController()), config);
}
示例10: createApplicationAssets
import com.badlogic.gdx.Files; //導入依賴的package包/類
@Override
protected ApplicationAssets createApplicationAssets(Files files) {
// 48px are 0.8cm in scale 1.0
float scale = (Gdx.graphics.getPpcX() * 0.8f) / 48.0f;
String scaleString;
if (scale < Float.parseFloat(SCALES[0])) {
scaleString = SCALES[0];
} else {
scaleString = SCALES[SCALES.length - 1];
for (int i = 0; i < SCALES.length - 1; i++) {
float lowerScale = Float.parseFloat(SCALES[i]);
float greaterScale = Float.parseFloat(SCALES[i + 1]);
if (scale >= lowerScale && scale <= greaterScale) {
scaleString = scale - lowerScale < greaterScale - scale ? SCALES[i]
: SCALES[i + 1];
break;
}
}
}
return new ApplicationAssets(files, "skins/mokap/skin.json",
scaleString);
}
示例11: loadTexture
import com.badlogic.gdx.Files; //導入依賴的package包/類
public static TextureRef loadTexture(String paramString, Texture.TextureFilter paramTextureFilter1, Texture.TextureFilter paramTextureFilter2, Texture.TextureWrap paramTextureWrap1, Texture.TextureWrap paramTextureWrap2)
{
if (sDictionary.containsKey(paramString))
{
TextureRef localTextureRef2 = (TextureRef)sDictionary.get(paramString);
localTextureRef2.addRef();
return localTextureRef2;
}
FileHandle localFileHandle = Gdx.app.getFiles().getFileHandle(paramString, Files.FileType.Internal);
if ((paramTextureFilter1.isMipMap()) || (paramTextureFilter2.isMipMap()));
for (boolean bool = true; ; bool = false)
{
Texture localTexture = new Texture(localFileHandle, bool);
localTexture.setFilter(paramTextureFilter1, paramTextureFilter2);
localTexture.setWrap(paramTextureWrap1, paramTextureWrap2);
TextureRef localTextureRef1 = new TextureRef(paramString, localTexture);
sDictionary.put(paramString, localTextureRef1);
return localTextureRef1;
}
}
示例12: list
import com.badlogic.gdx.Files; //導入依賴的package包/類
public FileHandle[] list()
{
int i = 0;
if (this.type == Files.FileType.Classpath)
throw new GdxRuntimeException("Cannot list a classpath directory: " + this.file);
String[] arrayOfString = file().list();
FileHandle[] arrayOfFileHandle;
if (arrayOfString == null)
arrayOfFileHandle = new FileHandle[0];
while (true)
{
return arrayOfFileHandle;
arrayOfFileHandle = new FileHandle[arrayOfString.length];
int j = arrayOfString.length;
while (i < j)
{
arrayOfFileHandle[i] = child(arrayOfString[i]);
i++;
}
}
}
示例13: read
import com.badlogic.gdx.Files; //導入依賴的package包/類
public InputStream read()
{
Object localObject;
if ((this.type == Files.FileType.Classpath) || ((this.type == Files.FileType.Internal) && (!this.file.exists())) || ((this.type == Files.FileType.Local) && (!this.file.exists())))
{
localObject = FileHandle.class.getResourceAsStream("/" + this.file.getPath().replace('\\', '/'));
if (localObject != null)
break label146;
throw new GdxRuntimeException("File not found: " + this.file + " (" + this.type + ")");
}
try
{
localObject = new FileInputStream(file());
label146: return localObject;
}
catch (Exception localException)
{
if (file().isDirectory())
throw new GdxRuntimeException("Cannot open a stream to a directory: " + this.file + " (" + this.type + ")", localException);
throw new GdxRuntimeException("Error reading file: " + this.file + " (" + this.type + ")", localException);
}
}
示例14: write
import com.badlogic.gdx.Files; //導入依賴的package包/類
public OutputStream write(boolean paramBoolean)
{
if (this.type == Files.FileType.Classpath)
throw new GdxRuntimeException("Cannot write to a classpath file: " + this.file);
if (this.type == Files.FileType.Internal)
throw new GdxRuntimeException("Cannot write to an internal file: " + this.file);
parent().mkdirs();
try
{
FileOutputStream localFileOutputStream = new FileOutputStream(file(), paramBoolean);
return localFileOutputStream;
}
catch (Exception localException)
{
if (file().isDirectory())
throw new GdxRuntimeException("Cannot open a stream to a directory: " + this.file + " (" + this.type + ")", localException);
throw new GdxRuntimeException("Error writing file: " + this.file + " (" + this.type + ")", localException);
}
}
示例15: writer
import com.badlogic.gdx.Files; //導入依賴的package包/類
public Writer writer(boolean paramBoolean, String paramString)
{
if (this.type == Files.FileType.Classpath)
throw new GdxRuntimeException("Cannot write to a classpath file: " + this.file);
if (this.type == Files.FileType.Internal)
throw new GdxRuntimeException("Cannot write to an internal file: " + this.file);
parent().mkdirs();
try
{
FileOutputStream localFileOutputStream = new FileOutputStream(file(), paramBoolean);
if (paramString == null)
return new OutputStreamWriter(localFileOutputStream);
OutputStreamWriter localOutputStreamWriter = new OutputStreamWriter(localFileOutputStream, paramString);
return localOutputStreamWriter;
}
catch (IOException localIOException)
{
if (file().isDirectory())
throw new GdxRuntimeException("Cannot open a stream to a directory: " + this.file + " (" + this.type + ")", localIOException);
throw new GdxRuntimeException("Error writing file: " + this.file + " (" + this.type + ")", localIOException);
}
}