Permalink
Browse files

More experimenting with scaled avatars, still needs a lot of work

  • Loading branch information...
rictic committed Oct 28, 2008
1 parent 106fa56 commit 019c55cfbe7240e2ff3ff79d1d385129cea66780
Showing with 12 additions and 9 deletions.
  1. +1 −1 defaults/code_swarm.config
  2. +11 −8 src/code_swarm.java
@@ -107,4 +107,4 @@ AvatarFetcher=GravatarFetcher
GravatarFallback=identicon
#Size in pixels of the width and height of avatar images
-AvatarSize=120
+AvatarSize=80
View
@@ -1488,22 +1488,25 @@ public void draw() {
if (isAlive()) {
textAlign(CENTER, CENTER);
+ PFont curFont = font;
+ if (life >= minBold)
+ curFont = boldFont;
+ textFont(curFont);
+
/** TODO: proportional font size, or light intensity,
or some sort of thing to disable the flashing */
+ float pctAlive = ((float)life)/PERSON_LIFE_INIT;
int size = 1;
if (icon != null){
colorMode(RGB);
- tint(255,255,255,max(0,life-80));
- size = (int)(avatarFetcher.size * (((float)life)/PERSON_LIFE_INIT));
- radius = (int)(sqrt(pow(size,2) * 2)/ 2) ;
+ tint(255,255,255,max(0,255 * pctAlive));
+ size = (int)(avatarFetcher.size * pctAlive);
+ radius = (int)(sqrt(pow(size+curFont.ascent,2) * 2)/ 2);
drawImage(icon, mPosition.x-(size / 2), mPosition.y-(size/2), size, size);
}
- textFont(font);
- if (life >= minBold)
- textFont(boldFont);
- fill(fontColor, life);
- text(name, mPosition.x, mPosition.y+(size / 2));
+ fill(fontColor, 255 * pctAlive);
+ text(name, mPosition.x, mPosition.y+(size / 2) + curFont.ascent);
}
}

0 comments on commit 019c55c

Please sign in to comment.