Suppress more output

master
John 2022-06-20 19:14:34 -07:00
parent f844f0a112
commit 827afb798c
3 changed files with 11 additions and 7 deletions

View File

@ -145,7 +145,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
// load bomb sprites // load bomb sprites
bomb = new BufferedImageWrapper(("img/misc/bomb.png")); bomb = new BufferedImageWrapper(("img/misc/bomb.png"));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); // TODO: remove stack trace e.printStackTrace();
} }
player = new Player(GAME_WIDTH/2, GAME_HEIGHT/2, playerSpriteArray); //create a player controlled player, set start location to middle of screenk player = new Player(GAME_WIDTH/2, GAME_HEIGHT/2, playerSpriteArray); //create a player controlled player, set start location to middle of screenk
// add mouse and keyboard listeners // add mouse and keyboard listeners
@ -187,7 +187,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
try { try {
player.mouseReleased(e); player.mouseReleased(e);
} catch (IOException | SpriteException ex) { } catch (IOException | SpriteException ex) {
throw new RuntimeException(ex); // TODO: remove stack trace throw new RuntimeException(ex);
} }
} }
} }
@ -200,7 +200,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
try { try {
player.mouseDragged(e); player.mouseDragged(e);
} catch (IOException | SpriteException ex) { } catch (IOException | SpriteException ex) {
throw new RuntimeException(ex); // TODO: remove stack throw new RuntimeException(ex);
} }
} }
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
@ -309,7 +309,6 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
// show particles // show particles
for(int i=0; i<particles.size(); i++){ for(int i=0; i<particles.size(); i++){
// todo: find cause of particles being null
if(i<particles.size()&&particles.get(i)!=null) { if(i<particles.size()&&particles.get(i)!=null) {
particles.get(i).draw(g); particles.get(i).draw(g);
particles.get(i).lifeSpan--; particles.get(i).lifeSpan--;
@ -595,7 +594,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
try { try {
// pass key event to player // pass key event to player
player.keyPressed(e); player.keyPressed(e);
} catch (IOException ex) { // TODO: why is IOException raised } catch (IOException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
} }

View File

@ -11,12 +11,18 @@ import java.io.PrintStream;
class Main { class Main {
public static void main(String[] args) { public static void main(String[] args) {
// suppresses output to console // suppresses logging to console
System.setOut(new PrintStream(new OutputStream() { System.setOut(new PrintStream(new OutputStream() {
public void write(int b) { public void write(int b) {
// does nothing // does nothing
} }
})); }));
// suppresses stderr output to console
System.setErr(new PrintStream(new OutputStream() {
public void write(int b) {
// does nothing
}
}));
new GameFrame(); new GameFrame();

View File

@ -69,7 +69,6 @@ public class SettingPanel extends MenuPanel {
} }
oldText = textBoxArray.get(currentBox).text; oldText = textBoxArray.get(currentBox).text;
tip.draw(g, new Color(0, 0, 0, 0), Color.lightGray); tip.draw(g, new Color(0, 0, 0, 0), Color.lightGray);
// TODO: clean up
middlewareIndex = GameFrame.game.middlewareArray.indexOf(new Middleware(Integer.parseInt(textBoxArray.get(currentBox).id), -1)); middlewareIndex = GameFrame.game.middlewareArray.indexOf(new Middleware(Integer.parseInt(textBoxArray.get(currentBox).id), -1));
// -2 was chosen as oldCode instead of -1 to prevent conflicts // -2 was chosen as oldCode instead of -1 to prevent conflicts
textBoxArray.get(currentBox).text += "(" + (middlewareIndex > -1 ? (char)GameFrame.game.middlewareArray.get(middlewareIndex).newCode: textBoxArray.get(currentBox).text += "(" + (middlewareIndex > -1 ? (char)GameFrame.game.middlewareArray.get(middlewareIndex).newCode: