当前位置: 首页>>代码示例>>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;未经允许,请勿转载。