本文整理了Java中java.awt.image.BufferStrategy.getDrawGraphics()
方法的一些代码示例,展示了BufferStrategy.getDrawGraphics()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferStrategy.getDrawGraphics()
方法的具体详情如下:
包路径:java.awt.image.BufferStrategy
类名称:BufferStrategy
方法名:getDrawGraphics
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
Graphics2D g2d = (Graphics2D) strategy.getDrawGraphics();
if (g2d == null) {
Logger.getLogger(AwtPanel.class.getName()).log(Level.WARNING, "OGL: DrawGraphics was null.");
代码示例来源:origin: stackoverflow.com
if (graphics == null) {
try {
graphics = (Graphics2D) strategy.getDrawGraphics();
} catch (IllegalStateException e) {
return null;
代码示例来源:origin: com.threerings/nenya
@Override
protected Graphics2D createGraphics ()
{
return (Graphics2D)_bufstrat.getDrawGraphics();
}
代码示例来源:origin: stackoverflow.com
public void render(){
BufferStrategy bufferStrat = getBufferStrategy(); //I understand that this returns a null
if(bufferStrat == null){
createBufferStrategy(3);
return;
}
Graphics g = bufferStrat.getDrawGraphics();
}
代码示例来源:origin: stackoverflow.com
private void render() {
if (getWidth() == 0 || getHeight() == 0) {
return;
}
BufferStrategy bs = this.getBufferStrategy();
if (bs == null) {
this.createBufferStrategy(3);
return;
}
Graphics g = bs.getDrawGraphics();
}
代码示例来源:origin: stackoverflow.com
BufferStrategy bs = Main.frame.getBufferStrategy();
if(bs == null)
Main.frame.createBufferStrategy(3);
// if bs was null before, it still is null
Graphics g = bs.getDrawGraphics();
代码示例来源:origin: threerings/nenya
@Override
protected Graphics2D createGraphics ()
{
return (Graphics2D)_bufstrat.getDrawGraphics();
}
代码示例来源:origin: stackoverflow.com
@Override
protected void Draw() {
BufferStrategy bs = getBufferStrategy();
Graphics g = bs.getDrawGraphics(); // acquire the graphics
// draw stuff here
bs.show(); // swap buffers
}
代码示例来源:origin: stackoverflow.com
BufferStrategy myStrategy;
while (!done) {
Graphics g = myStrategy.getDrawGraphics();
render(g);//draw the frame/graphics
g.dispose();
myStrategy.show();
}
代码示例来源:origin: stackoverflow.com
public void updateGraphics()
{
BufferStrategy bs = getBufferStrategy();
Graphics g = bs.getDrawGraphics();
paint(g);
g.dispose();
bs.show();
Toolkit.getDefaultToolkit().sync();
update(g);
}
代码示例来源:origin: stackoverflow.com
@Override
public void paint(Graphics g) {
BufferStrategy bf = this.getBufferStrategy();
Graphics2D bfg = (Graphics2D) bf.getDrawGraphics();
bfg.scale(2.0, 2.0);
mLevel.draw(bfg, this);
for (GameEntity entity : mGameEntities) {
entity.step();
entity.draw(bfg, this);
}
bf.show();
}
代码示例来源:origin: stackoverflow.com
private void render(){
BufferStrategy bs = this.getBufferStrategy();
if(bs == null){
this.createBufferStrategy(3);
bs = this.getBufferStrategy(); // reassign bs
}
Graphics g = bs.getDrawGraphics();
g.dispose();
bs.show();
}
代码示例来源:origin: stackoverflow.com
private void render(){
BufferStrategy bs = this.getBufferStrategy();
if(bs == null){
this.createBufferStrategy(3);
return;
}
Graphics g = bs.getDrawGraphics();
g.dispose();
bs.show();
}
代码示例来源:origin: stackoverflow.com
private void draw() {
BufferStrategy bs = this.getBufferStrategy();
if (bs == null) {
this.createBufferStrategy(3);
return;
}
Graphics g = bs.getDrawGraphics();
// Draw your game here, using the g declared above
g.dispose();
bs.show();
}
代码示例来源:origin: stackoverflow.com
//constructor, callback whatever
imageSource = new MemoryImageSource(data.width,data.height,rawdata,0,data.width);
...
//Paint method of a JFrame or what ever ...
...
image img = createImage(imageSource);
setBounds(100,100,img.getWidth(null),img.getHeight(null));
createBufferStrategy(2);
BufferStrategy strategy = getBufferStrategy();
Graphics gr = strategy.getDrawGraphics();
gr.drawImage(img, 0, 0, null);
gr.dispose();
strategy.show();
代码示例来源:origin: stackoverflow.com
public void Draw(){
BufferStrategy bs = this.getBufferStrategy();
if(bs==null){
createBufferStrategy(2);
} else {
Graphics g = bs.getDrawGraphics();
g.setColor(Color.BLACK);
g.fillOval(ball.BallLocationX, ball.BallLocationY, 20, 20);
g.dispose();
bs.show();
}
}
代码示例来源:origin: com.b3dgs.lionengine/lionengine-core-awt
@Override
public void update()
{
buf.show();
graphics.setGraphic(buf.getDrawGraphics());
}
代码示例来源:origin: stackoverflow.com
// Initial setup
Frame mainFrame = new Frame();
mainFrame.setVisible(true); // you'll also want to set size, location, etc.
mainFrame.createBufferStrategy(2);
BufferStrategy bufferStrategy = mainFrame.getBufferStrategy();
//....
// Inside your draw loop (call once for each frame)
Graphics2D g2 = (Graphics2D) bufferStrategy.getDrawGraphics();
g2.drawImage(...) // etc.
g2.dispose();
bufferStrategy.show();
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
private void criarBuffer()
{
createBufferStrategy(2);
buffer = getBufferStrategy();
if (fonteTexto == null)
{
Graphics g = buffer.getDrawGraphics();
fonteTexto = g.getFont();
dimensoesFonte = getFontMetrics(fonteTexto);
g.dispose();
}
}
代码示例来源:origin: com.b3dgs.lionengine/lionengine-core-awt
@Override
public void start()
{
super.start();
setResolution(config.getOutput());
prepareFocusListener();
addDeviceKeyboard();
addDeviceMouse();
buf.show();
graphics.setGraphic(buf.getDrawGraphics());
}
内容来源于网络,如有侵权,请联系作者删除!