本文整理汇总了Java中com.badlogic.gdx.math.MathUtils.cosDeg方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtils.cosDeg方法的具体用法?Java MathUtils.cosDeg怎么用?Java MathUtils.cosDeg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.math.MathUtils
的用法示例。
在下文中一共展示了MathUtils.cosDeg方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Update
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
@Override
public void Update() {
if (!oldIsSelected) {
renderer.image.setColor(0.18f, 0.18f, 0.18f, 1);
mEffectTimer = 0;
oldIsSelected = isSelected;
return;
}
float colorFactor = MathUtils.cosDeg(mEffectTimer * 5) * 0.2f + 0.8f;
renderer.image.setColor(colorFactor, colorFactor, colorFactor, 1);
mEffectTimer++;
if (Gdx.input.isKeyJustPressed(KeySettings.positiveKey) && onPressAction != null) {
onPressAction.run();
}
else if (Gdx.input.isKeyJustPressed(KeySettings.up) && linkedNode.previous != null) {
isSelected = false;
linkedNode.previous.data.isSelected = true;
}
else if (Gdx.input.isKeyJustPressed(KeySettings.down) && linkedNode.next != null) {
isSelected = false;
linkedNode.next.data.isSelected = true;
}
oldIsSelected = isSelected;
}
示例2: cos
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
/**
* //use degress
Rotation, equals
cos(angle) sin(angle) 0
-sin(angle) cos(angle) 0 * AffineTransform
0 0 1
*/
public static final AffineTransform AffineTransformRotate(final AffineTransform t, float anAngle, AffineTransform out) {
float sine = MathUtils.sinDeg(anAngle);
float cosine = MathUtils.cosDeg(anAngle);
return AffineTransformMakeOut(t.a * cosine + t.c * sine,
t.b * cosine + t.d * sine,
t.c * cosine - t.a * sine,
t.d * cosine - t.b * sine,
t.tx,
t.ty, out);
}
示例3: progress
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
public void progress(float cx, float cy, float r, float thickness, float amt, Color c, Texture lookup) {
//start and end angles
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z);
}
renderer.end();
}
示例4: progress
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
public void progress(float cx, float cy, float r, float thickness, float amt, Color c, Texture lookup) {
//start and end angles
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
//renderer.
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z);
}
renderer.end();
}
示例5: renderCercle
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
public void renderCercle(OrthographicCamera camera,float amt, Color c){
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(camera.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
//renderer.
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z);
}
renderer.end();
}
示例6: apply
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
@Override
protected int apply (float[] vertices, int vertexStartingIndex, AttributeOffsets offsets, int vertexSize) {
super.apply(vertices, vertexStartingIndex, offsets, vertexSize);
final PolygonRegion region = this.region;
final TextureRegion tRegion = region.getRegion();
final float originX = this.originX;
final float originY = this.originY;
final float scaleX = this.scaleX;
final float scaleY = this.scaleY;
final float[] regionVertices = region.getVertices();
final float worldOriginX = x + originX;
final float worldOriginY = y + originY;
final float sX = width / tRegion.getRegionWidth();
final float sY = height / tRegion.getRegionHeight();
final float cos = MathUtils.cosDeg(rotation);
final float sin = MathUtils.sinDeg(rotation);
float fx, fy;
for (int i = 0, v = vertexStartingIndex + offsets.position, n = regionVertices.length; i < n; i += 2, v += vertexSize) {
fx = (regionVertices[i] * sX - originX) * scaleX;
fy = (regionVertices[i + 1] * sY - originY) * scaleY;
vertices[v] = cos * fx - sin * fy + worldOriginX;
vertices[v + 1] = sin * fx + cos * fy + worldOriginY;
}
return numVertices;
}
示例7: renderCercleRecharge
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
public void renderCercleRecharge(OrthographicCamera camera,float amt, Color c){
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(camera.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
//renderer.
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(c1x + fx * (r + halfThick), c1y + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(c1x + fx * (r + -halfThick), c1y + fy * (r + -halfThick), z);
}
renderer.end();
}