本文整理匯總了Java中org.newdawn.slick.Graphics.setColor方法的典型用法代碼示例。如果您正苦於以下問題:Java Graphics.setColor方法的具體用法?Java Graphics.setColor怎麽用?Java Graphics.setColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.newdawn.slick.Graphics
的用法示例。
在下文中一共展示了Graphics.setColor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: preRender
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.state.transition.Transition#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void preRender(StateBasedGame game, GameContainer container,
Graphics g) throws SlickException {
prev.render(container, game, g);
MaskUtil.defineMask();
for (int i=0;i<blobs.size();i++) {
((Blob) blobs.get(i)).render(g);
}
MaskUtil.finishDefineMask();
MaskUtil.drawOnMask();
if (background != null) {
Color c = g.getColor();
g.setColor(background);
g.fillRect(0,0,container.getWidth(),container.getHeight());
g.setColor(c);
}
}
示例2: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g) {
g.rotate(400, 300, ang);
g.fill(rect, gradient);
g.fill(round, gradient);
g.fill(poly, gradient2);
g.fill(center, gradient4);
g.setAntiAlias(true);
g.setLineWidth(10);
g.draw(round2, gradient2);
g.setLineWidth(2);
g.draw(poly, gradient);
g.setAntiAlias(false);
g.fill(center, gradient4);
g.setAntiAlias(true);
g.setColor(Color.black);
g.draw(center);
g.setAntiAlias(false);
}
示例3: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g) {
font.drawString(80, 5, "A Font Example", Color.red);
font.drawString(100, 32, "We - AV - Here is a more complete line that hopefully");
font.drawString(100, 36 + font.getHeight("We Here is a more complete line that hopefully"),
"will show some kerning.");
font2.drawString(80, 85, "A Font Example", Color.red);
font2.drawString(100, 132, "We - AV - Here is a more complete line that hopefully");
font2.drawString(100, 136 + font2.getHeight("We - Here is a more complete line that hopefully"),
"will show some kerning.");
image.draw(100,400);
String testStr = "Testing Font";
font2.drawString(100, 300, testStr);
g.setColor(Color.white);
g.drawRect(100,300+font2.getYOffset(testStr),font2.getWidth(testStr),font2.getHeight(testStr)-font2.getYOffset(testStr));
font.drawString(500, 300, testStr);
g.setColor(Color.white);
g.drawRect(500,300+font.getYOffset(testStr),font.getWidth(testStr),font.getHeight(testStr)-font.getYOffset(testStr));
}
示例4: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g) {
g.setColor(Color.green);
for(int i=0;i<shapes.size();i++) {
g.fill((Shape)shapes.get(i));
}
g.fill(randomShape);
g.setColor(Color.black);
g.setAntiAlias(true);
g.draw(randomShape);
g.setAntiAlias(false);
g.setColor(Color.white);
g.drawString("keys", 10, 300);
g.drawString("wasd - move rectangle", 10, 315);
g.drawString("WASD - resize rectangle", 10, 330);
g.drawString("tgfh - move rounded rectangle", 10, 345);
g.drawString("TGFH - resize rounded rectangle", 10, 360);
g.drawString("ry - resize corner radius on rounded rectangle", 10, 375);
g.drawString("ikjl - move ellipse", 10, 390);
g.drawString("IKJL - resize ellipse", 10, 405);
g.drawString("Arrows - move circle", 10, 420);
g.drawString("Page Up/Page Down - resize circle", 10, 435);
g.drawString("numpad 8546 - move polygon", 10, 450);
}
示例5: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
@Override
public void render(Graphics g, long cTime) {
// Only render the Upchuck until it dies.
if(!dead()) animation.render(g, position, theta);
// Even if Upchuck is dead, render its particles until they all die.
if(!bile.isEmpty()) bile.stream().filter(p -> p.isAlive(cTime)).forEach(p -> p.render(g, cTime));
if(Globals.SHOW_COLLIDERS) {
g.setColor(Color.red);
g.draw(bounds);
}
}
示例6: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g) throws SlickException {
g.setColor(new Color(0.4f,0.6f,0.8f));
g.fillRect(0,0, 1024,568);
g.setColor(Color.white);
g.drawRect(5,5, 1024-10,568-10);
g.setColor(Color.white);
g.drawString(container.getInput().getMouseX()+","+container.getInput().getMouseY(), 10, 400);
g.setColor(Color.red);
g.fillOval(container.getInput().getMouseX()-10,container.getInput().getMouseY()-10,20,20);
}
示例7: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
@Override
public void render(Graphics g, long cTime) {
super.render(g, cTime);
// Render the barrier if this is the host node.
if(host && (other != null)) {
g.setColor(LaserNode.BARRIER_COLOR);
g.setLineWidth(LaserNode.BARRIER_WIDTH);
g.drawLine(position.x, position.y,
other.getPosition().x, other.getPosition().y);
g.setLineWidth(1.0f);
}
}
示例8: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g)
throws SlickException {
g.setColor(Color.white);
g.drawString("1 - No Clipping", 100, 10);
g.drawString("2 - Screen Clipping", 100, 30);
g.drawString("3 - World Clipping", 100, 50);
if (world) {
g.drawString("WORLD CLIPPING ENABLED", 200, 80);
}
if (clip) {
g.drawString("SCREEN CLIPPING ENABLED", 200, 80);
}
g.rotate(400, 400, ang);
if (world) {
g.setWorldClip(350,302,100,196);
}
if (clip) {
g.setClip(350,302,100,196);
}
g.setColor(Color.red);
g.fillOval(300,300,200,200);
g.setColor(Color.blue);
g.fillRect(390,200,20,400);
g.clearClip();
g.clearWorldClip();
}
示例9: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
public void render(GameContainer container, Graphics g) throws SlickException {
g.setColor(Color.white);
g.drawString("Endianness is " + endian, 10, 100);
g.drawString("Image below should be red", 10, 200);
g.drawImage(fromRed, 10, 220);
g.drawString("Image below should be blue", 410, 200);
g.drawImage(fromBlue, 410, 220);
}
示例10: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* Render Seeds area
* @param gc GameContainer
* @param sbg StateBasedGame
* @param g Graphics
*/
public static void render(GameContainer gc, StateBasedGame sbg, Graphics g) {
for (int i=0; i<seed.size() && i<8; i++) {
if (seed.get(i) != null) {
x = PlayUI.getSeedZonePosX();
y = PlayUI.getSeedZonePosY();
w = PlayUI.getSeedZoneW();
h = PlayUI.getSeedZoneH();
seed.get(i).getImg().draw( x, y + i*h, w, h );
// g.drawString(""+seed.get(i).getPrice(), x + w * 0.71f, y + i*h + h*0.7f);
if (seed.get(i).getPrice() > SunUI.getSunCollected()) {
g.setColor(new Color(1,1,1,100));
g.fillRoundRect(x, y + i*h, w, h, 5);
}
}
}
for (int i=0; i<seed.size() && i<8; i++) {
if (seed.get(i) != null) {
x = PlayUI.getSeedZonePosX();
y = PlayUI.getSeedZonePosY();
w = PlayUI.getSeedZoneW();
h = PlayUI.getSeedZoneH();
if (seed.get(i).getPrice() > SunUI.getSunCollected())
cost.render(x + w * 0.594f, y + i*h + h*0.5f, (seed.get(i).getPrice()<100 ? " " : "") + seed.get(i).getPrice().toString(), new Color(180, 180, 180));
else
cost.render(x + w * 0.594f, y + i*h + h*0.5f, (seed.get(i).getPrice()<100 ? " " : "") + seed.get(i).getPrice().toString(), new Color(245, 245, 245));
}
}
}
示例11: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g) {
g.setColor(Color.white);
g.drawString("Position: "+music.getPosition(), 100,100);
g.drawString("Space - Pause/Resume", 100,130);
g.drawString("Right Arrow - Advance 5 seconds", 100, 145);
}
示例12: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g)
throws SlickException {
g.clearAlphaMap();
g.setDrawMode(Graphics.MODE_NORMAL);
g.setColor(Color.white);
g.fillOval(100,100,150,150);
textureMap.draw(10,50);
g.copyArea(copy, 100,100);
g.setColor(Color.red);
g.fillRect(300,100,200,200);
copy.draw(350,150);
}
示例13: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.state.BasicGameState#render(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, StateBasedGame game, Graphics g) {
g.setFont(font);
g.setColor(Color.blue);
g.drawString("This is State 3", 200, 50);
g.setColor(Color.white);
for (int i=0;i<options.length;i++) {
g.drawString(options[i], 400 - (font.getWidth(options[i])/2), 200+(i*50));
if (selected == i) {
g.drawRect(200,190+(i*50),400,50);
}
}
}
示例14: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.gui.AbstractComponent#render(org.newdawn.slick.gui.GUIContext,
* org.newdawn.slick.Graphics)
*/
public void render(GUIContext container, Graphics g) {
if (currentImage != null) {
int xp = (int) (area.getX() + ((getWidth() - currentImage.getWidth()) / 2));
int yp = (int) (area.getY() + ((getHeight() - currentImage.getHeight()) / 2));
currentImage.draw(xp, yp, currentColor);
} else {
g.setColor(currentColor);
g.fill(area);
}
updateImage();
}
示例15: render
import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
public void render(Graphics g) {
Image img = AssetManager.getManager().getImage(image);
if(img == null) {
// Draw the text representing the button.
UnicodeFont fnt = AssetManager.getManager().getFont(FONT_NAME);
Color color = mouseOver() ? DEFAULT_HOVER : DEFAULT_TEXT;
g.setColor(color);
g.setFont(fnt);
g.drawString(text, position.x, position.y);
} else g.drawImage(img, position.x, position.y);
}