本文整理匯總了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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}