List of usage examples for com.badlogic.gdx Gdx files
Files files
To view the source code for com.badlogic.gdx Gdx files.
Click Source Link
From source file:com.explatcreations.sft.Assets.java
License:Open Source License
private static Pixmap loadPixmap(String name) { return new Pixmap(Gdx.files.internal("sprites/" + name + ".png")); }
From source file:com.explatcreations.sft.Assets.java
License:Open Source License
private static Texture loadTexture(String name) { return new Texture(Gdx.files.internal("sprites/" + name + ".png")); }
From source file:com.explatcreations.sft.Assets.java
License:Open Source License
private static String loadTextFile(String name) { final String path = "notes/" + name + ".txt"; return Gdx.files.internal(path).readString(); }
From source file:com.explatcreations.sft.graphics.Shader.java
License:Open Source License
private ShaderProgram compileShader() { final ShaderProgram result = new ShaderProgram(Gdx.files.internal(Root + vert), Gdx.files.internal(Root + frag)); final String log = result.getLog(); //disallow any warnings if (!result.isCompiled() || (log.length() != 0 && log.contains("warning"))) { Debug.warning(log);//from w w w . j a v a2 s . com throw new RuntimeException(log); } return result; }
From source file:com.explatcreations.sft.World.java
License:Open Source License
private LevelData fromFile(String filename) { final FileHandle file = Gdx.files.internal(filename); if (!file.exists()) { return null; }//from ww w. ja v a 2 s . c om final ITiledMap map = MapLoader.fromFile(file); final int[][] tiles = map.getTiles(); final int cols = map.getCols(); final int rows = map.getRows(); final int goldSteps = Integer.parseInt(map.getProperty("gold")); final Point2i start = Point2i.fromString(map.getProperty("start")); final String name = map.getProperty("name"); final String uuid = name + start.toString(); return new LevelData(tiles, cols, rows, goldSteps, start, name, uuid); }
From source file:com.felix.game.ViewportTest1.java
License:Apache License
public void create() { stage = new Stage(); Skin skin = new Skin(Gdx.files.internal("data/uiskin.json")); label = new Label("", skin); Table root = new Table(skin); root.setFillParent(true);// w w w .j ava 2 s .c o m root.setBackground(skin.getDrawable("default-pane")); root.debug().defaults().space(6); root.add(new TextButton("Button 1", skin)); root.add(new TextButton("Button 2", skin)).row(); root.add("Press spacebar to change the viewport:").colspan(2).row(); root.add(label).colspan(2); stage.addActor(root); viewports = getViewports(stage.getCamera()); names = getViewportNames(); stage.setViewport(viewports.first()); label.setText(names.first()); Gdx.input.setInputProcessor(new InputMultiplexer(new InputAdapter() { public boolean touchDown(int screenX, int screenY, int pointer, int button) { int index = (viewports.indexOf(stage.getViewport(), true) + 1) % viewports.size; label.setText(names.get(index)); Viewport viewport = viewports.get(index); stage.setViewport(viewport); resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); return false; } }, stage)); }
From source file:com.flaiker.reaktio.entities.DoubleTouchCircleEntity.java
License:Open Source License
public DoubleTouchCircleEntity(float x, float y, boolean selfSolving) { super(new TextureRegion(new Texture(Gdx.files.internal("DoubleTouchCircleEntity.png"))), x, y, WIDTH, HEIGHT, selfSolving);/*w ww . ja v a 2s . co m*/ }
From source file:com.flaiker.reaktio.entities.DoubleTouchCircleEntity.java
License:Open Source License
@Override public boolean touchDown(float x, float y) { if (!isSolved()) { touchCount++;//ww w . j ava 2 s. com if (touchCount == 1) sprite.setTexture(new Texture(Gdx.files.internal("SingleTouchCircleEntity.png"))); if (touchCount == 2) setSolved(true); return true; } return false; }
From source file:com.flaiker.reaktio.entities.DoubleTouchCircleEntity.java
License:Open Source License
@Override public void resetVisibility() { super.resetVisibility(); sprite.setTexture(new Texture(Gdx.files.internal("DoubleTouchCircleEntity.png"))); }
From source file:com.flaiker.reaktio.entities.DragSquareEntity.java
License:Open Source License
public DragSquareEntity(float x, float y, Direction direction, boolean selfSolving) { super(new TextureRegion(new Texture(Gdx.files.internal("DragSquareEntity.png"))), x, y, WIDTH, HEIGHT, selfSolving);/*from w w w. ja va2s . co m*/ startPos = new Vector2(x, y); this.direction = direction; switch (direction) { case LEFT: sprite.rotate90(true); sprite.rotate90(true); break; case RIGHT: break; case UP: sprite.rotate90(false); break; case DOWN: sprite.rotate90(true); break; } }