You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything works great except if you resize the window. When you resize the window, it doesn't update the viewport width and height. This causes an issue when writing a HUD that is resizable based on window size. This isn't a hard fix but I don't know about for fixing in PeasyCam exactly.
Running the following:
OS: Windows 7 Professional 32 bit
Processing Version: 3.5.4
Processing Mode: java
Here is an example showing the issue as well as the fix. It opens with the bug and then if you resize you will see what the bug does. Then just press the "f" to apply or remove the fix.
import peasy.*;
PeasyCam camera;
int w = 0, h = 0;
boolean fixApplied = false;
void setup() {
size(600, 600, P3D);
surface.setResizable(true);
this.camera = new PeasyCam(this, 500);
registerMethod("pre", this);
}
void pre() {
// HUD Fix... When fix is applied and width or height has changed
if (this.fixApplied && (this.w != this.width || this.h != this.height)) {
this.w = this.width;
this.h = this.height;
this.camera.setViewport(0, 0, this.w, this.h);
this.camera.reset();
}
}
void draw() {
background(100);
fill(255);
box(10);
// Draw GUI
this.camera.beginHUD();
// Hardcode fix for hud not resizing correctly (old) new way is to set viewport ourselves
//ortho(0, width, -height, 0, -Float.MAX_VALUE, +Float.MAX_VALUE);
// Darken Game
fill(25, 25, 25, 180);
stroke(0);
strokeWeight(1.5);
rectMode(RADIUS);
rect(width / 2, height / 2, width * 0.375, height * 0.375, max(width, height) / 30);
// Draw HUD
textSize(21);
fill(180, 180, 180);
text("GUI", width * 0.125 + 20, height * 0.125 + 30);
// TODO
this.camera.endHUD();
}
void keyPressed() {
if (key == 'f')
this.fixApplied = !this.fixApplied;
}
The text was updated successfully, but these errors were encountered:
Everything works great except if you resize the window. When you resize the window, it doesn't update the viewport width and height. This causes an issue when writing a HUD that is resizable based on window size. This isn't a hard fix but I don't know about for fixing in PeasyCam exactly.
Running the following:
OS: Windows 7 Professional 32 bit
Processing Version: 3.5.4
Processing Mode: java
Here is an example showing the issue as well as the fix. It opens with the bug and then if you resize you will see what the bug does. Then just press the "f" to apply or remove the fix.
The text was updated successfully, but these errors were encountered: