@Override public FileHandle resolve (String fileName) { return Gdx.files.absolute(fileName); } }
@Override public FileHandle resolve (String fileName) { return Gdx.files.absolute(fileName); } }
BufferedReader reader = new BufferedReader(new InputStreamReader(Gdx.files.absolute(hieroFileRef).read(), "UTF-8")); while (true) { String line = reader.readLine();
BufferedReader reader = new BufferedReader(new InputStreamReader(Gdx.files.absolute(hieroFileRef).read(), "UTF-8")); while (true) { String line = reader.readLine();
} else { if ((imagePath.contains("/") || imagePath.contains("\\")) && !imageName.contains("..")) { file = Gdx.files.absolute(imagePath); if (!file.exists()) { file = Gdx.files.absolute(new File(effectFile.getParentFile(), imageName).getAbsolutePath()); file = Gdx.files.absolute(new File(effectFile.getParentFile(), imagePath).getAbsolutePath());
} else { if ((imagePath.contains("/") || imagePath.contains("\\")) && !imageName.contains("..")) { file = Gdx.files.absolute(imagePath); if (!file.exists()) { file = Gdx.files.absolute(new File(effectFile.getParentFile(), imageName).getAbsolutePath()); file = Gdx.files.absolute(new File(effectFile.getParentFile(), imagePath).getAbsolutePath());
public void actionPerformed (ActionEvent event) { FileDialog dialog = new FileDialog(editor, "Select Image", FileDialog.LOAD); if (lastDir != null) dialog.setDirectory(lastDir); dialog.setVisible(true); final String file = dialog.getFile(); final String dir = dialog.getDirectory(); if (dir == null || file == null || file.trim().length() == 0) return; lastDir = dir; try { final FileHandle absolute = Gdx.files.absolute(dir + file); final BufferedImage read = ImageIO.read(absolute.read()); final Image scaledInstance = read.getScaledInstance(100, -1, Image.SCALE_SMOOTH); final ImageIcon image = new ImageIcon(scaledInstance); JLabel previewImage = new JLabel(image); previewImage.setOpaque(true); previewImage.setBackground(Color.MAGENTA); buildImagePanel(previewImage, absolute.file()); } catch (IOException e) { e.printStackTrace(); } }
public void actionPerformed (ActionEvent event) { FileDialog dialog = new FileDialog(editor, "Select Image", FileDialog.LOAD); if (lastDir != null) dialog.setDirectory(lastDir); dialog.setVisible(true); final String file = dialog.getFile(); final String dir = dialog.getDirectory(); if (dir == null || file == null || file.trim().length() == 0) return; lastDir = dir; try { final FileHandle absolute = Gdx.files.absolute(dir + file); final BufferedImage read = ImageIO.read(absolute.read()); final Image scaledInstance = read.getScaledInstance(100, -1, Image.SCALE_SMOOTH); final ImageIcon image = new ImageIcon(scaledInstance); JLabel previewImage = new JLabel(image); previewImage.setOpaque(true); previewImage.setBackground(Color.MAGENTA); buildImagePanel(previewImage, absolute.file()); } catch (IOException e) { e.printStackTrace(); } }
public void setImageBackground (File file) { if (bgImage != null) { bgImage.getTexture().dispose(); bgImage = null; } if (file != null) { bgImage = new Sprite(new Texture(Gdx.files.absolute(file.getAbsolutePath()))); } }
public void setImageBackground (File file) { if (bgImage != null) { bgImage.getTexture().dispose(); bgImage = null; } if (file != null) { bgImage = new Sprite(new Texture(Gdx.files.absolute(file.getAbsolutePath()))); } }
/** @param ttfFileRef The file system or classpath location of the TrueTypeFont file. */ static private Font createFont (String ttfFileRef) { try { return Font.createFont(Font.TRUETYPE_FONT, Gdx.files.absolute(ttfFileRef).read()); } catch (FontFormatException ex) { throw new GdxRuntimeException("Invalid font: " + ttfFileRef, ex); } catch (IOException ex) { throw new GdxRuntimeException("Error reading font: " + ttfFileRef, ex); } }
/** @param ttfFileRef The file system or classpath location of the TrueTypeFont file. */ static private Font createFont (String ttfFileRef) { try { return Font.createFont(Font.TRUETYPE_FONT, Gdx.files.absolute(ttfFileRef).read()); } catch (FontFormatException ex) { throw new GdxRuntimeException("Invalid font: " + ttfFileRef, ex); } catch (IOException ex) { throw new GdxRuntimeException("Error reading font: " + ttfFileRef, ex); } }
@Override protected Shader createShader (Renderable renderable) { if (config.vertexShader != null && config.fragmentShader != null && tempFolder != null && Gdx.app.getType() == ApplicationType.Desktop) { String prefix = DefaultShader.createPrefix(renderable, config); Gdx.files.absolute(tempFolder).child(name + ".vertex.glsl").writeString(prefix + config.vertexShader, false); Gdx.files.absolute(tempFolder).child(name + ".fragment.glsl").writeString(prefix + config.fragmentShader, false); } BaseShader result = new MultiPassShader(renderable, config); if (tempFolder != null && Gdx.app.getType() == ApplicationType.Desktop) Gdx.files.absolute(tempFolder).child(name + ".log.txt").writeString(result.program.getLog(), false); return result; } }
try { File effectFile = new File(dir, file); effect.loadEmitters(Gdx.files.absolute(effectFile.getAbsolutePath())); if (mergeIntoCurrent){ for (ParticleEmitter emitter : effect.getEmitters()){
try { File effectFile = new File(dir, file); effect.loadEmitters(Gdx.files.absolute(effectFile.getAbsolutePath())); if (mergeIntoCurrent){ for (ParticleEmitter emitter : effect.getEmitters()){
@Override public Shader getShader (Renderable renderable) { try { return super.getShader(renderable); } catch (Throwable e) { if (tempFolder != null && Gdx.app.getType() == ApplicationType.Desktop) Gdx.files.absolute(tempFolder).child(name + ".log.txt").writeString(e.getMessage(), false); if (!revert()) { Gdx.app.error("ShaderCollectionTest", e.getMessage()); throw new GdxRuntimeException("Error creating shader, cannot revert to default shader", e); } error = true; Gdx.app.error("ShaderTest", "Could not create shader, reverted to default shader.", e); return super.getShader(renderable); } }
public void setRenderType (RenderType renderType) { this.renderType = renderType; if (renderType != RenderType.FreeType) { if (bitmapFont != null) { bitmapFont.dispose(); generator.dispose(); } } else { String fontFile = getFontFile(); if (fontFile != null) { generator = new FreeTypeFontGenerator(Gdx.files.absolute(fontFile)); FreeTypeFontParameter param = new FreeTypeFontParameter(); param.size = font.getSize(); param.incremental = true; param.flip = true; param.mono = mono; param.gamma = gamma; bitmapFont = generator.generateFont(param); if (bitmapFont.getData().missingGlyph == null) bitmapFont.getData().missingGlyph = bitmapFont.getData().getGlyph('\ufffd'); cache = bitmapFont.newFontCache(); layout = new GlyphLayout(); } } }
public void setRenderType (RenderType renderType) { this.renderType = renderType; if (renderType != RenderType.FreeType) { if (bitmapFont != null) { bitmapFont.dispose(); generator.dispose(); } } else { String fontFile = getFontFile(); if (fontFile != null) { generator = new FreeTypeFontGenerator(Gdx.files.absolute(fontFile)); FreeTypeFontParameter param = new FreeTypeFontParameter(); param.size = font.getSize(); param.incremental = true; param.flip = true; param.mono = mono; param.gamma = gamma; bitmapFont = generator.generateFont(param); if (bitmapFont.getData().missingGlyph == null) bitmapFont.getData().missingGlyph = bitmapFont.getData().getGlyph('\ufffd'); cache = bitmapFont.newFontCache(); layout = new GlyphLayout(); } } }
private void testAbsolute () throws IOException { String path = new File(Gdx.files.getExternalStoragePath(), "meow").getAbsolutePath(); FileHandle handle = Gdx.files.absolute(path); handle.delete(); if (handle.exists()) fail(); if (!handle.exists()) fail(); if (handle.length() != 3) fail(); FileHandle copy = Gdx.files.absolute(path + "-copy"); copy.delete(); if (copy.exists()) fail(); if (!copy.exists()) fail(); if (copy.length() != 3) fail(); FileHandle move = Gdx.files.absolute(path + "-move"); move.delete(); if (move.exists()) fail();
@Override public void create () { super.create(); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.1f, 0.1f, 0.1f, 1.f)); environment.add(dirLight = new DirectionalLight().set(0.8f, 0.8f, 0.8f, -0.5f, -1.0f, -0.8f)); shaderProvider = new TestShaderProvider(); shaderBatch = new ModelBatch(shaderProvider); cam.position.set(1, 1, 1); cam.lookAt(0, 0, 0); cam.update(); showAxes = true; onModelClicked("g3d/shapes/teapot.g3dj"); shaderRoot = (hotLoadFolder != null && Gdx.app.getType() == ApplicationType.Desktop) ? Gdx.files.absolute(hotLoadFolder) : Gdx.files.internal("data/g3d/shaders"); }