public void create () { Gdx.app.setLogLevel(Application.LOG_ERROR); Resolution[] resolutions = {new Resolution(320, 480, ".320480"), new Resolution(480, 800, ".480800"), new Resolution(480, 856, ".480854")}; ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), resolutions); manager = new AssetManager(); manager.setLoader(Texture.class, new TextureLoader(resolver)); manager.setErrorListener(this); load(); Texture.setAssetManager(manager); batch = new SpriteBatch(); font = new BitmapFont(Gdx.files.internal("data/font.fnt"), false); }
@SuppressWarnings("static-access") public Texture getCircleColorTexture(int radius, Color color) { Texture circle = textures.get("circle" + radius + color.toString()); if (circle == null) { Pixmap pixmap = new Pixmap(radius * 2 + 2, radius * 2 + 2, Format.RGBA8888); pixmap.setColor(color); pixmap.fillCircle(radius + 1, radius + 1, radius); circle = new Texture(pixmap); circle.setFilter(filter, filter); textures.put("circle" + radius + color.toString(), circle); circle.setAssetManager(assets); pixmap.dispose(); } return circle; }
/** * 获取颜色像素点 */ @SuppressWarnings("static-access") public Texture getColorPointTexture(Color color) { Texture colorPoint = textures.get("color" + color.toString()); if (colorPoint == null) { Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888); pixmap.setColor(color); pixmap.fill(); colorPoint = new Texture(pixmap); colorPoint.setFilter(filter, filter); textures.put("color" + color.toString(), colorPoint); colorPoint.setAssetManager(assets); pixmap.dispose(); } return colorPoint; }
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); }
@Override public void create () { I18NBundle.setExceptionOnMissingKey(false); I18NBundle.setSimpleFormatter(true); Gdx.app.getInput().setCatchBackKey(true); Lw.language = SimpleLanguageFactory.getDefault(); Lw.skin = new Skin(); Lw.assetManager = new AssetManager(); Texture.setAssetManager(Lw.assetManager); Lw.uiManager = new UIManager(new ExtendViewport(getUIWidth(), getUIHeight())); onCreate(); }
@Override public void create () { I18NBundle.setExceptionOnMissingKey(false); I18NBundle.setSimpleFormatter(true); Gdx.app.getInput().setCatchBackKey(true); Lw.language = SimpleLanguageFactory.getDefault(); Lw.skin = new Skin(); Lw.assetManager = new AssetManager(); Texture.setAssetManager(Lw.assetManager); Lw.uiManager = new UIManager(new ExtendViewport(getResolutionWidth(), getResolutionHeight())); onCreate(); }