本文整理汇总了Java中de.lessvoid.nifty.tools.Color类的典型用法代码示例。如果您正苦于以下问题:Java Color类的具体用法?Java Color怎么用?Java Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Color类属于de.lessvoid.nifty.tools包,在下文中一共展示了Color类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderImage
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
public void renderImage(RenderImage image, int x, int y, int width, int height,
Color color, float imageScale){
RenderImageJme jmeImage = (RenderImageJme) image;
niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
niftyMat.setColor("Color", ColorRGBA.White);
niftyMat.setTexture("Texture", jmeImage.getTexture());
niftyMat.setBoolean("UseTex", true);
setColor(color);
quad.clearBuffer(Type.TexCoord);
quad.setBuffer(quadDefaultTC);
float x0 = x + 0.5f * width * (1f - imageScale);
float y0 = y + 0.5f * height * (1f - imageScale);
tempMat.loadIdentity();
tempMat.setTranslation(x0, getHeight() - y0, 0);
tempMat.setScale(width * imageScale, height * imageScale, 0);
rm.setWorldMatrix(tempMat);
niftyMat.render(quadGeom, rm);
}
示例2: draw
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
/**
* <p>Draw a texture</p>
*/
public void draw(Texture texture,
float x1, float y1,
float x2, float y2,
float tx1, float ty1,
float tx2, float ty2, Color color0, Color color1, Color color2, Color color3) {
final float c0 = Float.intBitsToFloat((int) (color0.getAlpha() * 255) << 24
| (int) (color0.getBlue() * 255) << 16
| (int) (color0.getGreen() * 255) << 8
| (int) (color0.getRed() * 255));
final float c1 = Float.intBitsToFloat((int) (color1.getAlpha() * 255) << 24
| (int) (color1.getBlue() * 255) << 16
| (int) (color1.getGreen() * 255) << 8
| (int) (color1.getRed() * 255));
final float c2 = Float.intBitsToFloat((int) (color2.getAlpha() * 255) << 24
| (int) (color2.getBlue() * 255) << 16
| (int) (color2.getGreen() * 255) << 8
| (int) (color2.getRed() * 255));
final float c3 = Float.intBitsToFloat((int) (color3.getAlpha() * 255) << 24
| (int) (color3.getBlue() * 255) << 16
| (int) (color3.getGreen() * 255) << 8
| (int) (color3.getRed() * 255));
draw(texture, x1, y1, x2, y2, tx1, ty1, tx2, ty2, c0, c1, c2, c3);
}
示例3: renderImage
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void renderImage(RenderImage image, int x, int y, int w, int h, int srcX, int srcY, int srcW, int srcH,
Color color, float scale, int centerX, int centerY) {
final Texture internal = ((NiftyRenderImage) image).getTexture();
//!
//! Calculate offset of the image.
//!
final Image data = internal.getImage();
final float tx1 = (float) srcX / data.getWidth();
final float ty1 = (float) srcY / data.getHeight();
final float tx2 = tx1 + (float) srcW / data.getWidth();
final float ty2 = ty1 + (float) srcH / data.getHeight();
final float x0 = centerX + (x - centerX) * scale;
final float y0 = centerY + (y - centerY) * scale;
mRender.draw(internal, x0, y0, w * scale, h * scale, tx1, ty1, tx2, ty2, color);
}
示例4: display
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
@Override
public void display(@Nonnull final Element element, final ServerEntry serverEntry) {
final Element text = element.findElementById("#server-name");
final TextRenderer textRenderer = text.getRenderer(TextRenderer.class);
final Element ip = element.findElementById("#server-ip");
final TextRenderer ipRenderer = ip.getRenderer(TextRenderer.class);
if (serverEntry != null) {
textRenderer.setText(serverEntry.getName());
ipRenderer.setColor(Color.WHITE);
ipRenderer.setText(serverEntry.getIp());
} else {
textRenderer.setText("");
ipRenderer.setText("");
}
}
示例5: RenderDeviceJme
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
public RenderDeviceJme(NiftyJmeDisplay display) {
this.display = display;
quadColor = new VertexBuffer(Type.Color);
quadColor.setNormalized(true);
ByteBuffer bb = BufferUtils.createByteBuffer(4 * 4);
quadColor.setupData(Usage.Stream, 4, Format.UnsignedByte, bb);
quad.setBuffer(quadColor);
quadModTC.setUsage(Usage.Stream);
niftyMat = new Material(display.getAssetManager(), "Common/MatDefs/Nifty/NiftyTex.j3md");
niftyMat.getAdditionalRenderState().setDepthTest(false);
niftyQuadMat = new Material(display.getAssetManager(), "Common/MatDefs/Nifty/NiftyQuad.j3md");
niftyQuadMat.getAdditionalRenderState().setDepthTest(false);
}
示例6: renderImage
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
public void renderImage(RenderImage image, int x, int y, int width, int height,
Color color, float imageScale) {
RenderImageJme jmeImage = (RenderImageJme) image;
niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
niftyMat.setColor("Color", ColorRGBA.White);
niftyMat.setTexture("Texture", jmeImage.getTexture());
setColor(color);
quad.clearBuffer(Type.TexCoord);
quad.setBuffer(quadDefaultTC);
float x0 = x + 0.5f * width * (1f - imageScale);
float y0 = y + 0.5f * height * (1f - imageScale);
tempMat.loadIdentity();
tempMat.setTranslation(x0, getHeight() - y0, 0);
tempMat.setScale(width * imageScale, height * imageScale, 0);
rm.setWorldMatrix(tempMat);
niftyMat.render(quadGeom, rm);
//
// System.out.println("renderImage");
}
示例7: startGame
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
public void startGame() {
//TODO: without a player one cannot start
String mapName = screen.findElementById("mapNameLabel").getRenderer(TextRenderer.class).getOriginalText();
List<Element> children = playerScrollPanelPanel.getChildren();
ArrayList<Player> players = new ArrayList<Player>();
for (int i = 0; i < children.size(); i++) {
Element child = children.get(i);
String name = child.findNiftyControl("player" + i + "TextField", TextField.class).getDisplayedText();
if (child.findElementById("player" + i + "Label").getRenderer(TextRenderer.class).getOriginalText().equals("AI:")) {
System.err.println("AI not implemented yet. " + name + " excluded from Players.");
continue;
}
Color colorNifty = screen.findElementById("color" + i).getRenderer(PanelRenderer.class).getBackgroundColor();
org.newdawn.slick.Color colorSlick = new org.newdawn.slick.Color(colorNifty.getRed(), colorNifty.getGreen(), colorNifty.getBlue(), colorNifty.getAlpha());
int team = Integer.parseInt(screen.findNiftyControl("team" + i, Button.class).getText().substring(5))-1;
players.add(new Player(name, colorSlick, team));
}
Player[] player = new Player[players.size()];
player = players.toArray(player);
NiftyMenu.startGame(new Controller(MapList.getInstance().getMap(mapName), player, "Conquest"));
}
示例8: addMessage
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
public void addMessage(final String newMessage, Color color) {
Globals.app.enqueue(() -> {
messages.add(newMessage);
int index = messages.size() - 1;
for (int i = rows.size() - 1; i >= 0;) {
TextRenderer text = rows.get(i)
.getRenderer(TextRenderer.class);
if (index < 0) {
break;
}
String message = messages.get(index--);
text.setText(message);
String[] split = text.getWrappedText().split("\n");
for (int l = split.length - 1; l >= 0 && i >= 0; --l) {
rows.get(i--).getRenderer(TextRenderer.class)
.setText(split[l]);
}
}
return null;
});
}
示例9: renderPlayerText
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
public void renderPlayerText(@Nonnull String text, int x, int y, @Nonnull Color color)
{
if (playerFont == null || nifty == null)
{
// Without nifty, use slick with its default font
Graph.g.setColor(new org.newdawn.slick.Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()));
Graph.g.drawString(text, x, y);
}
else
{
TextureImpl.unbind();
nifty.getRenderEngine().setColor(color);
nifty.getRenderEngine().setFont(playerFont);
nifty.getRenderEngine().renderText(text, x, y, -1, -1, Color.NONE);
nifty.getRenderEngine().setColor(Color.WHITE);
Graph.g.setColor(org.newdawn.slick.Color.white);
TextureImpl.unbind();
}
}
示例10: execute
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
@Override
public void execute(Element element, float effectTime, Falloff falloff, NiftyRenderEngine r)
{
updateIndex(element.getNifty().getTimeProvider());
Color currentColor = colors[index];
if (falloff == null)
{
element.getRenderer(PanelRenderer.class).setBackgroundColor(currentColor);
}
else
{
tempColor.mutiply(currentColor, falloff.getFalloffValue());
element.getRenderer(PanelRenderer.class).setBackgroundColor(tempColor);
}
}
示例11: renderImage
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
public void renderImage(RenderImage image, int x, int y, int width, int height,
Color color, float imageScale){
RenderImageJme jmeImage = (RenderImageJme) image;
niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
niftyMat.setColor("Color", ColorRGBA.White);
niftyMat.setTexture("Texture", jmeImage.getTexture());
niftyMat.setBoolean("UseTex", true);
setColor(color);
quad.clearBuffer(Type.TexCoord);
quad.setBuffer(quadDefaultTC);
float x0 = x + 0.5f * width * (1f - imageScale);
float y0 = y + 0.5f * height * (1f - imageScale);
tempMat.loadIdentity();
tempMat.setTranslation(x0, getHeight() - y0, 0);
tempMat.setScale(width * imageScale, height * imageScale, 0);
rm.setWorldMatrix(tempMat);
niftyMat.render(quadGeom, rm);
//
// System.out.println("renderImage");
}
示例12: renderQuad
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
public void renderQuad(int x, int y, int width, int height, Color color){
niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
niftyMat.setColor("Color", ColorRGBA.White);
niftyMat.clearParam("Texture");
niftyMat.setBoolean("UseTex", false);
setColor(color);
tempMat.loadIdentity();
tempMat.setTranslation(x, getHeight() - y, 0);
tempMat.setScale(width, height, 0);
rm.setWorldMatrix(tempMat);
niftyMat.render(quadGeom, rm);
// System.out.println("renderQuad (Solid)");
}
示例13: activate
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
@Override
/**Called when activating the effect
* @param nifty - the main nifty calling class
* @param element - the element triggering the effect
* @param parameter - the parameters passed in for the effect
* **/
public void activate(final Nifty nifty, final Element element, final EffectProperties parameter) {
this.el = element;
if (parameter.getProperty("startColor") != null) {
start = new Alpha(new Color(parameter.getProperty("startColor", "#000000ff")).getAlpha());
}
if (parameter.getProperty("endColor") != null) {
end = new Alpha(new Color(parameter.getProperty("endColor", "#ffffffff")).getAlpha());
}
if (parameter.getProperty("start") != null) {
start = new Alpha(parameter.getProperty("start"));
}
if (parameter.getProperty("end") != null) {
end = new Alpha(parameter.getProperty("end"));
}
interpolator = parameter.getInterpolator();
}
示例14: activate
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
/**Called when activating the effect
* @param nifty - the main nifty calling class
* @param element - the element triggering the effect
* @param parameter - the parameters passed in for the effect
* **/
@Override
public void activate(final Nifty nifty, final Element element, final EffectProperties parameter) {
super.activate(nifty, element, parameter);
if (parameter.getProperty("startColor") != null) {
start = new Alpha(new Color(parameter.getProperty("startColor", "#000000ff")).getAlpha());
}
if (parameter.getProperty("endColor") != null) {
end = new Alpha(new Color(parameter.getProperty("endColor", "#ffffffff")).getAlpha());
}
if (parameter.getProperty("start") != null) {
start = new Alpha(parameter.getProperty("start"));
}
if (parameter.getProperty("end") != null) {
end = new Alpha(parameter.getProperty("end"));
}
interpolator = parameter.getInterpolator();
}
示例15: RenderDeviceJme
import de.lessvoid.nifty.tools.Color; //导入依赖的package包/类
public RenderDeviceJme(NiftyJmeDisplay display){
this.display = display;
quadColor = new VertexBuffer(Type.Color);
quadColor.setNormalized(true);
ByteBuffer bb = BufferUtils.createByteBuffer(4 * 4);
quadColor.setupData(Usage.Stream, 4, Format.UnsignedByte, bb);
quad.setBuffer(quadColor);
quadModTC.setUsage(Usage.Stream);
niftyMat = new Material(display.getAssetManager(), "Common/MatDefs/Nifty/Nifty.j3md");
niftyMat.getAdditionalRenderState().setDepthTest(false);
}