All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.bloodshura.ignitium.assets.ext.AssetsExt Maven / Gradle / Ivy

Go to download

Extensions for the Ignitium Assets library, including new image and sound codecs.

There is a newer version: 1.0.1
Show newest version
package com.github.bloodshura.ignitium.assets.ext;

import com.github.bloodshura.ignitium.assets.AssetManager;
import com.github.bloodshura.ignitium.assets.Assets;
import com.github.bloodshura.ignitium.assets.ext.image.IcoCodec;
import com.github.bloodshura.ignitium.assets.ext.image.JimiCodec;
import com.github.bloodshura.ignitium.assets.ext.sound.OggCodec;
import com.github.bloodshura.ignitium.assets.image.ImageFormat;
import com.github.bloodshura.ignitium.assets.sound.SoundFormat;
import com.github.bloodshura.ignitium.assets.sound.codec.DefaultSoundCodec;

import javax.annotation.Nonnull;

public class AssetsExt {
	public static void installImage() {
		installImage(Assets.getManager());
	}

	public static void installImage(@Nonnull AssetManager manager) {
		manager.setCodec(ImageFormat.APF, JimiCodec.class);
		manager.setCodec(ImageFormat.BMP, JimiCodec.class);
		manager.setCodec(ImageFormat.CUR, JimiCodec.class);
		//manager.setCodec(ImageFormat.GIF, JimiCodec.class); GIF does not have encoding, so let's just use the default codec
		manager.setCodec(ImageFormat.ICO, IcoCodec.class);
		manager.setCodec(ImageFormat.JPG, JimiCodec.class);
		manager.setCodec(ImageFormat.PCT, JimiCodec.class);
		manager.setCodec(ImageFormat.PCX, JimiCodec.class);
		manager.setCodec(ImageFormat.PNG, JimiCodec.class);
		manager.setCodec(ImageFormat.PSD, JimiCodec.class);
		manager.setCodec(ImageFormat.RAS, JimiCodec.class);
		manager.setCodec(ImageFormat.TGA, JimiCodec.class);
		manager.setCodec(ImageFormat.TIFF, JimiCodec.class);
		manager.setCodec(ImageFormat.XBM, JimiCodec.class);
		manager.setCodec(ImageFormat.XPM, JimiCodec.class);
	}

	public static void installSound() {
		installSound(Assets.getManager());
	}

	public static void installSound(@Nonnull AssetManager manager) {
		manager.setCodec(SoundFormat.MP3, DefaultSoundCodec.class); // The codec is loaded via Tritonus into Java Sound SPI
		manager.setCodec(SoundFormat.OGG, OggCodec.class);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy