Skip to content

Commit bcd149a

Browse files
committed
Remove UpgradeMenu background blur (fixes #24)
1 parent 7fba5d4 commit bcd149a

3 files changed

Lines changed: 2 additions & 53 deletions

File tree

manifest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Manifest-Version: 1.0
22
Main-Class: Main.Main
33
Implementation-Title: Elevator Simulator
4-
Implementation-Version: 1.0.0
4+
Implementation-Version: 1.0.1
55
Implementation-Vendor: nishoof
66
Created-By: makeExecutable.sh
77
Built-By: nishoof

src/Elements/UpgradeMenu.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,8 @@ public void draw(PApplet d) {
6262
// Save original settings
6363
d.push();
6464

65-
// Blur area behind panel
66-
Main.blur(d, currX, y, width, height, 2.5F);
67-
6865
// Draw Rect
69-
d.fill(250, 200F);
66+
d.fill(250, 230F);
7067
d.stroke(0);
7168
d.strokeWeight(3);
7269
d.rect(currX, y, width, height, 8);

src/Main/Main.java

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import Screens.Screen;
1111
import processing.core.PApplet;
1212
import processing.core.PConstants;
13-
import processing.core.PGraphics;
1413

1514
public class Main extends PApplet implements ButtonListener {
1615

@@ -168,51 +167,4 @@ public static void drawGameTitle(PApplet d) {
168167
d.pop(); // Restore original settings
169168
}
170169

171-
/**
172-
* Blurs the existing drawing on the screen within the specified rectangle
173-
*
174-
* @param d PApplet
175-
* @param x x-coordinate of the top-left corner of the rectangle
176-
* @param y y-coordinate of the top-left corner of the rectangle
177-
* @param width width of the rectangle
178-
* @param height height of the rectangle
179-
* @param blurStrength strength of the blur
180-
*/
181-
public static void blur(PApplet d, int x, int y, int width, int height, float blurStrength) {
182-
float deadSpaceX = d.width - d.rwidth * d.ratioScale;
183-
float deadSpaceY = d.height - d.rheight * d.ratioScale;
184-
int realX = (int) ((1.0 * x * d.ratioScale) + (deadSpaceX / 2));
185-
int realY = (int) ((1.0 * y * d.ratioScale) + (deadSpaceY / 2));
186-
int realWidth = (int) (width * d.ratioScale);
187-
int realHeight = (int) (height * d.ratioScale);
188-
189-
PGraphics g = d.createGraphics(realWidth, realHeight);
190-
g.beginDraw();
191-
g.loadPixels();
192-
193-
d.loadPixels();
194-
int graphicsIndex = 0;
195-
196-
for (int pixY = 0; pixY < realHeight; pixY++) {
197-
for (int pixX = 0; pixX < realWidth; pixX++) {
198-
g.pixels[graphicsIndex] = getPixel(d, realX + pixX, realY + pixY);
199-
graphicsIndex++;
200-
}
201-
}
202-
d.updatePixels();
203-
204-
g.updatePixels();
205-
g.filter(PConstants.BLUR, blurStrength);
206-
g.endDraw();
207-
d.image(g, x, y, width, height);
208-
}
209-
210-
private static int getPixel(PApplet d, int x, int y) {
211-
int i = y * d.pixelWidth + x;
212-
if (i < 0 || i >= d.pixels.length) {
213-
return -1;
214-
}
215-
return d.pixels[i];
216-
}
217-
218170
}

0 commit comments

Comments
 (0)