當前位置: 首頁>>代碼示例>>Java>>正文


Java Image.setFilter方法代碼示例

本文整理匯總了Java中org.newdawn.slick.Image.setFilter方法的典型用法代碼示例。如果您正苦於以下問題:Java Image.setFilter方法的具體用法?Java Image.setFilter怎麽用?Java Image.setFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.newdawn.slick.Image的用法示例。


在下文中一共展示了Image.setFilter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.newdawn.slick.Image; //導入方法依賴的package包/類
@Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
    mainMenu = new Music("res/menu.ogg");
    click = new Sound("res/menuclick.ogg");
    title = new Image("res/title.png");
    title.setFilter(Image.FILTER_NEAREST);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:8,代碼來源:MainMenu.java

示例2: init

import org.newdawn.slick.Image; //導入方法依賴的package包/類
@Override
public void init(GameContainer arg0, StateBasedGame arg1) throws SlickException {
    player = new Player();
    buildings = new ArrayList<>();
    goons = new ArrayList<>();
    bullets = new ArrayList<>();
    playerImage = new Image("res/player.png");
    playerImage.setFilter(Image.FILTER_NEAREST);
    playerJump = new Image("res/playerjump.png");
    playerJump.setFilter(Image.FILTER_NEAREST);
    cannonImage = new Image("res/cannon.png");
    cannonImage.setFilter(Image.FILTER_LINEAR);
    cannonImage.setCenterOfRotation(Player.CANNON_CENTER_X, Player.CANNON_CENTER_Y);
    SpriteSheet playerSS = new SpriteSheet("res/player_run.png", 60, 75);
    playerRunRight = new Animation(playerSS, RUN_ANIMATION_SPEED);
    playerRunLeft  = new Animation();
    int ssw = playerSS.getHorizontalCount(), ssh = playerSS.getVerticalCount();
    for (int y = 0; y < ssh; y++) {
        for (int x = 0; x < ssw; x++) {
            playerRunLeft.addFrame(playerSS.getSprite(x, y).getFlippedCopy(true, false), RUN_ANIMATION_SPEED);
        }
    }
    bulletAnim = new Animation(new SpriteSheet("res/bullet.png", 30, 30), BULLET_ANIMATION_SPEED);
    buildingTexture = new Image("res/building.png");
    buildingLastRow = buildingTexture.getSubImage(0, buildingTexture.getHeight() - 1, buildingTexture.getWidth(), 1);
    buildingTexture.setFilter(Image.FILTER_NEAREST);
    buildingLastRow.setFilter(Image.FILTER_NEAREST);
    graffitiImages = new Image[NUM_GRAFFITI * 2];
    for (int i = 0; i < NUM_GRAFFITI; i++) {
        graffitiImages[i] = new Image("res/graffiti" + i + ".png");
        graffitiImages[i + NUM_GRAFFITI] = graffitiImages[i].getFlippedCopy(true, false);
    }
    graffiti = new ArrayList<>();
    mainTheme = new Music("res/main.ogg");
    try {
        partsys = ParticleIO.loadConfiguredSystem("res/particle.xml");
    } catch (IOException e) {
        e.printStackTrace();
    }
    fireExplosion = (ConfigurableEmitter)partsys.getEmitter(0);
    blueExplosion = (ConfigurableEmitter)partsys.getEmitter(1);
    fireExplosion.setEnabled(false);
    blueExplosion.setEnabled(false);
    fireCannon = new Sound("res/firecannon.ogg");
    highExplosion = new Sound("res/highexplosion.ogg");
    softExplosion = new Sound("res/softexplosion.ogg");
    hurtSound = new Sound("res/hurt.ogg");
    basicGoon = new Image("res/plasticbag.png");
    strongGoon = new Image("res/trashbag.png");
    flyingGoon = new Animation(new SpriteSheet("res/tshirt.png", 50, 50), 200);
    background = new Image("res/sunset.png");
    background.setFilter(Image.FILTER_NEAREST);
    camx = 0;
    camy = 0;
    camvx = 0;
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:57,代碼來源:Game.java


注:本文中的org.newdawn.slick.Image.setFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。