当前位置: 首页>>代码示例>>Java>>正文


Java RoundedRectangle类代码示例

本文整理汇总了Java中org.newdawn.slick.geom.RoundedRectangle的典型用法代码示例。如果您正苦于以下问题:Java RoundedRectangle类的具体用法?Java RoundedRectangle怎么用?Java RoundedRectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RoundedRectangle类属于org.newdawn.slick.geom包,在下文中一共展示了RoundedRectangle类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	this.container = container;

	rect = new Rectangle(400,100,200,150);
	round = new RoundedRectangle(150,100,200,150,50);
	round2 = new RoundedRectangle(150,300,200,150,50);
	center = new Rectangle(350,250,100,100);
	
	poly = new Polygon();
	poly.addPoint(400,350);
	poly.addPoint(550,320);
	poly.addPoint(600,380);
	poly.addPoint(620,450);
	poly.addPoint(500,450);
	
	gradient = new GradientFill(0,-75,Color.red,0,75,Color.yellow,true);
	gradient2 = new GradientFill(0,-75,Color.blue,0,75,Color.white,true);
	gradient4 = new GradientFill(-50,-40,Color.green,50,40,Color.cyan,true);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:23,代码来源:GradientTest.java

示例2: init

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    shapes = new ArrayList();
    rect = new Rectangle(10, 10, 100, 80);
    shapes.add(rect);
    roundRect = new RoundedRectangle(150, 10, 60, 80, 20);
    shapes.add(roundRect);
    ellipse = new Ellipse(350, 40, 50, 30);
    shapes.add(ellipse);
    circle = new Circle(470, 60, 50);
    shapes.add(circle);
    polygon = new Polygon(new float[]{550, 10, 600, 40, 620, 100, 570, 130});
    shapes.add(polygon);
    
    keys = new boolean[256];
    lastChar = new char[256];
    createPoly(200,200);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:21,代码来源:ShapeTest.java

示例3: render

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
public void render(GameContainer gameContainer) {
    this.bgImage.draw();
    Graphics graphics = gameContainer.getGraphics();
    graphics.setColor(Color.gray);
    RoundedRectangle rect = new RoundedRectangle(50, 50, game.getWidth() - 100, game.getHeight() - 100, 20);
    graphics.draw(rect);
    graphics.fill(rect);
    graphics.setColor(Color.blue);
    graphics.drawString(this.text, (game.getWidth() / 2) - (this.textWidth / 2), (110) - (this.textHeight / 2));

    for (Player player : playerList) {
        player.render();
        graphics.draw(player.getBoundingBox());
    }

    drawSaveInfo(gameContainer, graphics);
}
 
开发者ID:Nodea-Games,项目名称:SteampunkZelda,代码行数:18,代码来源:SaveSelectScreen.java

示例4: render

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
public void render(GameContainer gameContainer) {
    Graphics graphics = gameContainer.getGraphics();
    Font font = graphics.getFont();
    this.bgImage.draw();

    graphics.setAntiAlias(true);

    for (ButtonData buttonData : buttons) {
        RoundedRectangle button = buttonData.getButton();
        String message = buttonData.getMessage();
        Color buttonColour = buttonData.getColour();

        graphics.setColor(buttonColour);

        graphics.fillRoundRect(button.getMinX(), button.getMinY(), button.getWidth(), button.getHeight(), (int) Math.floor(button.getCornerRadius()));

        if (buttonColour == Color.cyan) {
            graphics.setColor(Color.black);
        }
        else {
            graphics.setColor(Color.white);
        }
        graphics.drawString(message, button.getCenterX() - (font.getWidth(message) / 2), button.getCenterY() - (font.getHeight(message) / 2));
    }
}
 
开发者ID:Nodea-Games,项目名称:SteampunkZelda,代码行数:26,代码来源:GameOverScreen.java

示例5: update

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
public void update(GameContainer gameContainer, int deltaTime) throws SlickException {
    float mouseX = gameContainer.getInput().getMouseX();
    float mouseY = gameContainer.getInput().getMouseY();
    for (ButtonData buttonData : buttons) {
        RoundedRectangle button = buttonData.getButton();

        if (mouseX < button.getMaxX() * this.game.getScaleX() && mouseX > button.getMinX() * this.game.getScaleX()
                && mouseY < button.getMaxY()  * this.game.getScaleY() && mouseY > button.getMinY()  * this.game.getScaleY()) {
            buttonData.setColour(Color.blue);
            if (gameContainer.getInput().isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
                if (buttonData.getMessage() == "Exit") {
                    System.exit(0);
                }
            }
        }
        else {
            if (buttonData.getColour() != Color.cyan) {
                buttonData.setColour(Color.cyan);
            }
        }
    }
}
 
开发者ID:Nodea-Games,项目名称:SteampunkZelda,代码行数:23,代码来源:GameOverScreen.java

示例6: Textbox

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
/**
 * The constructor.
 * 
 * @param x The x position of the textbox
 * @param y The y position of the textbox
 * @param width The width of the textbox
 * @param height The height of the textbox
 */
public Textbox(float x, float y, float width, float height){
	super(x, y, width, height);
	textContainer = new RoundedRectangle(x, y, width, height, 10f);
	headerContainer = new RoundedRectangle(x, y - 40, 100, 35, 10f);
	graphicTextLines = new ArrayList<GraphicText>();
	textFont = new TrueTypeFont(new java.awt.Font("Calibri", java.awt.Font.PLAIN, 16), false);
	text = new ArrayList<String>();
	header = new ArrayList<String>();
	KeyInput.addInputCommand("Run Textbox Action", Input.KEY_ENTER, 0);
}
 
开发者ID:dstumpff,项目名称:VortexGameLibrary,代码行数:19,代码来源:Textbox.java

示例7: Confirmbox

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
/**
 * The constructor
 * 
 * @param x The x position
 * @param y The y position
 * @param width The width
 * @param height The height
 */
public Confirmbox(float x, float y, float width, float height) {
	super(x, y, width, height);
	selectionBox = new RoundedRectangle(x, y, width - margins[LEFT_MARGIN] - margins[RIGHT_MARGIN], textFont.getHeight(), 5f);
	columnWidth = selectionBox.getWidth();
	KeyInput.addInputCommand("Confirm Dialogbox Key Up", Input.KEY_UP, 0);
	KeyInput.addInputCommand("Confirm Dialogbox Key Down", Input.KEY_DOWN, 0);
	KeyInput.addInputCommand("Confirm Dialogbox Key Left", Input.KEY_LEFT, 0);
	KeyInput.addInputCommand("Confirm Dialogbox Key Right", Input.KEY_RIGHT, 0);
}
 
开发者ID:dstumpff,项目名称:VortexGameLibrary,代码行数:18,代码来源:Confirmbox.java

示例8: render

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
/**
 * Renders this tile and its value (if necessary).
 *
 * @param g
 */
public void render(Graphics g) {
    // Drawing the tile
    g.setColor(colours[ColourScheme.TILE_COLOUR_IDX]);
    g.fill(new RoundedRectangle((int) position.getX() + 1, (int) position.getY() + 1,
            (int) size.getWidth(), (int) size.getHeight(), 8));

    // Drawing the tile value, if the tile is valid
    if (value != -1) {
        g.setColor(colours[ColourScheme.TEXT_COLOUR_IDX]);
        g.drawString(Integer.toString(value), valueRenderPosX, valueRenderPosY);
    }
}
 
开发者ID:PureCS,项目名称:game-2048,代码行数:18,代码来源:Tile.java

示例9: GameOverScreen

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
public GameOverScreen(SteampunkZelda game) throws SlickException {
    super(game, 1280, 720);
    this.bgImage = new Image("res/screens/gameover.png");
    this.buttons.add(new ButtonData(new RoundedRectangle((this.game.getWindowSize().getX() / 4) * 3 - 100f, (this.game.getWindowSize().getY() / 4) * 3, 100f, 25f, 2f), "Exit", Color.cyan));
}
 
开发者ID:Nodea-Games,项目名称:SteampunkZelda,代码行数:6,代码来源:GameOverScreen.java

示例10: ButtonData

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
public ButtonData(RoundedRectangle rectangle, String message, Color colour) {
    this.button = rectangle;
    this.message = message;
    this.colour = colour;
}
 
开发者ID:Nodea-Games,项目名称:SteampunkZelda,代码行数:6,代码来源:ButtonData.java

示例11: getButton

import org.newdawn.slick.geom.RoundedRectangle; //导入依赖的package包/类
public RoundedRectangle getButton() {
    return this.button;
}
 
开发者ID:Nodea-Games,项目名称:SteampunkZelda,代码行数:4,代码来源:ButtonData.java


注:本文中的org.newdawn.slick.geom.RoundedRectangle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。