日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java黑色_java-透明的黑色圆圈

發(fā)布時間:2024/9/19 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java黑色_java-透明的黑色圆圈 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

您可以根據(jù)需要使用FrameBuffer.

public class GdxTest extends ApplicationAdapter implements InputProcessor {

FrameBuffer frameBuffer;

SpriteBatch spriteBatch;

OrthographicCamera camera;

Vector3 vector3;

Texture texture,texture1;

Sprite sprite;

@Override

public void create() {

vector3=new Vector3();

camera=new OrthographicCamera();

camera.setToOrtho(false,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());

spriteBatch=new SpriteBatch();

texture=new Texture("light.png");

sprite=new Sprite(texture);

sprite.setSize(150,150);

texture1=new Texture("badlogic.jpg");

Gdx.input.setInputProcessor(this);

}

@Override

public void render() {

frameBuffer.begin();

Gdx.gl.glClearColor(.2f,.2f,.2f,1);

Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

spriteBatch.setProjectionMatrix(camera.combined);

spriteBatch.setBlendFunction(GL20.GL_ONE,GL20.GL_ONE);

spriteBatch.begin();

sprite.draw(spriteBatch);

spriteBatch.end();

frameBuffer.end();

spriteBatch.setBlendFunction(GL20.GL_SRC_ALPHA,GL20.GL_ONE_MINUS_SRC_ALPHA);

spriteBatch.begin();

spriteBatch.draw(texture1,100,100);

spriteBatch.end();

spriteBatch.setProjectionMatrix(spriteBatch.getProjectionMatrix().idt());

spriteBatch.setBlendFunction( GL20.GL_ZERO,GL20.GL_SRC_COLOR);

spriteBatch.begin();

spriteBatch.draw(frameBuffer.getColorBufferTexture(),-1,1,2,-2);

spriteBatch.end();

}

@Override

public void resize(int width, int height) {

if(frameBuffer !=null && (frameBuffer.getWidth()!=width || frameBuffer.getHeight()!=height )) {

frameBuffer.dispose();

frameBuffer=null;

}

if(frameBuffer==null){

try {

frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false);

}catch (GdxRuntimeException e){

frameBuffer=new FrameBuffer(Pixmap.Format.RGB565,width,height,false);

}

}

}

@Override

public boolean keyDown(int keycode) {

return false;

}

@Override

public boolean keyUp(int keycode) {

return false;

}

@Override

public boolean keyTyped(char character) {

return false;

}

@Override

public boolean touchDown(int screenX, int screenY, int pointer, int button) {

return false;

}

@Override

public boolean touchUp(int screenX, int screenY, int pointer, int button) {

return false;

}

@Override

public boolean touchDragged(int screenX, int screenY, int pointer) {

vector3.set(screenX,screenY,0);

camera.unproject(vector3);

sprite.setPosition(vector3.x-sprite.getWidth()/2,vector3.y-sprite.getHeight()/2);

return false;

}

@Override

public boolean mouseMoved(int screenX, int screenY) {

return false;

}

@Override

public boolean scrolled(int amount) {

return false;

}

}

這是light.png

和我的預(yù)期輸出:

總結(jié)

以上是生活随笔為你收集整理的java黑色_java-透明的黑色圆圈的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。