Java Code Examples for com.badlogic.gdx.graphics.Color#BLACK

The following examples show how to use com.badlogic.gdx.graphics.Color#BLACK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShopCard.java    From Klooni1010 with GNU General Public License v3.0 6 votes vote down vote up
ShopCard(final Klooni game, final GameLayout layout,
         final String itemName, final Color backgroundColor) {
    this.game = game;
    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = game.skin.getFont("font_small");

    priceLabel = new Label("", labelStyle);
    nameLabel = new Label(itemName, labelStyle);

    Color labelColor = Theme.shouldUseWhite(backgroundColor) ? Color.WHITE : Color.BLACK;
    priceLabel.setColor(labelColor);
    nameLabel.setColor(labelColor);

    priceBounds = new Rectangle();
    nameBounds = new Rectangle();

    layout.update(this);
}
 
Example 2
Source File: GameEngine.java    From collider with Apache License 2.0 6 votes vote down vote up
public void clear() {
	processes = new ContProcesses();
	
	ColliderOpts opts = new ColliderOpts();
	opts.cellWidth = 22.0;
	opts.separateBuffer = .1;
	opts.maxForesightTime = 2.0;
	opts.interactTester = new CompInteractTester();
	collider = new Collider(opts);
	
	comps.clear();
	events.clear();
	mouseListener = null;
	bounds = null;
	
	bgColor = Color.BLACK;

	processes.addProcess(new ColliderProcess(collider, new MyColliderListener()));
	processes.addProcess(new EventProcess());
	events.add(new LogEvent(0.0));
}
 
Example 3
Source File: BasicColorPicker.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
protected BasicColorPicker (ColorPickerWidgetStyle style, ColorPickerListener listener, boolean loadExtendedShaders) {
	this.listener = listener;
	this.style = style;
	this.sizes = VisUI.getSizes();

	oldColor = new Color(Color.BLACK);
	color = new Color(Color.BLACK);

	commons = new PickerCommons(style, sizes, loadExtendedShaders);

	createColorWidgets();
	createUI();

	updateValuesFromCurrentColor();
	updateUI();
}
 
Example 4
Source File: CCCheckBox.java    From cocos-ui-libgdx with Apache License 2.0 6 votes vote down vote up
@Override
public Actor parse(CocoStudioUIEditor editor, ObjectData widget) {
    TCheckBox.CheckBoxStyle style = new TCheckBox.CheckBoxStyle(null, null, new BitmapFont(),
        Color.BLACK);

    if (widget.getNodeNormalFileData() != null) {// 选中图片

        style.checkboxOff = editor.findDrawable(widget,
            widget.getNodeNormalFileData());
    }
    if (widget.getNormalBackFileData() != null) {// 没选中图片
        style.checkboxOn = editor.findDrawable(widget,
            widget.getNormalBackFileData());
    }

    style.setTianCheckBox(editor.findDrawable(widget, widget.getNormalBackFileData())
        , editor.findDrawable(widget, widget.getPressedBackFileData())
        , editor.findDrawable(widget, widget.getDisableBackFileData())
        , editor.findDrawable(widget, widget.getNodeNormalFileData())
        , editor.findDrawable(widget, widget.getNodeDisableFileData()));

    TCheckBox checkBox = new TCheckBox("", style);
    checkBox.setChecked(widget.isDisplayState());
    checkBox.setDisabled(widget.isDisplayState());
    return checkBox;
}
 
Example 5
Source File: Utils.java    From skin-composer with MIT License 6 votes vote down vote up
/**
 * Does not dispose pixmap.
 * @param pixmap
 * @return 
 */
public static Color averageColor(Pixmap pixmap) {
    Color temp = new Color();
    float sumR = 0.0f;
    float sumG = 0.0f;
    float sumB = 0.0f;
    int count = 0;
    for (int y = 0; y < pixmap.getHeight(); y++) {
        for (int x = 0; x < pixmap.getWidth(); x++) {
            temp.set(pixmap.getPixel(x, y));
            if (temp.a > 0) {
                sumR += temp.r;
                sumG += temp.g;
                sumB += temp.b;
                count++;
            }
        }
    }
    
    if (count == 0) {
        return new Color(Color.BLACK);
    } else {
        return new Color(sumR / count, sumG / count, sumB / count, 1.0f);
    }
}
 
Example 6
Source File: DialogDrawables.java    From skin-composer with MIT License 6 votes vote down vote up
private void tiledDrawableSettings(DrawableData drawable, ColorData colorData, float minWidth, float minHeight, String name) {
    drawable.name = name;
    drawable.tintName = colorData.getName();
    drawable.minWidth = minWidth;
    drawable.minHeight = minHeight;
    
    //Fix background color for new, tinted drawable
    Color temp = Utils.averageEdgeColor(drawable.file, colorData.color);

    if (Utils.brightness(temp) > .5f) {
        drawable.bgColor = Color.BLACK;
    } else {
        drawable.bgColor = Color.WHITE;
    }
    
    if (!main.getAtlasData().getDrawables().contains(drawable, false)) {
        main.getAtlasData().getDrawables().add(drawable);
    }
    main.getProjectData().setChangesSaved(false);
    gatherDrawables();
    main.getAtlasData().produceAtlas();
    sortBySelectedMode();
    getStage().setScrollFocus(scrollPane);
}
 
Example 7
Source File: GDXDrawingAdapter.java    From INFDEV02-4 with MIT License 5 votes vote down vote up
private Color convertColor(CustomColor color) {
    switch(color) {
        case WHITE:
            return Color.WHITE;
            
        case BLACK:
            return Color.BLACK;
            
        case BLUE:
            return Color.BLUE;
            
        default:
            return Color.RED;
    }
}
 
Example 8
Source File: DrawableData.java    From skin-composer with MIT License 5 votes vote down vote up
public DrawableData(FileHandle file) {
    this.file = file;
    Color temp = Utils.averageEdgeColor(file);
    if (Utils.brightness(temp) > .5f) {
        bgColor = Color.BLACK;
    } else {
        bgColor = Color.WHITE;
    }
    this.name = proper(file.name());
    customized = false;
    minWidth = -1;
    minHeight = -1;
}
 
Example 9
Source File: GDXDrawingAdapter.java    From INFDEV02-4 with MIT License 5 votes vote down vote up
private Color convertColor(CustomColor color) {
    switch (color) {
        case WHITE:
            return Color.WHITE;

        case BLACK:
            return Color.BLACK;

        case BLUE:
            return Color.BLUE;

        default:
            return Color.RED;
    }
}
 
Example 10
Source File: GDXDrawingAdapter.java    From INFDEV02-4 with MIT License 5 votes vote down vote up
private Color convertColor(CustomColor color) {
    switch (color) {
        case WHITE:
            return Color.WHITE;

        case BLACK:
            return Color.BLACK;

        case BLUE:
            return Color.BLUE;

        default:
            return Color.RED;
    }
}
 
Example 11
Source File: TextButton.java    From riiablo with Apache License 2.0 5 votes vote down vote up
public TextButtonStyle (Drawable up, Drawable down, Drawable checked, BitmapFont font) {
  super(up, down, checked);
  unpressedOffsetY = -2;
  pressedOffsetX = -2;
  pressedOffsetY = unpressedOffsetY + pressedOffsetX;
  checkedOffsetX = unpressedOffsetX;
  checkedOffsetY = unpressedOffsetY;
  this.font = font;
  fontColor = Color.BLACK;
}
 
Example 12
Source File: GDXDrawingAdapter.java    From INFDEV02-4 with MIT License 5 votes vote down vote up
private Color convertColor(CustomColor color) {
    switch(color) {
        case WHITE:
            return Color.WHITE;
            
        case BLACK:
            return Color.BLACK;
            
        case BLUE:
            return Color.BLUE;
            
        default:
            return Color.RED;
    }
}
 
Example 13
Source File: Param.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
public static Color parseColor(String color) {
	if (color == null || color.trim().isEmpty()) {
		return null; // the default color in the style will be used
	}

	switch (color.trim()) {
	case "black":
		return Color.BLACK;
	case "white":
		return Color.WHITE;
	default:
		return Color.valueOf(color);
	}
}
 
Example 14
Source File: TextManagerUI.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void setText(Text t) {
	text = t;

	if (t == null && isVisible()) {
		setVisible(false);
	} else if (t != null && !isVisible()) {
		setVisible(true);
	}

	if (isVisible()) {
		style = getStyle(text);
		Color color = text.color != null ? text.color : style.defaultColor;

		if (color == null)
			color = Color.BLACK;

		maxWidth = Math.min(getStage().getViewport().getScreenWidth() - DPIUtils.getMarginSize() * 2,
				style.font.getXHeight()
						* (text.type == Text.Type.TALK ? style.maxTalkCharWidth : style.maxCharWidth));

		layout.setText(style.font, text.str, color, maxWidth, Align.center, true);
		setSize(layout.width + PADDING * 2, layout.height + PADDING * 2);

		calcPos();
	}
}
 
Example 15
Source File: LogMenu.java    From Cubes with MIT License 5 votes vote down vote up
public LogMenu() {
  label = new Label("", new LabelStyle(Fonts.smallHUD, Color.BLACK));
  label.setWrap(true);
  Drawable background = new TextureRegionDrawable(Assets.getTextureRegion("core:hud/LogBackground.png"));
  scrollPane = new ScrollPane(label, new ScrollPaneStyle(background, null, null, null, null));
  scrollPane.setScrollingDisabled(true, false);
  back = MenuTools.getBackButton(this);
  
  stage.addActor(scrollPane);
  stage.addActor(back);
  
  refresh();
}
 
Example 16
Source File: DesktopLauncher.java    From Norii with Apache License 2.0 5 votes vote down vote up
public static void main(final String[] arg) {
	final LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
	config.title = "Norii a turn based strategy game by Jelte";
	config.width = 580;
	config.height = 580;
	config.fullscreen = false;
	config.initialBackgroundColor = Color.BLACK;

	final Application app = new LwjglApplication(new Norii(), config);
	Gdx.app = app;
	Gdx.app.setLogLevel(Application.LOG_DEBUG);
}
 
Example 17
Source File: Utils.java    From skin-composer with MIT License 4 votes vote down vote up
/**
 * Does not dispose pixmap.
 * @param pixmap
 * @param ninePatch
 * @return 
 */
public static Color averageEdgeColor(Pixmap pixmap, boolean ninePatch) {
    int border = 0;
    if (ninePatch) {
        border = 1;
    }
    
    Color temp = new Color();
    float sumR = 0.0f;
    float sumG = 0.0f;
    float sumB = 0.0f;
    int count = 0;

    //left edge
    for (int y = border; y < pixmap.getHeight() - border; y++) {
        for (int x = border; x < pixmap.getWidth() - border; x++) {
            temp.set(pixmap.getPixel(x, y));
            if (temp.a > 0) {
                sumR += temp.r;
                sumG += temp.g;
                sumB += temp.b;
                count++;
                break;
            }
        }
    }
    
    //right edge
    for (int y = border; y < pixmap.getHeight() - border; y++) {
        for (int x = pixmap.getWidth() - 1 - border; x > border; x--) {
            temp.set(pixmap.getPixel(x, y));
            if (temp.a > 0) {
                sumR += temp.r;
                sumG += temp.g;
                sumB += temp.b;
                count++;
                break;
            }
        }
    }
    
    //top edge
    for (int x = border; x < pixmap.getWidth() - border; x++) {
        for (int y = border; y < pixmap.getHeight() - border; y++) {
            temp.set(pixmap.getPixel(x, y));
            if (temp.a > 0) {
                sumR += temp.r;
                sumG += temp.g;
                sumB += temp.b;
                count++;
                break;
            }
        }
    }
    
    //bottom edge
    for (int x = border; x < pixmap.getWidth() - border; x++) {
        for (int y = pixmap.getHeight() - 1 - border; y > border; y--) {
            temp.set(pixmap.getPixel(x, y));
            if (temp.a > 0) {
                sumR += temp.r;
                sumG += temp.g;
                sumB += temp.b;
                count++;
                break;
            }
        }
    }
    
    if (count == 0) {
        return new Color(Color.BLACK);
    } else {
        return new Color(sumR / count, sumG / count, sumB / count, 1.0f);
    }
}
 
Example 18
Source File: Utils.java    From skin-composer with MIT License 4 votes vote down vote up
public static Color blackOrWhiteBgColor(Color color) {
    return brightness(color) > .5f ? new Color(Color.BLACK) : new Color(Color.WHITE);
}
 
Example 19
Source File: TextButton.java    From riiablo with Apache License 2.0 4 votes vote down vote up
public TextButtonStyle(TextButtonStyle style) {
  super(style);
  this.font = style.font;
  fontColor = Color.BLACK;
}
 
Example 20
Source File: WorldClient.java    From Cubes with MIT License 4 votes vote down vote up
public Color getSkyColour() {
  float light = getWorldSunlight();
  if (light <= 0.3f) return Color.BLACK;
  if (light >= 0.7f) return Color.SKY;
  return Color.BLACK.cpy().lerp(Color.SKY, (light - 0.3f) * 2.5f);
}