use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class ShaderMultitextureTest method createTexture.
private void createTexture() {
Pixmap pixmap = new Pixmap(256, 256, Format.RGBA8888);
pixmap.setColor(1, 1, 1, 1);
pixmap.fill();
pixmap.setColor(0, 0, 0, 1);
pixmap.drawLine(0, 0, 256, 256);
pixmap.drawLine(256, 0, 0, 256);
texture = new Texture(pixmap);
pixmap.dispose();
pixmap = new Pixmap(256, 256, Format.RGBA8888);
pixmap.setColor(1, 1, 1, 1);
pixmap.fill();
pixmap.setColor(0, 0, 0, 1);
pixmap.drawLine(128, 0, 128, 256);
texture2 = new Texture(pixmap);
pixmap.dispose();
}
use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class SimpleStageCullingTest method create.
@Override
public void create() {
// create a stage and a camera controller so we can pan the view.
stage = new Stage();
;
// we know it's an ortho cam at this point!
camController = new OrthoCamController((OrthographicCamera) stage.getCamera());
Gdx.input.setInputProcessor(camController);
// load a dummy texture
texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg"));
// populate the stage with some actors and groups.
for (int i = 0; i < 5000; i++) {
Actor img = new CullableActor("img" + i, texture, (OrthographicCamera) stage.getCamera());
img.setX((float) Math.random() * 480 * 10);
img.setY((float) Math.random() * 320 * 10);
stage.addActor(img);
}
// we also want to output the number of visible actors, so we need a SpriteBatch and a BitmapFont
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
}
use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class SortedSpriteTest method create.
@Override
public void create() {
// create the SpriteBatch
batch = new SpriteBatch();
// load a texture, usually you dispose of this
// eventually.
texture = new Texture("data/badlogicsmall.jpg");
// can see that the sorting works.
for (int i = 0; i < 100; i++) {
// create the sprite and set a random position
MySprite sprite = new MySprite(texture);
sprite.setPosition(MathUtils.random() * Gdx.graphics.getWidth(), MathUtils.random() * Gdx.graphics.getHeight());
// create a random z coordinate in the range 0-1
sprite.z = MathUtils.random();
// set the tinting color to the z coordinate as well
// for visual inspection
sprite.setColor(sprite.z, 0, 0, 1);
// add the sprite to the array
sprites.add(sprite);
}
}
use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class EffectPanel method createDefaultPointController.
private ParticleController createDefaultPointController() {
//Emission
RegularEmitter emitter = new RegularEmitter();
emitter.getDuration().setLow(3000);
emitter.getEmission().setHigh(250);
emitter.getLife().setHigh(500, 1000);
emitter.getLife().setTimeline(new float[] { 0, 0.66f, 1 });
emitter.getLife().setScaling(new float[] { 1, 1, 0.3f });
emitter.setMaxParticleCount(200);
//Scale
ScaleInfluencer scaleInfluencer = new ScaleInfluencer();
scaleInfluencer.value.setHigh(1);
//Color
ColorInfluencer.Single colorInfluencer = new ColorInfluencer.Single();
colorInfluencer.colorValue.setColors(new float[] { 0.12156863f, 0.047058824f, 1, 0, 0, 0 });
colorInfluencer.colorValue.setTimeline(new float[] { 0, 1 });
colorInfluencer.alphaValue.setHigh(1);
colorInfluencer.alphaValue.setTimeline(new float[] { 0, 0.5f, 0.8f, 1 });
colorInfluencer.alphaValue.setScaling(new float[] { 0, 0.15f, 0.5f, 0 });
//Spawn
PointSpawnShapeValue pointSpawnShapeValue = new PointSpawnShapeValue();
SpawnInfluencer spawnSource = new SpawnInfluencer(pointSpawnShapeValue);
//Velocity
DynamicsInfluencer velocityInfluencer = new DynamicsInfluencer();
//Directional
DynamicsModifier.PolarAcceleration velocityValue = new DynamicsModifier.PolarAcceleration();
velocityValue.phiValue.setHigh(-35, 35);
velocityValue.phiValue.setActive(true);
velocityValue.phiValue.setTimeline(new float[] { 0, 0.5f, 1 });
velocityValue.phiValue.setScaling(new float[] { 1, 0, 0 });
velocityValue.thetaValue.setHigh(0, 360);
velocityValue.strengthValue.setHigh(5, 10);
return new ParticleController("PointSprite Controller", emitter, new PointSpriteRenderer(editor.getPointSpriteBatch()), new RegionInfluencer.Single((Texture) editor.assetManager.get(FlameMain.DEFAULT_BILLBOARD_PARTICLE)), spawnSource, scaleInfluencer, colorInfluencer, velocityInfluencer);
}
use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class TextureAtlasPanel method setAtlas.
public void setAtlas(TextureAtlas atlas) {
if (atlas == this.atlas)
return;
regionsPanel.removeAll();
Array<AtlasRegion> atlasRegions = atlas.getRegions();
CustomCardLayout layout = (CustomCardLayout) regionsPanel.getLayout();
Array<TextureRegion> regions = new Array<TextureRegion>();
for (Texture texture : atlas.getTextures()) {
FileTextureData file = (FileTextureData) texture.getTextureData();
regionsPanel.add(new TexturePanel(texture, getRegions(texture, atlasRegions, regions)));
}
layout.first(regionsPanel);
this.atlas = atlas;
}
Aggregations