com.badlogic.gdx.assets.loaders.TextureLoader Java Examples

The following examples show how to use com.badlogic.gdx.assets.loaders.TextureLoader. 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 File: CCTextureAtlasLoader.java    From cocos-ui-libgdx with Apache License 2.0 5 votes vote down vote up
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, TextureAtlasLoader.TextureAtlasParameter parameter) {
    FileHandle imgDir = file.parent();
    map = LyU.createDictionaryWithContentsOfFile(file);
    ObjectMap<String, Object> metadata = (ObjectMap<String, Object>) map.get("metadata");
    String dependFile = (String) metadata.get("textureFileName");
    Array<AssetDescriptor> res = new Array<AssetDescriptor>();
    TextureLoader.TextureParameter params = new TextureLoader.TextureParameter();
    params.magFilter = Texture.TextureFilter.Linear;
    params.minFilter = Texture.TextureFilter.Linear;
    params.format = Pixmap.Format.RGBA8888;
    texture = new Texture(imgDir.child(dependFile));
    res.add(new AssetDescriptor(imgDir.child(dependFile), Texture.class, params));
    return res;
}
 
Example #2
Source File: GameScene.java    From GdxDemo3D with Apache License 2.0 5 votes vote down vote up
public GameScene(ModelLoader.ModelParameters modelParameters,
				 TextureLoader.TextureParameter textureParameter,
				 ParticleEffectLoader.ParticleEffectLoadParameter pfxParameter,
				 String pfxPath, String modelPath, String modelExt, ObjectMap<String, GameObjectBlueprint> sharedBlueprints) {
	this.sharedBlueprints = sharedBlueprints;
	this.assets = new BlenderAssetManager(modelParameters, textureParameter, pfxParameter,
			pfxPath, modelPath, modelExt);
}
 
Example #3
Source File: GameSceneManager.java    From GdxDemo3D with Apache License 2.0 5 votes vote down vote up
public GameSceneManager(ModelLoader.ModelParameters modelParameters,
						TextureLoader.TextureParameter textureParameter,
						ParticleEffectLoader.ParticleEffectLoadParameter pfxParameter,
						String pfxPath, String modelPath, String modelExt) {
	this.modelPath = modelPath;
	this.modelExt = modelExt;
	this.pfxPath = pfxPath;

	this.modelParameters = modelParameters;
	this.textureParameter = textureParameter;
	this.pfxParameter = pfxParameter;
}
 
Example #4
Source File: BlenderAssetManager.java    From GdxDemo3D with Apache License 2.0 5 votes vote down vote up
public BlenderAssetManager(
		ModelLoader.ModelParameters modelParameters,
		TextureLoader.TextureParameter textureParameter,
		ParticleEffectLoader.ParticleEffectLoadParameter pfxParameter,
		String pfxPath, String modelPath, String modelExt) {
	this.modelExt = modelExt;
	this.modelPath = modelPath;
	this.pfxPath = pfxPath;

	this.modelParameters = modelParameters;
	this.textureParameter = textureParameter;
	this.pfxParameter = pfxParameter;
}
 
Example #5
Source File: EngineAssetManager.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
protected EngineAssetManager(FileHandleResolver resolver) {
	super(resolver);

	resResolver = new EngineResolutionFileResolver(resolver);
	setLoader(Texture.class, new TextureLoader(resResolver));
	setLoader(TextureAtlas.class, new TextureAtlasLoader(resResolver));
	setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
	setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(resolver));

	Texture.setAssetManager(this);
}
 
Example #6
Source File: DemoScreen.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
public DemoScreen() {
    // Asset initialization.
    {
        assets = new AssetManager();
        assets.load("skin/uiskin.json", Skin.class, null);

        // Textures
        {
            TextureLoader.TextureParameter paramsRegular = new TextureLoader.TextureParameter();
            paramsRegular.minFilter = Texture.TextureFilter.Nearest;
            paramsRegular.magFilter = Texture.TextureFilter.Nearest;
            paramsRegular.wrapU = Texture.TextureWrap.ClampToEdge;
            paramsRegular.wrapV = Texture.TextureWrap.ClampToEdge;

            TextureLoader.TextureParameter paramsRepeat = new TextureLoader.TextureParameter();
            paramsRepeat.minFilter = Texture.TextureFilter.Nearest;
            paramsRepeat.magFilter = Texture.TextureFilter.Nearest;
            paramsRepeat.wrapU = Texture.TextureWrap.Repeat;
            paramsRepeat.wrapV = Texture.TextureWrap.Repeat;

            assets.load("gdx-vfx-logo.png", Texture.class, paramsRegular);
            assets.load("bg-scene-pattern.png", Texture.class, paramsRepeat);
            assets.load("bg-transparency-tile.png", Texture.class, paramsRegular);
        }

        assets.finishLoading();
    }

    batch = new SpriteBatch();
    stage = new Stage(new ExtendViewport(640f, 480f), batch);
    stage.addListener(new StageDebugInputListener());

    lmlParser = (CommonLmlParser)new CommonLmlParserBuilder()
            .syntax(new CommonLmlSyntax())
            .skin(assets.get("skin/uiskin.json", Skin.class))
            .action(":empty", new EmptyActorConsumer())
            .build();

    viewControllers = new ViewControllerManager(stage);
    viewControllers.add(new ScreenBackgroundViewController(lmlParser, assets));
    viewControllers.add(new VfxViewController(viewControllers, lmlParser));
    viewControllers.add(new CanvasContentViewController(viewControllers, lmlParser, assets));
    viewControllers.add(new EffectRosterViewController(viewControllers, lmlParser));
    viewControllers.add(new StatisticPanelViewController(viewControllers, lmlParser));

    Group sceneRoot = (Group)lmlParser.parseTemplate(
            Gdx.files.internal("lml/screen-demo/root.lml")).first();
    stage.addActor(sceneRoot);

    viewControllers.onViewCreated(sceneRoot);
}
 
Example #7
Source File: Utility.java    From Norii with Apache License 2.0 4 votes vote down vote up
public static void loadTextureAsset(final String textureFilenamePath) {
	loadAsset(textureFilenamePath, Texture.class, new TextureLoader(filePathResolver));
}
 
Example #8
Source File: HeadlessModelLoader.java    From gdx-proto with Apache License 2.0 4 votes vote down vote up
public HeadlessModelParameters() {
	textureParameter = new TextureLoader.TextureParameter();
	textureParameter.minFilter = textureParameter.magFilter = Texture.TextureFilter.Linear;
	textureParameter.wrapU = textureParameter.wrapV = Texture.TextureWrap.Repeat;
}