本文整理匯總了Java中com.badlogic.gdx.graphics.Pixmap.Format.RGB565屬性的典型用法代碼示例。如果您正苦於以下問題:Java Format.RGB565屬性的具體用法?Java Format.RGB565怎麽用?Java Format.RGB565使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.badlogic.gdx.graphics.Pixmap.Format
的用法示例。
在下文中一共展示了Format.RGB565屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Renderer
public Renderer () {
try {
lights = new Environment();
lights.add(new DirectionalLight().set(Color.WHITE, new Vector3(-1, -0.5f, 0).nor()));
spriteBatch = new SpriteBatch();
modelBatch = new ModelBatch();
backgroundTexture = new Texture(Gdx.files.internal("data/planet.jpg"), Format.RGB565, true);
backgroundTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);
font = new BitmapFont(Gdx.files.internal("data/font10.fnt"), Gdx.files.internal("data/font10.png"), false);
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例2: show
@Override
public void show () {
font = new BitmapFont(Gdx.files.internal("fonts/font.fnt"));
cache = font.getCache();
if (Gdx.app.getType() == ApplicationType.Android)
font.getData().setScale(2);
polygonBatch = new PolygonSpriteBatch();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
Pixmap pixMap = new Pixmap(1, 1, Format.RGB565);
pixMap.setColor(Color.WHITE);
pixMap.fill();
emptyTexture = new Texture(pixMap);
pixMap.dispose();
}
示例3: generateCharacter
public static Texture generateCharacter() {
pixmap = new Pixmap(4, 4, Format.RGB565);
//fill square
pixmap.setColor(0.5f, 0.5f, 0.5f, 1);
pixmap.fill();
//draw face/eyes (front of character)
pixmap.setColor(0, 1, 1, 1);
pixmap.drawPixel(3, 2);
pixmap.drawPixel(3, 1);
Texture t = new Texture(pixmap);
pixmap.dispose();
return t;
}
示例4: loadAsync
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file, TextureParameter parameter) {
info.filename = fileName;
if (parameter == null || parameter.textureData == null) {
info.texture = null;
if (parameter != null) {
info.texture = parameter.texture;
}
info.data = new PixmapTextureData(null, Format.RGB565, false, false);
} else {
info.data = parameter.textureData;
info.texture = parameter.texture;
}
}
示例5: setupScene
public void setupScene () {
plane = new Mesh(true, 4, 6, new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(
Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE));
plane.setVertices(new float[] {-10, -1, 10, 0, 1, 0, 10, -1, 10, 0, 1, 0, 10, -1, -10, 0, 1, 0, -10, -1, -10, 0, 1, 0});
plane.setIndices(new short[] {3, 2, 1, 1, 0, 3});
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), Format.RGB565, true);
texture.setFilter(TextureFilter.MipMap, TextureFilter.Nearest);
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(0, 5, 10);
cam.lookAt(0, 0, 0);
cam.update();
controller = new PerspectiveCamController(cam);
projector = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
projector.position.set(2, 3, 2);
projector.lookAt(0, 0, 0);
projector.normalizeUp();
projector.update();
}
示例6: create
@Override
public void create () {
mesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute(Usage.ColorPacked, 4,
"a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords"));
float c1 = Color.toFloatBits(255, 0, 0, 255);
float c2 = Color.toFloatBits(255, 0, 0, 255);
float c3 = Color.toFloatBits(0, 0, 255, 255);
mesh.setVertices(new float[] {-0.5f, -0.5f, 0, c1, 0, 0, 0.5f, -0.5f, 0, c2, 1, 0, 0, 0.5f, 0, c3, 0.5f, 1});
stencilMesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute(
Usage.ColorPacked, 4, "a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords"));
stencilMesh.setVertices(new float[] {-0.5f, 0.5f, 0, c1, 0, 0, 0.5f, 0.5f, 0, c2, 1, 0, 0, -0.5f, 0, c3, 0.5f, 1});
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
spriteBatch = new SpriteBatch();
frameBuffer = new FrameBuffer(Format.RGB565, 128, 128, false);
stencilFrameBuffer = new FrameBuffer(Format.RGB565, 128, 128, false, true);
createShader(Gdx.graphics);
}
示例7: create
@Override
public void create () {
FileHandle file = Gdx.files.internal("data/bobargb8888-32x32.png");
nonMipMapped[0] = new Texture(file, Format.Alpha, false);
nonMipMapped[1] = new Texture(file, Format.LuminanceAlpha, false);
nonMipMapped[2] = new Texture(file, Format.RGB888, false);
nonMipMapped[3] = new Texture(file, Format.RGB565, false);
nonMipMapped[4] = new Texture(file, Format.RGBA8888, false);
nonMipMapped[5] = new Texture(file, Format.RGBA4444, false);
mipMapped[0] = new Texture(file, Format.Alpha, true);
mipMapped[1] = new Texture(file, Format.LuminanceAlpha, true);
mipMapped[2] = new Texture(file, Format.RGB888, true);
mipMapped[3] = new Texture(file, Format.RGB565, true);
mipMapped[4] = new Texture(file, Format.RGBA8888, true);
mipMapped[5] = new Texture(file, Format.RGBA4444, true);
batch = new SpriteBatch();
}
示例8: create
@Override
public void create () {
font = new BitmapFont();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
controller = new OrthoCamController(camera);
Gdx.input.setInputProcessor(controller);
Pixmap pixmap = new Pixmap(32, 32, Format.RGB565);
pixmap.setColor(1, 0, 0, 1);
pixmap.fill();
pixmap.setColor(0, 1, 0, 1);
pixmap.drawLine(0, 0, 32, 32);
pixmap.drawLine(0, 32, 32, 0);
ETC1Data encodedImage = ETC1.encodeImagePKM(pixmap);
pixmap.dispose();
pixmap = ETC1.decodeImage(encodedImage, Format.RGB565);
encodedImage.dispose();
img1 = new Texture(pixmap);
img2 = new Texture("data/test.etc1");
batch = new SpriteBatch();
pixmap.dispose();
}
示例9: create
@Override
public void create () {
spriteBatch = new SpriteBatch();
texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg"));
Pixmap pixmap = new Pixmap(32, 32, Format.RGB565);
pixmap.setColor(1, 1, 0, 0.7f);
pixmap.fill();
texture2 = new Texture(pixmap);
pixmap.dispose();
for (int i = 0; i < coords.length; i += 2) {
coords[i] = (int)(Math.random() * Gdx.graphics.getWidth());
coords[i + 1] = (int)(Math.random() * Gdx.graphics.getHeight());
coords2[i] = (int)(Math.random() * Gdx.graphics.getWidth());
coords2[i + 1] = (int)(Math.random() * Gdx.graphics.getHeight());
}
}
示例10: PostProcessor
/** Construct a new PostProcessor with the given parameters and the specified texture wrap mode */
public PostProcessor (int fboWidth, int fboHeight, boolean useDepth, boolean fsaa, boolean useAlphaChannel, boolean use32Bits,
TextureWrap u, TextureWrap v) {
if (use32Bits) {
if (useAlphaChannel) {
fbFormat = Format.RGBA8888;
} else {
fbFormat = Format.RGB888;
}
} else {
if (useAlphaChannel) {
fbFormat = Format.RGBA4444;
} else {
fbFormat = Format.RGB565;
}
}
composite = newPingPongBuffer(fboWidth, fboHeight, fbFormat, useDepth, fsaa);
setBufferTextureWrap(u, v);
pipelineState = new PipelineState();
capturing = false;
hasCaptured = false;
enabled = true;
this.useDepth = useDepth;
if (useDepth) {
clearBits |= GL20.GL_DEPTH_BUFFER_BIT;
}
setViewport(null);
}
示例11: PolygonShapeRenderer
public PolygonShapeRenderer (RavCamera camera) {
this.camera = camera;
Pixmap pixmap = new Pixmap(1, 1, Format.RGB565);
pixmap.setColor(Color.WHITE);
pixmap.fill();
texture = new Texture(pixmap);
pixmap.dispose();
}
示例12: SortedRenderer
public SortedRenderer (ShaderManager shaderManager) {
this.shaderManager = shaderManager;
Pixmap pixmap = new Pixmap(1, 1, Format.RGB565);
pixmap.setColor(Color.WHITE);
pixmap.fill();
ambientTexture = new Texture(pixmap);
pixmap.dispose();
}
示例13: PostProcessor
/**
* Construct a new PostProcessor with the given parameters and the specified texture wrap mode
*/
public PostProcessor(int fboWidth, int fboHeight, boolean useDepth, boolean useAlphaChannel, boolean use32Bits,
TextureWrap u, TextureWrap v) {
if (use32Bits) {
if (useAlphaChannel) {
fbFormat = Format.RGBA8888;
} else {
fbFormat = Format.RGB888;
}
} else {
if (useAlphaChannel) {
fbFormat = Format.RGBA4444;
} else {
fbFormat = Format.RGB565;
}
}
composite = newPingPongBuffer(fboWidth, fboHeight, fbFormat, useDepth);
setBufferTextureWrap(u, v);
pipelineState = new PipelineState();
capturing = false;
hasCaptured = false;
enabled = true;
this.useDepth = useDepth;
if (useDepth) {
clearBits |= GL20.GL_DEPTH_BUFFER_BIT;
}
setViewport(null);
}
示例14: generateProjectile
public static Texture generateProjectile(int size) {
pixmap = new Pixmap(size, size/2 == 0 ? 1 : size/2, Format.RGB565);
pixmap.setColor(1,1,1,1);
pixmap.fill();
Texture t = new Texture(pixmap);
pixmap.dispose();
return t;
}
示例15: createShip
@Deprecated
public static Entity createShip(int x, int y) {
Entity entity = new Entity();
TransformComponent transform = new TransformComponent();
TextureComponent texture = new TextureComponent();
transform.pos.set(x, y, -10);
transform.rotation = (float) Math.PI/2; //face upwards
// generate pixmap texture
int size = 16;
Pixmap pixmap = new Pixmap(size, size, Format.RGB565);
pixmap.setColor(1, 1, 1, 1);
pixmap.fillTriangle(0, 0, 0, size-1, size-1, size/2);
pixmap.setColor(0, 1, 1, 1);
pixmap.drawLine(size, size/2, size/2, size/2);
Texture pixmapTex = new Texture(pixmap);
pixmap.dispose(); // clean up
texture.texture = pixmapTex;// give texture component the generated pixmapTexture
texture.scale = SpaceProject.scale;
BoundsComponent bounds = new BoundsComponent();
float width = texture.texture.getWidth() * SpaceProject.scale;
float height = texture.texture.getHeight() * SpaceProject.scale;
bounds.poly = new Polygon(new float[]{0, 0, width, 0, width, height, 0, height});
bounds.poly.setOrigin(width/2, height/2);
entity.add(bounds);
entity.add(texture);
entity.add(transform);
entity.add(new VehicleComponent());
return entity;
}