Permalink
Browse files

Fixed bug where background does not clear when scattering particles i…

…f path trail is fully visible
  • Loading branch information...
1 parent 1f90dc2 commit 587e6532efd188ebb8d7b026ce0ae26ef1104c7e @muraliavarma committed Feb 6, 2013
Binary file not shown.
@@ -86,6 +86,13 @@ public void draw() {
drawCreatures();
}
+public void clearBackground() {
+ int temp = backgroundAlpha;
+ backgroundAlpha = 255;
+ draw();
+ backgroundAlpha = temp;
+}
+
public void keyPressed() {
//simulation
if (key == 'q') {
@@ -101,6 +108,7 @@ else if(key == 'w') {
//commands
if (key == 's' || key == 'S') {
+ clearBackground();
for (int i = 0; i < NUM_CREATURES; i++) {
creatures[i].init();
}
@@ -118,10 +126,7 @@ else if(key == 'w') {
}
if (key == 'c' || key == 'C') {
- int temp = backgroundAlpha;
- backgroundAlpha = 255;
- draw();
- backgroundAlpha = temp;
+ clearBackground();
}
//forces
@@ -71,6 +71,13 @@ void draw() {
drawCreatures();
}
+void clearBackground() {
+ int temp = backgroundAlpha;
+ backgroundAlpha = 255;
+ draw();
+ backgroundAlpha = temp;
+}
+
void keyPressed() {
//simulation
if (key == 'q') {
@@ -86,6 +93,7 @@ void keyPressed() {
//commands
if (key == 's' || key == 'S') {
+ clearBackground();
for (int i = 0; i < NUM_CREATURES; i++) {
creatures[i].init();
}
@@ -103,10 +111,7 @@ void keyPressed() {
}
if (key == 'c' || key == 'C') {
- int temp = backgroundAlpha;
- backgroundAlpha = 255;
- draw();
- backgroundAlpha = temp;
+ clearBackground();
}
//forces

0 comments on commit 587e653

Please sign in to comment.