Asdded a build menu to the hud and fixed some color isues with the new ProgressBar class

This commit is contained in:
Ziver Koc 2007-04-23 20:58:24 +00:00
parent d1a2aa8b4e
commit 2cf489403d
10 changed files with 593 additions and 1168 deletions

View file

@ -52,7 +52,7 @@ public class BitmapText extends Entity{
* Render the text
*/
public void render(){
if(text != null && !text.isEmpty()){
if(text != null && !text.equals("")){
// store the current model matrix
GL11.glPushMatrix();

View file

@ -108,7 +108,7 @@ public class Particles extends Entity{
private void init() {
for (int i=0;i<maxParticles;i++){ // Initials All The Textures
particle[i].active = true; // Make All The Particles Active
particle[i].life = life; // Give All The Particles Full Life
particle[i].life = (float) (Math.random()*(life+0.7f)); // Give All The Particles Full Life
particle[i].fade = ((float)(Math.random() * 100.0)) / 1000.0f + 0.003f; // Random Fade Speed
particle[i].r = colors[i * (colors.length / maxParticles)][0][0]; // Select Red Rainbow Color
particle[i].g = colors[i * (colors.length / maxParticles)][0][1]; // Select Red Rainbow Color

View file

@ -14,6 +14,7 @@ public class ProgressBar{
private int max;
private float width;
private float height;
private Vector4f[] valueColor = new Vector4f[100];
/**
* Creates a selection box with health bar
@ -48,6 +49,13 @@ public class ProgressBar{
bar.getTexture().setColor(c);
}
public void setValueColor(int procent, Vector4f c){
procent--;
if(procent >= 0 && procent <= 99){
valueColor[procent] = c;
}
}
public Node getNode(){
return progressNode;
}
@ -61,14 +69,13 @@ public class ProgressBar{
value.setSize(new Vector2f(((float)v/max)*width,height));//(v/max)*width
value.setLocation(new Vector2f(-width/2+(((float)v/max)*width)/2,0));
if(((float)v/max) < 0.15f){
value.getTexture().setColor(new Vector4f(1.0f, 0f, 0f, 0.6f));
}
else if(((float)v/max) < 0.50f){
value.getTexture().setColor(new Vector4f(1.0f, .95f, 0, 0.6f));
}
else{
value.getTexture().setColor(new Vector4f(0.3f, 1.0f, 0.3f, 0.6f));
System.out.println("lol"+((float)v/max));
for(int i=0; i<valueColor.length ;i++){
if(valueColor[i] != null && ((float)v/max) < (float)i/100){
System.out.println("lol"+((float)v/max));
value.getTexture().setColor(valueColor[i]);
break;
}
}
}