本文整理匯總了Java中org.newdawn.slick.Graphics.pushTransform方法的典型用法代碼示例。如果您正苦於以下問題:Java Graphics.pushTransform方法的具體用法?Java Graphics.pushTransform怎麽用?Java Graphics.pushTransform使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.newdawn.slick.Graphics
的用法示例。
在下文中一共展示了Graphics.pushTransform方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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("Red indicates a collision, green indicates no collision", 50, 420);
g.drawString("White are the targets", 50, 435);
g.pushTransform();
g.translate(100,100);
g.pushTransform();
g.translate(-50,-50);
g.scale(10, 10);
g.setColor(Color.red);
g.fillRect(0,0,5,5);
g.setColor(Color.white);
g.drawRect(0,0,5,5);
g.popTransform();
g.setColor(Color.green);
g.fillRect(20,20,50,50);
g.popTransform();
g.setColor(Color.white);
g.draw(rect);
g.draw(circle);
g.setColor(rect1.intersects(rect) ? Color.red : Color.green);
g.draw(rect1);
g.setColor(rect2.intersects(rect) ? Color.red : Color.green);
g.draw(rect2);
g.setColor(roundRect.intersects(rect) ? Color.red : Color.green);
g.draw(roundRect);
g.setColor(circle1.intersects(rect) ? Color.red : Color.green);
g.draw(circle1);
g.setColor(circle2.intersects(rect) ? Color.red : Color.green);
g.draw(circle2);
g.setColor(circle3.intersects(circle) ? Color.red : Color.green);
g.fill(circle3);
g.setColor(circle4.intersects(circle) ? Color.red : Color.green);
g.draw(circle4);
g.fill(roundRect2);
g.setColor(Color.blue);
g.draw(roundRect2);
g.setColor(Color.blue);
g.draw(new Circle(100,100,50));
g.drawRect(50,50,100,100);
}