Game.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:SuperSquirrel 作者:
private void render() {
    BufferStrategy bs = this.getBufferStrategy();
    if (bs == null) {
        this.createBufferStrategy(3);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    Graphics2D g2d = (Graphics2D) g;

    /////////// Drawing begins;
    g.setColor(new Color(25, 191, 224));  // background color
    g.fillRect(0, 0, getWidth(), getHeight()); // Fill
    for (int i = 0; i < (level.getWidth() * scale) / (tex.cloud.getWidth() / 2); i++) { // Clouds
        g.drawImage(tex.cloud, (int)-cam.getX()/2 + ((tex.cloud.getWidth()/3) * i), (i % 3) * (i % 4) * 10, tex.cloud.getWidth()/2, tex.cloud.getHeight()/2, null);
    }
    g2d.translate(-cam.getX(), -cam.getY()); // Cam Begins 
    handler.render(g); // Object rendering
    g2d.translate(cam.getX(), cam.getY()); // Cam Ends

    hud.render(g); // Draw HUD
    /////////// Drawing ends;

    g.dispose();
    bs.show();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号