當前位置: 首頁>>代碼示例>>Java>>正文


Java ShapeRenderer.setColor方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.glutils.ShapeRenderer.setColor方法的典型用法代碼示例。如果您正苦於以下問題:Java ShapeRenderer.setColor方法的具體用法?Java ShapeRenderer.setColor怎麽用?Java ShapeRenderer.setColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.glutils.ShapeRenderer的用法示例。


在下文中一共展示了ShapeRenderer.setColor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: draw

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
public void draw(ShapeRenderer renderer) {
    if (rect.width < 25 * cam.zoom || rect.height < 25 * cam.zoom) return;

    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    renderer.setProjectionMatrix(cam.combined);
    renderer.begin(ShapeRenderer.ShapeType.Filled);
    renderer.setColor(new Color(0x228b2255));
    renderer.rect(rect.x, rect.y, rect.width, rect.height);

    renderer.set(ShapeRenderer.ShapeType.Line);
    renderer.setColor(Color.BLACK);
    renderer.rect(rect.x, rect.y, rect.width, rect.height);
    renderer.end();
}
 
開發者ID:conquest,項目名稱:conquest,代碼行數:17,代碼來源:Grabber.java

示例2: drawLayer1

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void drawLayer1(GameTime time, ShapeRenderer shapeRenderer) {
    // draw background
    shapeRenderer.setColor(this.backgroundColor);
    shapeRenderer.rect(getX(), getY(), getWidth(), getHeight());

    float maxWidth = getWidth() - (paddingLeft + paddingRight);
    float maxHeight = getHeight() - (paddingTop + paddingBottom);

    float barWidth = maxWidth * percent;
    float barHeight = maxHeight;

    // draw foreground
    shapeRenderer.setColor(this.foregroundColor);
    shapeRenderer.rect(getX() + paddingBottom, getY() + paddingLeft, barWidth, barHeight);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:17,代碼來源:FilledBar.java

示例3: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void render(SpriteBatch sb, ShapeRenderer sr) {
    sb.setProjectionMatrix(camera.combined);
    sr.setAutoShapeType(true);
    sr.setProjectionMatrix(camera.combined);

    //BACKGROUND
    sr.begin();
    sr.set(ShapeRenderer.ShapeType.Filled);
    sr.setColor(Color.WHITE);
    sr.rect(0, 0, Game.WIDTH, Game.HEIGHT);
    sr.end();

    //LOGO
    sb.begin();
    sb.draw(logo, Game.WIDTH / 2 - logo.getWidth() * 20 / 2, Game.HEIGHT / 2 - logo.getHeight() * 20 / 2, logo.getWidth() * 20, logo.getHeight() * 20);
    sb.end();
}
 
開發者ID:MrGussio,項目名稱:EarthInvadersGDX,代碼行數:19,代碼來源:SplashScreen.java

示例4: draw

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
/**
 * Draws the Shape in the screen, using the given renderer.
 *
 * @param renderer The Shape renderer.
 */
public void draw(ShapeRenderer renderer) {
    if (rect == null) return;

    renderer.setColor(color);
    renderer.rect(center.x - rect.getWidth() / 2, center.y - rect.getHeight() / 2,
            rect.getWidth() / 2, rect.getHeight() / 2, rect.getWidth(), rect.getHeight(), 1, 1, rotation);
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:13,代碼來源:ShapeView.java

示例5: RenderSystem

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
public RenderSystem(Batch batch) {
    super(FAMILY);
    this.camera = new OrthographicCamera();
    viewport = new FitViewport(Asteroids.VIRTUAL_WIDTH, Asteroids.VIRTUAL_HEIGHT, camera);
    viewport.apply(true);
    this.batch = batch;
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setColor(Color.RED);
    font = ServiceLocator.getAppComponent().getAssetService().getSkin(AssetService.SkinAsset.UISKIN).getFont("default-font");
}
 
開發者ID:ezet,項目名稱:penguins-in-space,代碼行數:11,代碼來源:RenderSystem.java

示例6: draw

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
public void draw(ShapeRenderer renderer) {
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    renderer.setProjectionMatrix(stage.getCamera().combined);
    renderer.setColor(background);

    renderer.begin(ShapeRenderer.ShapeType.Filled);
    renderer.rect((Gdx.graphics.getWidth() - 125) / 2, 10, 125, 30);
    renderer.end();
    Gdx.gl.glDisable(GL20.GL_BLEND);

    stage.act();
    stage.draw();
}
 
開發者ID:conquest,項目名稱:conquest,代碼行數:16,代碼來源:Hud.java

示例7: drawShape

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void drawShape(GameTime time, CameraWrapper camera, ShapeRenderer shapeRenderer, Color color) {
    shapeRenderer.setColor(color);
    shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
    shapeRenderer.rect(this.x, this.y, x + (width / 2), y + (height / 2), this.width, this.height, 1f, 1f,
            this.angle);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:8,代碼來源:CRotatedRectangle.java

示例8: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void render(float delta, ModelBatch modelBatch, ShapeRenderer shapeRenderer, Environment environment) {
    super.render(delta, modelBatch, shapeRenderer, environment);
    if(laserTime > 0) {
        laserTime -= delta;
        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.setColor(1, 0, 0, 1);
        shapeRenderer.line(transform.getTranslation(tempVector), laserTo);
        shapeRenderer.end();
    }
}
 
開發者ID:justinmarentette11,項目名稱:Tower-Defense-Galaxy,代碼行數:12,代碼來源:Laser.java

示例9: drawDebug

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void drawDebug(ShapeRenderer shapes) {
	if (getDebug()) {
		shapes.setColor(debug_bounds);
		Rectangle b = bounds;
		shapes.rect(b.x + getX(), b.y + getY(), b.width, b.height);
	}
	super.drawDebug(shapes);
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:10,代碼來源:GameObject.java

示例10: GamepadButton

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
GamepadButton(Drawable touchButton) {
    this.touchButton = touchButton;
    setTouchable(Touchable.enabled);
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setColor(1, 0, 0, 0.3f);
}
 
開發者ID:ezet,項目名稱:penguins-in-space,代碼行數:7,代碼來源:GamepadButton.java

示例11: drawShape

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void drawShape(GameTime time, CameraWrapper camera, ShapeRenderer shapeRenderer, Color color) {
    shapeRenderer.setColor(color);
    shapeRenderer.set(ShapeRenderer.ShapeType.Line);
    shapeRenderer.circle(getCenterX(), getCenterY(), 3);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:7,代碼來源:CPoint.java

示例12: drawShape

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void drawShape(GameTime time, CameraWrapper camera, ShapeRenderer shapeRenderer, Color color) {
    shapeRenderer.setColor(color);
    shapeRenderer.set(ShapeRenderer.ShapeType.Line);
    shapeRenderer.circle(getCenterX(), getCenterY(), this.radius);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:7,代碼來源:CCircle.java

示例13: drawShape

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void drawShape(GameTime time, CameraWrapper camera, ShapeRenderer shapeRenderer, Color color) {
    shapeRenderer.setColor(color);
    shapeRenderer.set(ShapeRenderer.ShapeType.Line);
    shapeRenderer.rect(this.getX(), this.getY(), this.width, this.height);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:7,代碼來源:CRectangle.java

示例14: renderSR

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void renderSR(ShapeRenderer sr) {
    sr.set(ShapeRenderer.ShapeType.Filled);
    sr.setColor(Color.RED);
    sr.rect(x, y, 5, 5);
}
 
開發者ID:MrGussio,項目名稱:EarthInvadersGDX,代碼行數:7,代碼來源:Bullet.java

示例15: renderSR

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void renderSR(ShapeRenderer sr) {
    sr.setColor(color);
    sr.set(ShapeRenderer.ShapeType.Filled);
    sr.rect(x, y, size, size);
}
 
開發者ID:MrGussio,項目名稱:EarthInvadersGDX,代碼行數:7,代碼來源:Particle.java


注:本文中的com.badlogic.gdx.graphics.glutils.ShapeRenderer.setColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。