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


Java UtilMath類代碼示例

本文整理匯總了Java中com.b3dgs.lionengine.util.UtilMath的典型用法代碼示例。如果您正苦於以下問題:Java UtilMath類的具體用法?Java UtilMath怎麽用?Java UtilMath使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: update

import com.b3dgs.lionengine.util.UtilMath; //導入依賴的package包/類
@Override
public void update(double extrp)
{
    pointer.update(extrp);
    if (pointer.getClick() == 1)
    {
        camera.moveLocation(extrp, -pointer.getMoveX(), pointer.getMoveY());
    }
    else if (pointer.getClick() == 2)
    {
        scale = UtilMath.clamp(scale + pointer.getMoveY() / 100.0, 0.5, 1.42);
        changer.setResolution(source.getScaled(scale, scale));
    }
    super.update(extrp);
    landscape.update(extrp, camera);
    camera.moveLocation(extrp, 0.0, 0.0);
}
 
開發者ID:b3dgs,項目名稱:lionheart-remake,代碼行數:18,代碼來源:World.java

示例2: update

import com.b3dgs.lionengine.util.UtilMath; //導入依賴的package包/類
@Override
public void update(double extrp, int x, int y, double speed)
{
    backcolorA.setOffsetY(y);
    moon.setOffsetY(moonOffset - totalHeight + getOffsetY());
    final double mx = mountain.getOffsetX() + speed * 0.24;
    mountain.setOffsetX(UtilMath.wrapDouble(mx, 0.0, mountainSprite.getWidth()));
    mountain.setOffsetY(y);

    if (flickering)
    {
        flickerCount = (flickerCount + 1) % 2;
        if (flickerCount == 0)
        {
            flickerType = !flickerType;
        }
    }
}
 
開發者ID:b3dgs,項目名稱:lionheart-remake,代碼行數:19,代碼來源:Swamp.java

示例3: waterEffect

import com.b3dgs.lionengine.util.UtilMath; //導入依賴的package包/類
/**
 * Update water effect.
 * 
 * @param g The graphics output.
 * @param speed The effect speed.
 * @param frequency The effect frequency.
 * @param amplitude The effect amplitude.
 * @param offsetForce The offset force.
 */
private void waterEffect(Graphic g, double speed, double frequency, double amplitude, double offsetForce)
{
    final int oy = py + (int) water.getHeight();
    for (int y = screenHeight + getNominal() - UNKNOWN_OFFSET + oy; y < screenHeight; y++)
    {
        final double inside = Math.cos(UtilMath.wrapDouble(y + wx * frequency, 0.0, 360.0)) * amplitude;
        final double outside = Math.cos(wx) * offsetForce;
        g.copyArea(0, y, screenWidth, 1, (int) (inside + outside), 0);
    }
}
 
開發者ID:b3dgs,項目名稱:lionheart-remake,代碼行數:20,代碼來源:Foreground.java

示例4: update

import com.b3dgs.lionengine.util.UtilMath; //導入依賴的package包/類
@Override
public void update(double extrp, int x, int y, double speed)
{
    anim.update(extrp);

    data.setOffsetX(data.getOffsetX() + speed);
    data.setOffsetX(UtilMath.wrapDouble(data.getOffsetX(), 0.0, anim.getTileWidth()));
    data.setOffsetY(y);

    height += water.getSpeed() * extrp;
    height = UtilMath.wrapDouble(height, 0.0, 360.0);
    water.setHeight(Math.sin(height) * water.getDepth());
    py = y;
    wx += WATER_EFFECT_SPEED * extrp;
}
 
開發者ID:b3dgs,項目名稱:lionheart-remake,代碼行數:16,代碼來源:Foreground.java

示例5: update

import com.b3dgs.lionengine.util.UtilMath; //導入依賴的package包/類
@Override
public void update(double extrp)
{
    for (int i = 0; i < layers.length; i++)
    {
        y[i] = UtilMath.wrapDouble(y[i] + speed[i] * extrp, 0, viewer.getHeight());
    }
}
 
開發者ID:b3dgs,項目名稱:tyrian-remake,代碼行數:9,代碼來源:Background.java

示例6: update

import com.b3dgs.lionengine.util.UtilMath; //導入依賴的package包/類
@Override
public void update(double extrp)
{
    if (area != null)
    {
        area.set(UtilMath.getRounded(cursor.getX(), cursor.getWidth()),
                 UtilMath.getRounded(cursor.getY(), cursor.getHeight()),
                 area.getWidthReal(),
                 area.getHeightReal());
    }
}
 
開發者ID:b3dgs,項目名稱:warcraft-remake,代碼行數:12,代碼來源:BuildButton.java

示例7: increaseLevel

import com.b3dgs.lionengine.util.UtilMath; //導入依賴的package包/類
/**
 * Increase weapon level.
 */
public void increaseLevel()
{
    launcher.setLevel(UtilMath.clamp(launcher.getLevel() + 1, 0, Constant.WEAPON_LEVEL_MAX));
}
 
開發者ID:b3dgs,項目名稱:tyrian-remake,代碼行數:8,代碼來源:WeaponUpdater.java


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