Change drawing pointer
This commit is contained in:
parent
7aef2c15ce
commit
840a695be0
@ -1,6 +1,8 @@
|
||||
package com.annimon.influencexxii;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.GL10;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
@ -13,8 +15,8 @@ import com.badlogic.gdx.math.MathUtils;
|
||||
public class DrawUtils {
|
||||
|
||||
private static final Color[][] pointerColorByMode = {
|
||||
{ new Color(0f, 1f, 0f, 0f), Color.GREEN },
|
||||
{ new Color(1f, 0f, 0f, 0f), Color.RED }
|
||||
{ new Color(0f, 0.2f, 0f, 0f), Color.GREEN },
|
||||
{ new Color(0.2f, 0f, 0f, 0f), Color.RED }
|
||||
};
|
||||
|
||||
public static Color random2Color(int min, int max) {
|
||||
@ -25,17 +27,20 @@ public class DrawUtils {
|
||||
}
|
||||
|
||||
public static void drawPointer(ShapeRenderer renderer, float x, float y, float w, float h, int mode) {
|
||||
renderer.begin(ShapeType.Line);
|
||||
Gdx.gl.glEnable(GL10.GL_BLEND);
|
||||
Gdx.gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
renderer.begin(ShapeType.Filled);
|
||||
Color col1 = pointerColorByMode[mode][0];
|
||||
Color col2 = pointerColorByMode[mode][1];
|
||||
final int size = 4;
|
||||
// Vertical
|
||||
final float h2 = h / 2f;
|
||||
renderer.line(x, 0, x, h2, col1, col2);
|
||||
renderer.line(x, h2, x, h, col2, col1);
|
||||
renderer.rect(x - size, 0, size, h, col1, col2, col2, col1);
|
||||
renderer.rect(x, 0, size, h, col2, col1, col1, col2);
|
||||
// Horizontal
|
||||
final float w2 = w / 2f;
|
||||
renderer.line(0, y, w2, y, col1, col2);
|
||||
renderer.line(w2, y, w, y, col2, col1);
|
||||
renderer.rect(0, y - size, w, size, col1, col1, col2, col2);
|
||||
renderer.rect(0, y, w, size, col2, col2, col1, col1);
|
||||
renderer.end();
|
||||
Gdx.gl.glDisable(GL10.GL_BLEND);
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ public class InfluenceXXII implements ApplicationListener {
|
||||
@Override
|
||||
public void render() {
|
||||
// Clear screen
|
||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||
Gdx.gl.glClearColor(0, 0, 0, 1f);
|
||||
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// Draw enemies
|
||||
|
Loading…
Reference in New Issue
Block a user