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


Java Batch.getColor方法代碼示例

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


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

示例1: draw

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void draw(Batch batch, float parentAlpha) {
    //Reset spritebatch after alpha action
    Color color = batch.getColor();
    super.draw(batch, parentAlpha);
    batch.setColor(color);
}
 
開發者ID:justinmarentette11,項目名稱:Tower-Defense-Galaxy,代碼行數:8,代碼來源:PauseWindow.java

示例2: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(Batch batch) {
    Color originalColor = batch.getColor();
    batch.setColor(color);

    batch.draw(shape.getTexture(), getPosition().x, getPosition().y, getSize().width, getSize().height);

    batch.setColor(originalColor);
}
 
開發者ID:DurianHLN,項目名稱:Polymorph,代碼行數:10,代碼來源:Mob.java

示例3: draw

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void draw(Batch batch, float parentAlpha) {
	if (map != null) {
		Color prev = batch.getColor();
		batch.setColor(getColor());
		batch.draw(map, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(),
				getScaleY(), getRotation());
		batch.setColor(prev);
	}
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:11,代碼來源:TransitionManager.java

示例4: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(Batch batch, float deltaTime)
{
    if (body == null) return;

    Color oldColor = batch.getColor();

    batch.setColor(1f, (health + 5)/10f, (health + 5)/10f, 1f);

    Vector2 pos = body.getPosition();
    pos.scl(Physics.PPM);

    TextureRegion region = MathUtils.isZero(hitTimer) ? dummy : dummy_hit;

    batch.draw(region,                                    // TextureRegion (front, back, side)
            pos.x - dummy.getRegionWidth() / 2,           // Offset to the X position (character center)
            pos.y,                                        // Y position is at the foots
            dummy.getRegionWidth() / 2,                   // Origin X (important for flipping)
            dummy.getRegionHeight(),                      // Origin Y
            dummy.getRegionWidth(),                       // Width
            dummy.getRegionHeight(),                      // Height
            1f,                                           // Scale X (-1 to flip)
            1f,                                           // Scale Y
            0f);                                          // Rotation

    batch.setColor(oldColor);
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:28,代碼來源:TutorialDummy.java

示例5: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(Batch batch, float deltaTime)
{
    if (body == null) return;

    animationTime += deltaTime;

    Color oldColor = batch.getColor();

    batch.setColor(1f, (health + 4)/8f, (health + 4)/8f, 1f);

    Vector2 pos = body.getPosition();
    pos.scl(Physics.PPM);

    TextureRegion region = crabAnimation.getKeyFrame(animationTime);

    batch.draw(region,                                    // TextureRegion (front, back, side)
            pos.x - region.getRegionWidth() / 2,           // Offset to the X position (character center)
            pos.y,                                        // Y position is at the foots
            region.getRegionWidth() / 2,                   // Origin X (important for flipping)
            region.getRegionHeight(),                      // Origin Y
            region.getRegionWidth(),                       // Width
            region.getRegionHeight(),                      // Height
            1f,                                           // Scale X (-1 to flip)
            1f,                                           // Scale Y
            0f);                                          // Rotation

    batch.setColor(oldColor);
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:30,代碼來源:Crab.java

示例6: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(Batch batch, float deltaTime)
{
    if (body == null) return;

    Color oldColor = batch.getColor();

    batch.setColor(1f, (health + 5)/10f, (health + 5)/10f, 1f);

    Vector2 pos = body.getPosition();
    pos.scl(Physics.PPM);

    float scaleX = 1f;

    animationTime += deltaTime;


    batch.draw(rabbit,                                      // TextureRegion (front, back, side)
            pos.x - rabbit.getRegionWidth() / 2,           // Offset to the X position (character center)
            pos.y,                                          // Y position is at the foots
            rabbit.getRegionWidth() / 2,                   // Origin X (important for flipping)
            rabbit.getRegionHeight(),                      // Origin Y
            rabbit.getRegionWidth(),                       // Width
            rabbit.getRegionHeight(),                      // Height
            scaleX,                                         // Scale X (-1 to flip)
            1f,                                             // Scale Y
            0f);                                            // Rotation

    batch.setColor(oldColor);
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:31,代碼來源:Rabbit.java

示例7: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(Batch batch, float deltaTime)
{
    if (body == null) return;

    Color oldColor = batch.getColor();

    batch.setColor(1f, (health + 30)/60f, (health + 30)/60f, 1f);

    Vector2 pos = body.getPosition();
    pos.scl(Physics.PPM);

    TextureRegion region = null;
    float scaleX = 1f;

    animationTime += deltaTime;

    switch (orientation)
    {
        case LOOK_FORWARD:
            region = npcFrontWalk.getKeyFrame(animationTime);
            break;
        case LOOK_LEFT:
            region = npcSideWalk.getKeyFrame(animationTime);
            break;
        case LOOK_BACKWARD:
            region = npcBackWalk.getKeyFrame(animationTime);
            scaleX = -1f;
            break;
        case LOOK_RIGHT:
            region = npcSideWalk.getKeyFrame(animationTime);
            scaleX = -1f;
            break;
    }

    batch.draw(region,                                      // TextureRegion (front, back, side)
            pos.x - region.getRegionWidth() / 2,           // Offset to the X position (character center)
            pos.y,                                          // Y position is at the foots
            region.getRegionWidth() / 2,                   // Origin X (important for flipping)
            region.getRegionHeight(),                      // Origin Y
            region.getRegionWidth(),                       // Width
            region.getRegionHeight(),                      // Height
            scaleX,                                         // Scale X (-1 to flip)
            1f,                                             // Scale Y
            0f);                                            // Rotation

    batch.setColor(oldColor);
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:49,代碼來源:Dragon.java

示例8: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(Batch batch, float deltaTime)
{
    if (body == null) return;

    Color oldColor = batch.getColor();

    batch.setColor(1f, (health + 30)/60f, (health + 30)/60f, 1f);

    Vector2 pos = body.getPosition();
    pos.scl(Physics.PPM);

    TextureRegion region = null;
    float scaleX = 1f;

    animationTime += deltaTime;

    switch (orientation)
    {
        case LOOK_FORWARD:
            region = npcFrontWalk.getKeyFrame(animationTime);
            break;
        case LOOK_LEFT:
            region = npcSideWalk.getKeyFrame(animationTime);
            scaleX = -1f;
            break;
        case LOOK_BACKWARD:
            region = npcBackWalk.getKeyFrame(animationTime);
            scaleX = -1f;
            break;
        case LOOK_RIGHT:
            region = npcSideWalk.getKeyFrame(animationTime);
            break;
    }

    batch.draw(region,                                      // TextureRegion (front, back, side)
            pos.x - region.getRegionWidth() / 2,           // Offset to the X position (character center)
            pos.y,                                          // Y position is at the foots
            region.getRegionWidth() / 2,                   // Origin X (important for flipping)
            region.getRegionHeight(),                      // Origin Y
            region.getRegionWidth(),                       // Width
            region.getRegionHeight(),                      // Height
            scaleX,                                         // Scale X (-1 to flip)
            1f,                                             // Scale Y
            0f);                                            // Rotation

    batch.setColor(oldColor);
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:49,代碼來源:Warrior.java

示例9: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(Batch batch, float deltaTime)
{
    if (body == null) return;

    Color oldColor = batch.getColor();

    batch.setColor(1f, (health + 2)/4f, (health + 2)/4f, 1f);

    Vector2 pos = body.getPosition();
    pos.scl(Physics.PPM);

    TextureRegion region = null;
    float scaleX = 1f;

    animationTime += deltaTime;

    switch (orientation)
    {
        case LOOK_FORWARD:
            region = npcFrontWalk.getKeyFrame(animationTime);
            break;
        case LOOK_LEFT:
            region = npcSideWalk.getKeyFrame(animationTime);
            break;
        case LOOK_BACKWARD:
            region = npcBackWalk.getKeyFrame(animationTime);
            scaleX = -1f;
            break;
        case LOOK_RIGHT:
            region = npcSideWalk.getKeyFrame(animationTime);
            scaleX = -1f;
            break;
    }

    batch.draw(region,                                      // TextureRegion (front, back, side)
            pos.x - region.getRegionWidth() / 2,           // Offset to the X position (character center)
            pos.y,                                          // Y position is at the foots
            region.getRegionWidth() / 2,                   // Origin X (important for flipping)
            region.getRegionHeight(),                      // Origin Y
            region.getRegionWidth(),                       // Width
            region.getRegionHeight(),                      // Height
            scaleX,                                         // Scale X (-1 to flip)
            1f,                                             // Scale Y
            0f);                                            // Rotation

    batch.setColor(oldColor);
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:49,代碼來源:Skeleton.java

示例10: render

import com.badlogic.gdx.graphics.g2d.Batch; //導入方法依賴的package包/類
@Override
public void render(Batch batch, float deltaTime)
{
    if (body == null) return;

    Color oldColor = batch.getColor();

    batch.setColor(1f, (health + 5)/10f, (health + 5)/10f, 1f);

    Vector2 pos = body.getPosition();
    pos.scl(Physics.PPM);

    TextureRegion region = null;
    float scaleX = 1f;

    animationTime += deltaTime;

    switch (orientation)
    {
        case LOOK_FORWARD:
            region = npcFrontWalk.getKeyFrame(animationTime);
            break;
        case LOOK_LEFT:
            region = npcSideWalk.getKeyFrame(animationTime);
            break;
        case LOOK_BACKWARD:
            region = npcBackWalk.getKeyFrame(animationTime);
            scaleX = -1f;
            break;
        case LOOK_RIGHT:
            region = npcSideWalk.getKeyFrame(animationTime);
            scaleX = -1f;
            break;
    }

    batch.draw(region,                                      // TextureRegion (front, back, side)
            pos.x - region.getRegionWidth() / 2,           // Offset to the X position (character center)
            pos.y,                                          // Y position is at the foots
            region.getRegionWidth() / 2,                   // Origin X (important for flipping)
            region.getRegionHeight(),                      // Origin Y
            region.getRegionWidth(),                       // Width
            region.getRegionHeight(),                      // Height
            scaleX,                                         // Scale X (-1 to flip)
            1f,                                             // Scale Y
            0f);                                            // Rotation

    batch.setColor(oldColor);
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:49,代碼來源:Wolf.java


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