本文整理汇总了Java中org.andengine.util.adt.color.Color类的典型用法代码示例。如果您正苦于以下问题:Java Color类的具体用法?Java Color怎么用?Java Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Color类属于org.andengine.util.adt.color包,在下文中一共展示了Color类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SplashScene
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
public SplashScene(TextureManager textureManager, AssetManager assetManager, VertexBufferObjectManager vbo, Camera camera) {
super();
this.setBackground(new Background(new Color(100, 100, 100)));
try {
splashTexture = new AssetBitmapTexture(textureManager, assetManager, "textures/splash.png", TextureOptions.BILINEAR);
splashTextureRegion = TextureRegionFactory.extractFromTexture(splashTexture);
splashTexture.load();
splash = new Sprite(0, 0, splashTextureRegion, vbo);
final float scale_factor = GameActivity.CAMERA_HEIGHT / splashTextureRegion.getHeight();
splash.setScale(scale_factor+0.1f);
splash.setPosition((camera.getWidth()) * 0.5f, (camera.getHeight()) * 0.5f);
this.attachChild(splash);
} catch (final IOException e) {
System.err.println("Error loading splash!");
e.printStackTrace(System.err);
}
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:19,代码来源:SplashScene.java
示例2: show_sorry
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
private void show_sorry() {
Dialog sorry_dialog = new Dialog(400, 150, Dialog.Buttons.OK, PhoeniciaContext.vboManager, new Dialog.DialogListener() {
@Override
public void onDialogButtonClicked(Dialog dialog, Dialog.DialogButton dialogButton) {
dialog.close();
unregisterTouchArea(dialog);
finish();
}
});
String counts = String.format("%1$d/%2$d", this.winnings.size(), this.max_rounds);
Text sorry_text = new Text(sorry_dialog.getWidth()/2, sorry_dialog.getHeight()-48, GameFonts.dialogText(), counts, counts.length(), new TextOptions(AutoWrap.WORDS, sorry_dialog.getWidth()*0.8f, HorizontalAlign.CENTER), PhoeniciaContext.vboManager);
sorry_text.setColor(Color.RED);
sorry_dialog.attachChild(sorry_text);
this.registerTouchArea(sorry_dialog);
sorry_dialog.open(this);
GameSounds.play(GameSounds.FAILED);
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:20,代码来源:ImageMatchGameHUD.java
示例3: Scrollable
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* New Scrollable with with the desired width and height.
* The width and height must be specified because a Scrollable will be smaller than the size
* needed for all of it's children
* @param x the X coordinate of the scene to place this Scrollable
* @param y the Y coordinate of the scene to place this Scrollable
* @param w the width for this Scrollable
* @param h the height for this Scrollable
* @param scroll_lock what directions can be scrolled (default Scrollable.SCROLL_BOTH)
*/
public Scrollable(float x, float y, float w, float h, int scroll_lock) {
super(x, y, w, h);
this.scroll_lock = scroll_lock;
this.scrollDetector = new SurfaceScrollDetector(this);
this.contents = new Entity(w/2, h/2, 0, 0);
this.childRect.set(0, 0, 0, 0);
this.touchAreas = new ArrayList<ITouchArea>();
super.attachChild(this.contents);
this.scrollbar_color = new Color(0.0f, 0.0f, 0.0f, 0.25f);
this.vertical_scrollbar = new Rectangle(this.getWidth()-(this.scrollbar_size /2)-2, this.getHeight()/2, scrollbar_size, this.getHeight(), PhoeniciaContext.vboManager);
this.vertical_scrollbar.setColor(this.scrollbar_color);
if (this.scroll_lock == SCROLL_HORIZONTAL) this.vertical_scrollbar.setVisible(false);
this.scroll_y = 0;
super.attachChild(this.vertical_scrollbar);
this.horizontal_scrollbar = new Rectangle(this.getWidth()/2, (scrollbar_size/2)+2, this.getWidth(), scrollbar_size, PhoeniciaContext.vboManager);
this.horizontal_scrollbar.setColor(this.scrollbar_color);
if (this.scroll_lock == SCROLL_VERTICAL) this.horizontal_scrollbar.setVisible(false);
this.scroll_x = 0;
super.attachChild(this.horizontal_scrollbar);
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:36,代码来源:Scrollable.java
示例4: fixtureToColor
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* Translates b2d Fixture to appropriate color, depending on body state/type
* Modify to suit your needs
* @param fixture
* @return
*/
private static Color fixtureToColor(Fixture fixture) {
if (fixture.isSensor()) {
return Color.PINK;
} else {
Body body = fixture.getBody();
if (!body.isActive()) {
return Color.BLACK;
} else {
if (!body.isAwake()) {
return Color.RED;
} else {
switch (body.getType()) {
case StaticBody:
return Color.CYAN;
case KinematicBody:
return Color.WHITE;
case DynamicBody:
default:
return Color.GREEN;
}
}
}
}
}
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:31,代码来源:DebugRenderer.java
示例5: Font
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
public Font(final FontManager pFontManager, final ITexture pTexture, final Typeface pTypeface, final float pSize, final boolean pAntiAlias, final int pColorARGBPackedInt) {
this.mFontManager = pFontManager;
this.mTexture = pTexture;
this.mTextureWidth = pTexture.getWidth();
this.mTextureHeight = pTexture.getHeight();
this.mBackgroundPaint = new Paint();
this.mBackgroundPaint.setColor(Color.TRANSPARENT_ARGB_PACKED_INT);
this.mBackgroundPaint.setStyle(Style.FILL);
this.mPaint = new Paint();
this.mPaint.setTypeface(pTypeface);
this.mPaint.setColor(pColorARGBPackedInt);
this.mPaint.setTextSize(pSize);
this.mPaint.setAntiAlias(pAntiAlias);
this.mFontMetrics = this.mPaint.getFontMetrics();
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:19,代码来源:Font.java
示例6: jointToColor
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* Translates b2d Joint to appropriate color, depending on state/type
* Modify to suit your needs
* @param joint
* @return
*/
private static Color jointToColor(Joint joint) {
switch (joint.getType()) {
case RevoluteJoint:
case PrismaticJoint:
case DistanceJoint:
case PulleyJoint:
case MouseJoint:
case GearJoint:
case WeldJoint:
case FrictionJoint:
return Color.WHITE;
case Unknown:
default:
return Color.WHITE;
}
}
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:25,代码来源:DebugRenderer.java
示例7: ImageMatchGameHUD
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
public ImageMatchGameHUD(final PhoeniciaGame phoeniciaGame, final Level level, final GameTile tile) {
super(phoeniciaGame, level, tile);
this.setBackgroundEnabled(false);
this.level = level;
this.tile = tile;
this.current_round = 0;
this.random_word_list = new ArrayList<Word>(level.words);
Collections.shuffle(this.random_word_list);
Debug.d("ImageMatchGame level: " + level.name);
Debug.d("ImageMatchGame words: " + level.words.size());
if (this.random_word_list.size() < this.max_rounds) {
this.max_rounds = this.random_word_list.size();
}
Debug.d("ImageMatchGame rounds: "+this.max_rounds);
if (this.random_word_list.size() < this.max_choices) {
this.max_choices = this.random_word_list.size();
}
this.touchAreas = new ArrayList<Entity>();
choiceWordFont = FontFactory.create(PhoeniciaContext.fontManager, PhoeniciaContext.textureManager, 256, 256, TextureOptions.BILINEAR, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 36, Color.BLUE_ARGB_PACKED_INT);
choiceWordFont.load();
this.cardPane = new Entity(WINDOW_WIDTH/2, 400, WINDOW_WIDTH, 400);
this.content.attachChild(cardPane);
this.resultsPane = new Entity(WINDOW_WIDTH/2, 100, WINDOW_WIDTH, 200);
this.content.attachChild(this.resultsPane);
this.winnings = new ArrayList<Word>();
this.result_number = 0;
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:34,代码来源:ImageMatchGameHUD.java
示例8: show_reward
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
private void show_reward() {
Collections.shuffle(this.winnings);
final Word reward_word = this.winnings.get(0);
final int reward_coins = Math.round(reward_word.sell * this.tile.game.reward);
final int reward_points = Math.round(reward_word.points * this.tile.game.reward);
final Dialog reward_dialog = new Dialog(400, 300, Dialog.Buttons.OK, PhoeniciaContext.vboManager, new Dialog.DialogListener() {
@Override
public void onDialogButtonClicked(Dialog dialog, Dialog.DialogButton dialogButton) {
finish();
Inventory.getInstance().add(reward_word.name, 1, false);
Bank.getInstance().credit(reward_coins);
game.session.addExperience(reward_points);
GameSounds.play(GameSounds.COLLECT);
dialog.close();
unregisterTouchArea(dialog);
}
});
String counts = String.format("%1$d/%2$d", this.winnings.size(), this.max_rounds);
Text reward_text = new Text(reward_dialog.getWidth()/2, reward_dialog.getHeight()-24, GameFonts.dialogText(), counts, counts.length(), new TextOptions(AutoWrap.WORDS, reward_dialog.getWidth()*0.8f, HorizontalAlign.CENTER), PhoeniciaContext.vboManager);
reward_text.setColor(Color.GREEN);
reward_dialog.attachChild(reward_text);
ITiledTextureRegion sprite_region = this.game.wordSprites.get(reward_word);
Sprite reward_sprite = new Sprite(reward_dialog.getWidth()/2, reward_dialog.getHeight() - 100, sprite_region.getTextureRegion(1), PhoeniciaContext.vboManager);
reward_dialog.attachChild(reward_sprite);
ITextureRegion coinRegion = GameUI.getInstance().getCoinsIcon();
Sprite coinIcon = new Sprite(reward_dialog.getWidth()/2 - 32, 112, coinRegion, PhoeniciaContext.vboManager);
coinIcon.setScale(0.5f);
reward_dialog.attachChild(coinIcon);
Text iconDisplay = new Text(reward_dialog.getWidth()/2 + 32, 112, GameFonts.dialogText(), String.valueOf(reward_coins), 10, new TextOptions(HorizontalAlign.LEFT), PhoeniciaContext.vboManager);
reward_dialog.attachChild(iconDisplay);
this.registerTouchArea(reward_dialog);
reward_dialog.open(this);
GameSounds.play(GameSounds.COMPLETE);
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:41,代码来源:ImageMatchGameHUD.java
示例9: WordMatchGameHUD
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
public WordMatchGameHUD(final PhoeniciaGame phoeniciaGame, final Level level, final GameTile tile) {
super(phoeniciaGame, level, tile);
this.level = level;
this.tile = tile;
this.current_round = 0;
this.random_word_list = new ArrayList<Word>(level.words);
Collections.shuffle(this.random_word_list);
if (this.random_word_list.size() < this.max_rounds) {
this.max_rounds = this.random_word_list.size();
}
Debug.d("WordMatchGame rounds: "+this.max_rounds);
if (this.random_word_list.size() < this.max_choices) {
this.max_choices = this.random_word_list.size();
}
this.touchAreas = new ArrayList<Entity>();
choiceWordFont = FontFactory.create(PhoeniciaContext.fontManager, PhoeniciaContext.textureManager, 256, 256, TextureOptions.BILINEAR, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 36, Color.BLUE_ARGB_PACKED_INT);
choiceWordFont.load();
// final float dialogWidth = 800;
// final float dialogHeight = 600;
// Rectangle whiteRect = new BorderRectangle(GameActivity.CAMERA_WIDTH / 2, GameActivity.CAMERA_HEIGHT / 2, dialogWidth, dialogHeight, PhoeniciaContext.vboManager);
// whiteRect.setColor(Color.WHITE);
// this.attachChild(whiteRect);
this.cardPane = new Entity(WINDOW_WIDTH/2, 400, WINDOW_WIDTH, 400);
this.content.attachChild(cardPane);
this.resultsPane = new Entity(WINDOW_WIDTH/2, 100, WINDOW_WIDTH, 200);
this.content.attachChild(this.resultsPane);
this.winnings = new ArrayList<Word>();
this.result_number = 0;
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:37,代码来源:WordMatchGameHUD.java
示例10: LoadingScene
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
public LoadingScene(PhoeniciaGame game) {
super();
this.game = game;
this.setBackground(new Background(new Color(100, 100, 100)));
try {
AssetBitmapTexture splashTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, "textures/loading.png", TextureOptions.BILINEAR);
splashTextureRegion = TextureRegionFactory.extractFromTexture(splashTexture);
splashTexture.load();
splash = new Sprite(0, 0, splashTextureRegion, PhoeniciaContext.vboManager);
final float scale_factor = (GameActivity.CAMERA_HEIGHT / splashTextureRegion.getHeight()) + 0.1f;
splash.setScale(scale_factor);
splash.setPosition((GameActivity.CAMERA_WIDTH) * 0.5f, (GameActivity.CAMERA_HEIGHT) * 0.5f);
this.attachChild(splash);
AssetBitmapTexture progressbarTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, "textures/progressbar.png", TextureOptions.BILINEAR);
progressbarTexture.load();
progressbarTextureRegion = TextureRegionFactory.extractFromTexture(progressbarTexture);
progress = new ProgressBar((GameActivity.CAMERA_WIDTH + 5) * 0.5f, (125 * scale_factor), progressbarTextureRegion, PhoeniciaContext.vboManager);
progress.setScale(scale_factor);
this.attachChild(progress);
} catch (final IOException e) {
System.err.println("Error loading splash!");
e.printStackTrace(System.err);
}
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:28,代码来源:LoadingScene.java
示例11: dialogText
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* Font used for displaying text in a Button
* @return
*/
public static Font dialogText() {
if (dialogFont == null) {
BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
dialogFont = FontFactory.create(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 32, true, new Color(0.5f, 0.5f, 0.5f).getABGRPackedInt());
dialogFont.load();
}
return dialogFont;
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:GameFonts.java
示例12: itemCost
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* Font used for displaying the cost of an InventoryItem.
* @return
*/
public static Font itemCost() {
if (itemCostFont == null) {
BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
itemCostFont = FontFactory.createStroke(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 24, true, new Color(0.96f, 0.70f, 0f).getARGBPackedInt(), 0.5f, new Color(0.95f, 0.61f, 0f).getARGBPackedInt());
itemCostFont.load();
}
return itemCostFont;
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:GameFonts.java
示例13: inventoryCount
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* Font used for displaying the quantity of an InventoryItem.
* @return
*/
public static Font inventoryCount() {
if (inventoryCountFont == null) {
BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
inventoryCountFont = FontFactory.create(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 24, true, new Color(0.5f, 0.5f, 0.5f).getABGRPackedInt());
inventoryCountFont.load();
}
return inventoryCountFont;
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:GameFonts.java
示例14: defaultHUDDisplay
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* Font used for displaying the level and account balance in the DefaultHUD.
* @return
*/
public static Font defaultHUDDisplay() {
if (defaultHUDDisplayFont == null) {
BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
defaultHUDDisplayFont = FontFactory.create(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 30, true, Color.WHITE_ARGB_PACKED_INT);
defaultHUDDisplayFont.load();
}
return defaultHUDDisplayFont;
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:GameFonts.java
示例15: introText
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
public static Font introText() {
if (introTextFont == null) {
BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
introTextFont = FontFactory.create(PhoeniciaContext.fontManager, PhoeniciaContext.textureManager, 256, 256, TextureOptions.BILINEAR, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 36, Color.BLUE_ARGB_PACKED_INT);
introTextFont.load();
}
return introTextFont;
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:9,代码来源:GameFonts.java
示例16: buttonText
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* Font used for displaying text in a Button
* @return
*/
public static Font buttonText() {
if (buttonFont == null) {
Color borderColor = new Color(20/255f, 91/255f, 164/255f);
BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
buttonFont = FontFactory.createStroke(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 32, true, Color.WHITE_ARGB_PACKED_INT, 0.75f, borderColor.getARGBPackedInt());
buttonFont.load();
}
return buttonFont;
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:14,代码来源:GameFonts.java
示例17: progressText
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
public static Font progressText() {
if (progressFont == null) {
BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
progressFont = FontFactory.createStroke(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 24, true, Color.WHITE_ARGB_PACKED_INT, 0.5f, Color.BLUE_ARGB_PACKED_INT);
progressFont.load();
}
return progressFont;
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:9,代码来源:GameFonts.java
示例18: setCount
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* Update the inventory count text for this LetterSprite
* @param count new inventory count value
*/
public void setCount(int count) {
this.count = count;
if (this.needed > 0) {
this.count_text.setText(String.format("%1$d/%2$d", count, needed));
} else {
this.count_text.setText(String.valueOf(count));
}
this.count_text.setPosition((this.getWidth()/2), this.count_text.getY());
if (count < needed) {
this.count_text.setColor(Color.RED);
} else {
this.count_text.setColor(Color.WHITE);
}
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:19,代码来源:WordSprite.java
示例19: Button
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
public Button(float x, float y, float w, float h, String text, Color color, VertexBufferObjectManager pVertexBufferObjectManager, OnClickListener pOnClickListener) {
super(x, y, w, h);
this.clickDetector = new ClickDetector(this);
this.clickListener = pOnClickListener;
this.background = new Rectangle(this.getWidth()/2, this.getHeight()/2, w, h, pVertexBufferObjectManager);
this.background.setColor(color);
this.attachChild(this.background);
final Font buttonFont = GameFonts.buttonText();
this.buttonText = new Text(this.getWidth()/2, this.getHeight()/2, buttonFont, text, text.length(), new TextOptions(HorizontalAlign.CENTER), pVertexBufferObjectManager);
this.attachChild(this.buttonText);
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:14,代码来源:Button.java
示例20: setCount
import org.andengine.util.adt.color.Color; //导入依赖的package包/类
/**
* Update the inventory count text for this LetterSprite
* @param count new inventory count value
*/
public void setCount(int count) {
this.count = count;
if (this.needed > 0) {
this.count_text.setText(String.format("%1$d/%2$d", count, needed));
} else {
this.count_text.setText(String.valueOf(count));
}
this.count_text.setPosition((this.getWidth() / 2), this.count_text.getY());
if (count < needed) {
this.count_text.setColor(Color.RED);
} else {
this.count_text.setColor(Color.WHITE);
}
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:19,代码来源:LetterSprite.java
注:本文中的org.andengine.util.adt.color.Color类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论