From b86d22d573e40fc5c6385743cc8d09f03200383f Mon Sep 17 00:00:00 2001 From: BatistaCakewalk <118333712+BatistaCakewalk@users.noreply.github.com> Date: Sun, 1 Mar 2026 14:09:15 -0500 Subject: [PATCH 1/6] sim --- .../storming/core/EngineLauncher.java | 47 +++++++---- .../storming/ui/windows/MainWindow.java | 3 +- .../storming/ui/windows/SimulationWindow.java | 73 +++++++++++++++++- .../com/parafield/storming/icons/png/pin.png | Bin 0 -> 3735 bytes .../com/parafield/storming/icons/svg/pin.svg | 7 ++ 5 files changed, 112 insertions(+), 18 deletions(-) create mode 100644 src/main/resources/com/parafield/storming/icons/png/pin.png create mode 100644 src/main/resources/com/parafield/storming/icons/svg/pin.svg diff --git a/src/main/java/com/parafield/storming/core/EngineLauncher.java b/src/main/java/com/parafield/storming/core/EngineLauncher.java index 55df4ce..bd1e79c 100644 --- a/src/main/java/com/parafield/storming/core/EngineLauncher.java +++ b/src/main/java/com/parafield/storming/core/EngineLauncher.java @@ -2,27 +2,49 @@ import java.io.BufferedReader; import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; import java.util.function.Consumer; /** * Responsible for launching and managing the Storming Engine process. - * Handles process lifecycle, shared memory arguments, and output logging. + * Handles process lifecycle, shared memory arguments, and broadcasting output to multiple listeners. */ public class EngineLauncher { private final String enginePath; - private final Consumer logConsumer; + private final List> logListeners = new ArrayList<>(); private Process currentProcess; /** * Constructs a new EngineLauncher. * * @param enginePath The file path to the engine executable. - * @param logConsumer A callback for handling engine log messages. */ - public EngineLauncher(String enginePath, Consumer logConsumer) { + public EngineLauncher(String enginePath) { this.enginePath = enginePath; - this.logConsumer = logConsumer; + } + + /** + * Adds a listener to receive engine log messages. + * @param listener The callback to add. + */ + public void addLogListener(Consumer listener) { + logListeners.add(listener); + } + + /** + * Removes a log listener. + * @param listener The callback to remove. + */ + public void removeLogListener(Consumer listener) { + logListeners.remove(listener); + } + + private void broadcast(String message) { + for (Consumer listener : new ArrayList<>(logListeners)) { + listener.accept(message); + } } /** @@ -39,17 +61,16 @@ public boolean isRunning() { */ public void stop() { if (isRunning()) { - logConsumer.accept("[System] Stopping Engine..."); + broadcast("[System] Stopping Engine..."); currentProcess.destroy(); try { - // Give it a moment to shut down gracefully before forcing if (!currentProcess.waitFor(2, java.util.concurrent.TimeUnit.SECONDS)) { currentProcess.destroyForcibly(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } - logConsumer.accept("[System] Engine Stopped."); + broadcast("[System] Engine Stopped."); } } @@ -62,7 +83,7 @@ public void launch() { /** * Launches the engine process with an optional shared memory name. - * Starts the engine in a separate thread and captures its output. + * Starts the engine in a separate thread and broadcasts its output. * * @param shmName The shared memory name to pass as an argument. */ @@ -71,7 +92,7 @@ public void launch(String shmName) { return; } - logConsumer.accept("Launching Storming Engine..."); + broadcast("Launching Storming Engine..."); new Thread(() -> { try { ProcessBuilder pb; @@ -87,13 +108,13 @@ public void launch(String shmName) { BufferedReader reader = new BufferedReader(new InputStreamReader(currentProcess.getInputStream())); String line; while ((line = reader.readLine()) != null) { - logConsumer.accept(line); + broadcast(line); } int exitCode = currentProcess.waitFor(); - logConsumer.accept("[System] Engine exited with code: " + exitCode); + broadcast("[System] Engine exited with code: " + exitCode); } catch (Exception ex) { - logConsumer.accept("[Error] Failed to launch: " + ex.getMessage()); + broadcast("[Error] Failed to launch: " + ex.getMessage()); } }).start(); } diff --git a/src/main/java/com/parafield/storming/ui/windows/MainWindow.java b/src/main/java/com/parafield/storming/ui/windows/MainWindow.java index f8170f9..4d2db58 100644 --- a/src/main/java/com/parafield/storming/ui/windows/MainWindow.java +++ b/src/main/java/com/parafield/storming/ui/windows/MainWindow.java @@ -93,7 +93,8 @@ public MainWindow() { rootPane.putClientProperty("flatlaf.showWindowIcon", false); consolePanel = new ConsolePanel(); - engineLauncher = new EngineLauncher("Engine/2D/build/bin/StormingEngine", consolePanel::log); + engineLauncher = new EngineLauncher("Engine/2D/build/bin/StormingEngine"); + engineLauncher.addLogListener(consolePanel::log); initUI(); diff --git a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java index cff2200..b4f2af2 100644 --- a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java +++ b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java @@ -3,6 +3,7 @@ import com.formdev.flatlaf.FlatClientProperties; import com.parafield.storming.Icons; import com.parafield.storming.core.EngineLauncher; +import com.parafield.storming.ui.panels.ConsolePanel; import com.parafield.storming.ui.panels.SceneViewPanel; import com.parafield.storming.ui.utils.UIAnimator; import com.parafield.storming.ui.utils.UIUtils; @@ -13,26 +14,29 @@ /** * An advanced simulation window with a Godot-inspired aesthetic. * Features a pulsating "LIVE" indicator, real-time resource tracking, - * and smooth entrance animations for a high-end feel. + * always-on-top toggle, resolution scaling, and an integrated mini-console. */ public class SimulationWindow extends JFrame { private final SceneViewPanel viewport; private final EngineLauncher launcher; + private final ConsolePanel consolePanel; private AlphaPanel header; private AlphaPanel footer; private JLabel liveIndicator; private JLabel memLabel; private JProgressBar memBar; + private JSplitPane splitPane; private boolean isPaused = false; + private int consoleLastHeight = 180; public SimulationWindow(EngineLauncher launcher) { this.launcher = launcher; setTitle("Storming Engine - Simulation (DEBUG)"); - setSize(1280, 720); + setSize(1280, 850); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); @@ -46,9 +50,21 @@ public SimulationWindow(EngineLauncher launcher) { header = createHeader(); root.add(header, BorderLayout.NORTH); + // Viewport and Console Split viewport = new SceneViewPanel(); viewport.setToolbarVisible(false); - root.add(viewport, BorderLayout.CENTER); + + consolePanel = new ConsolePanel(); + consolePanel.setPreferredSize(new Dimension(0, 0)); // Start hidden + launcher.addLogListener(consolePanel::log); + + splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, viewport, consolePanel); + splitPane.setDividerSize(3); + splitPane.setDividerLocation(850); + splitPane.setBorder(null); + splitPane.setResizeWeight(1.0); + + root.add(splitPane, BorderLayout.CENTER); footer = createFooter(); root.add(footer, BorderLayout.SOUTH); @@ -72,6 +88,7 @@ private AlphaPanel createHeader() { p.setBackground(new Color(30, 30, 35)); p.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(60, 60, 65))); + // Left: Project Info JPanel left = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 8)); left.setOpaque(false); @@ -93,6 +110,7 @@ private AlphaPanel createHeader() { left.add(badge); p.add(left, BorderLayout.WEST); + // Center: Controls JPanel center = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4)); center.setOpaque(false); @@ -110,7 +128,30 @@ private AlphaPanel createHeader() { center.add(stopBtn); p.add(center, BorderLayout.CENTER); - p.add(Box.createHorizontalStrut(150), BorderLayout.EAST); + // Right: Utilities (Always on Top, Resolution) + JPanel right = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 6)); + right.setOpaque(false); + + // Resolution Selector + JComboBox resCombo = new JComboBox<>(new String[]{"Auto", "1920x1080", "1280x720", "800x600"}); + resCombo.putClientProperty(FlatClientProperties.STYLE, "background: #00000000; borderWidth: 0; focusWidth: 0;"); + resCombo.setFont(UIUtils.getFont(Font.PLAIN, 11f)); + resCombo.setPreferredSize(new Dimension(100, 26)); + right.add(resCombo); + + JSeparator sep = new JSeparator(JSeparator.VERTICAL); + sep.setPreferredSize(new Dimension(2, 20)); + right.add(sep); + + // Always on Top Toggle + JToggleButton onTopBtn = new JToggleButton(Icons.MAGNET); + onTopBtn.setToolTipText("Always on Top"); + onTopBtn.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON); + onTopBtn.setPreferredSize(new Dimension(30, 30)); + onTopBtn.addActionListener(e -> setAlwaysOnTop(onTopBtn.isSelected())); + right.add(onTopBtn); + + p.add(right, BorderLayout.EAST); return p; } @@ -120,14 +161,23 @@ private AlphaPanel createFooter() { p.setBackground(new Color(25, 25, 30)); p.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(50, 50, 55))); + // Left: Engine Stats & Console Toggle JPanel left = new JPanel(new FlowLayout(FlowLayout.LEFT, 12, 4)); left.setOpaque(false); + + JButton consoleToggle = new JButton("Console", Icons.CONSOLE); + consoleToggle.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON); + consoleToggle.setFont(UIUtils.getFont(Font.BOLD, 10f)); + consoleToggle.addActionListener(e -> toggleConsole()); + left.add(consoleToggle); + JLabel stats = new JLabel("60 FPS | 16.6ms | OpenGL 4.5 Core"); stats.setFont(UIUtils.getFont(Font.PLAIN, 10f)); stats.setForeground(new Color(150, 150, 150)); left.add(stats); p.add(left, BorderLayout.WEST); + // Right: Memory Monitor JPanel right = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 4)); right.setOpaque(false); @@ -149,6 +199,16 @@ private AlphaPanel createFooter() { return p; } + private void toggleConsole() { + boolean isVisible = consolePanel.getHeight() > 50; + if (isVisible) { + consoleLastHeight = consolePanel.getHeight(); + UIAnimator.animateSplitTrailing(splitPane, 0, 250); + } else { + UIAnimator.animateSplitTrailing(splitPane, consoleLastHeight, 250); + } + } + private void togglePause() { isPaused = !isPaused; liveIndicator.setText(isPaused ? "● PAUSED" : "●"); @@ -201,6 +261,7 @@ private void restartSimulation() { } private void closeAndStop() { + launcher.removeLogListener(consolePanel::log); launcher.stop(); dispose(); } @@ -210,12 +271,16 @@ public void startSimulation() { footer.setAlpha(0.0f); setVisible(true); + // Initial console state: closed + splitPane.setDividerLocation(getHeight()); + UIAnimator.animate(0.0f, 1.0f, 500, a -> { header.setAlpha(a); footer.setAlpha(a); }, null); String shmName = "/storming_shm_" + System.currentTimeMillis(); + // Route engine logs to the local console panel launcher.launch(shmName); viewport.startStreaming(shmName); } diff --git a/src/main/resources/com/parafield/storming/icons/png/pin.png b/src/main/resources/com/parafield/storming/icons/png/pin.png new file mode 100644 index 0000000000000000000000000000000000000000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|r7pdQOl>K?vg7RprAX0c#=JwRGxC!YK)(goTP5go=l*-_gn%Fr! zzh?4}*R!L{%R8%Rk&6h^$f)f;IQNL`qV;$US=k?|ab$-2xfL{85tH|9_p-vwaK;@2 zE0JF1sbvX`8I_|Zzl~+ubH;lbR?n%8Du3+=(fOEhNikK zj^ClnPgp%3RhH4R@G0X=c~{XUfQ66FtgadWs}sf^0sEo?F8$YcUpjQ?+)bJ3E_)JB|hAVftd;8<#O*G@>Vvj zgo!4RZ4Ld#k(dpSjs~IXgDZ{CD<2w&M9AKDz)BoT7!d^YpKTlKiLvF#n zq|0lb80mNu^5|HMnZ%F5w-QAU&N1TNgvh>Y_5r^W*@(WtCJKDs^p;^19Z+))8r=>H zxQ#tmCUiGOAjn~>+Q7{6Q^qG(+ytw8EOL>lvtES;rDy*Z<&EKceYd`89X;~K=^{=; zR2s6Oy(rPWuiUpf#~wfyGqWZ&Gur58R>U8Z6VtZD;}XVQGYfx5It|`V&8_WpT$wP~ z$Ozz#dGo1Gnwj5Tl!jyuVrOhjHEBKtA9S + + + + + + \ No newline at end of file From f9d2e875faea586df6c97353a129ff016a03ef67 Mon Sep 17 00:00:00 2001 From: BatistaCakewalk <118333712+BatistaCakewalk@users.noreply.github.com> Date: Sun, 1 Mar 2026 14:34:41 -0500 Subject: [PATCH 2/6] sim --- .../java/com/parafield/storming/Icons.java | 5 + .../storming/ui/windows/SimulationWindow.java | 236 ++++++++++++++++-- .../parafield/storming/icons/png/camera.png | Bin 0 -> 4804 bytes .../storming/icons/png/fullscreen.png | Bin 0 -> 2749 bytes .../storming/icons/png/performance.png | Bin 0 -> 5161 bytes .../parafield/storming/icons/svg/camera.svg | 7 + .../storming/icons/svg/fullscreen.svg | 7 + .../storming/icons/svg/performance.svg | 7 + 8 files changed, 241 insertions(+), 21 deletions(-) create mode 100644 src/main/resources/com/parafield/storming/icons/png/camera.png create mode 100644 src/main/resources/com/parafield/storming/icons/png/fullscreen.png create mode 100644 src/main/resources/com/parafield/storming/icons/png/performance.png create mode 100644 src/main/resources/com/parafield/storming/icons/svg/camera.svg create mode 100644 src/main/resources/com/parafield/storming/icons/svg/fullscreen.svg create mode 100644 src/main/resources/com/parafield/storming/icons/svg/performance.svg diff --git a/src/main/java/com/parafield/storming/Icons.java b/src/main/java/com/parafield/storming/Icons.java index 2a41823..ae4415c 100644 --- a/src/main/java/com/parafield/storming/Icons.java +++ b/src/main/java/com/parafield/storming/Icons.java @@ -107,4 +107,9 @@ private static ImageIcon loadIcon(String name, int width, int height) { public static final ImageIcon CLIPBOARD = loadIcon("clipboard", 16, 16); public static final ImageIcon RESTART = loadIcon("restart", 23, 23); public static final ImageIcon PAUSE = loadIcon("pause", 23, 23); + public static final ImageIcon PIN = loadIcon("pin", 18, 18); + public static final ImageIcon CAMERA = loadIcon("camera", 18, 18); + public static final ImageIcon FULLSCREEN = loadIcon("fullscreen", 18, 18); + public static final ImageIcon STRUCTURE = loadIcon("Structure", 18, 18); + public static final ImageIcon PERFORMANCE = loadIcon("performance", 18, 18); } diff --git a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java index b4f2af2..2282547 100644 --- a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java +++ b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java @@ -10,6 +10,10 @@ import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; +import java.awt.geom.Area; +import java.awt.geom.Path2D; +import java.util.ArrayList; +import java.util.List; /** * An advanced simulation window with a Godot-inspired aesthetic. @@ -50,12 +54,11 @@ public SimulationWindow(EngineLauncher launcher) { header = createHeader(); root.add(header, BorderLayout.NORTH); - // Viewport and Console Split viewport = new SceneViewPanel(); viewport.setToolbarVisible(false); consolePanel = new ConsolePanel(); - consolePanel.setPreferredSize(new Dimension(0, 0)); // Start hidden + consolePanel.setPreferredSize(new Dimension(0, 0)); launcher.addLogListener(consolePanel::log); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, viewport, consolePanel); @@ -88,7 +91,6 @@ private AlphaPanel createHeader() { p.setBackground(new Color(30, 30, 35)); p.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(60, 60, 65))); - // Left: Project Info JPanel left = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 8)); left.setOpaque(false); @@ -110,7 +112,6 @@ private AlphaPanel createHeader() { left.add(badge); p.add(left, BorderLayout.WEST); - // Center: Controls JPanel center = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4)); center.setOpaque(false); @@ -128,11 +129,9 @@ private AlphaPanel createHeader() { center.add(stopBtn); p.add(center, BorderLayout.CENTER); - // Right: Utilities (Always on Top, Resolution) JPanel right = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 6)); right.setOpaque(false); - // Resolution Selector JComboBox resCombo = new JComboBox<>(new String[]{"Auto", "1920x1080", "1280x720", "800x600"}); resCombo.putClientProperty(FlatClientProperties.STYLE, "background: #00000000; borderWidth: 0; focusWidth: 0;"); resCombo.setFont(UIUtils.getFont(Font.PLAIN, 11f)); @@ -143,41 +142,50 @@ private AlphaPanel createHeader() { sep.setPreferredSize(new Dimension(2, 20)); right.add(sep); - // Always on Top Toggle - JToggleButton onTopBtn = new JToggleButton(Icons.MAGNET); + JButton screenshotBtn = createHeaderBtn(Icons.CAMERA, "Take Screenshot (F12)"); + screenshotBtn.addActionListener(e -> JOptionPane.showMessageDialog(this, "Screenshot saved to /screenshots/")); + right.add(screenshotBtn); + + JToggleButton onTopBtn = new JToggleButton(Icons.PIN); onTopBtn.setToolTipText("Always on Top"); onTopBtn.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON); onTopBtn.setPreferredSize(new Dimension(30, 30)); onTopBtn.addActionListener(e -> setAlwaysOnTop(onTopBtn.isSelected())); right.add(onTopBtn); + JButton fsBtn = createHeaderBtn(Icons.FULLSCREEN, "Toggle Fullscreen (F11)"); + right.add(fsBtn); + p.add(right, BorderLayout.EAST); return p; } private AlphaPanel createFooter() { AlphaPanel p = new AlphaPanel(new BorderLayout()); - p.setPreferredSize(new Dimension(0, 26)); + p.setPreferredSize(new Dimension(0, 28)); p.setBackground(new Color(25, 25, 30)); p.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(50, 50, 55))); - // Left: Engine Stats & Console Toggle - JPanel left = new JPanel(new FlowLayout(FlowLayout.LEFT, 12, 4)); + JPanel left = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0)); left.setOpaque(false); JButton consoleToggle = new JButton("Console", Icons.CONSOLE); consoleToggle.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON); consoleToggle.setFont(UIUtils.getFont(Font.BOLD, 10f)); + consoleToggle.setPreferredSize(new Dimension(85, 28)); consoleToggle.addActionListener(e -> toggleConsole()); left.add(consoleToggle); - JLabel stats = new JLabel("60 FPS | 16.6ms | OpenGL 4.5 Core"); + JSeparator sep = new JSeparator(JSeparator.VERTICAL); + sep.setPreferredSize(new Dimension(2, 14)); + left.add(sep); + + JLabel stats = new JLabel(" 60 FPS | 16.6ms | OpenGL 4.5 Core"); stats.setFont(UIUtils.getFont(Font.PLAIN, 10f)); stats.setForeground(new Color(150, 150, 150)); left.add(stats); p.add(left, BorderLayout.WEST); - // Right: Memory Monitor JPanel right = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 4)); right.setOpaque(false); @@ -191,14 +199,26 @@ private AlphaPanel createFooter() { memBar.setBackground(new Color(40, 40, 45)); memBar.setBorder(null); + JButton perfBtn = new JButton(Icons.PERFORMANCE); + perfBtn.setToolTipText("Performance Monitor"); + perfBtn.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON); + perfBtn.setPreferredSize(new Dimension(24, 24)); + perfBtn.addActionListener(e -> showPerformanceDetails()); + right.add(memLabel); right.add(memBar); + right.add(Box.createHorizontalStrut(2)); + right.add(perfBtn); right.add(Box.createHorizontalStrut(5)); p.add(right, BorderLayout.EAST); return p; } + private void showPerformanceDetails() { + new PerformanceMonitorDialog(this).setVisible(true); + } + private void toggleConsole() { boolean isVisible = consolePanel.getHeight() > 50; if (isVisible) { @@ -270,19 +290,14 @@ public void startSimulation() { header.setAlpha(0.0f); footer.setAlpha(0.0f); setVisible(true); - - // Initial console state: closed splitPane.setDividerLocation(getHeight()); - UIAnimator.animate(0.0f, 1.0f, 500, a -> { header.setAlpha(a); footer.setAlpha(a); }, null); - - String shmName = "/storming_shm_" + System.currentTimeMillis(); - // Route engine logs to the local console panel - launcher.launch(shmName); - viewport.startStreaming(shmName); + String shm = "/storming_shm_" + System.currentTimeMillis(); + launcher.launch(shm); + viewport.startStreaming(shm); } private static class AlphaPanel extends JPanel { @@ -297,4 +312,183 @@ public void paint(Graphics g) { g2.dispose(); } } + + /** + * Highly visual performance monitor with hardware detection and area graphs. + */ + private static class PerformanceMonitorDialog extends JDialog { + private final Timer updateTimer; + private final List fpsHistory = new ArrayList<>(); + private final List memHistory = new ArrayList<>(); + private final GraphPanel fpsGraph; + private final GraphPanel memGraph; + + public PerformanceMonitorDialog(Frame owner) { + super(owner, "Performance Monitor", false); + setSize(550, 650); + setLocationRelativeTo(owner); + + JPanel main = new JPanel(); + main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); + main.setBorder(new EmptyBorder(25, 25, 25, 25)); + main.setBackground(new Color(25, 25, 30)); + + // hardware Section + main.add(createSection("Hardware & System", createHardwareGrid())); + main.add(Box.createVerticalStrut(25)); + + // Frame Timing Section + fpsGraph = new GraphPanel(new Color(46, 204, 113)); + fpsGraph.setPreferredSize(new Dimension(0, 140)); + main.add(createSection("Real-time Frame Timing", fpsGraph)); + + main.add(Box.createVerticalStrut(25)); + + // Memory Section + memGraph = new GraphPanel(new Color(52, 152, 219)); + memGraph.setPreferredSize(new Dimension(0, 140)); + main.add(createSection("Memory Usage (JVM Heap)", memGraph)); + + JScrollPane scroll = new JScrollPane(main); + scroll.setBorder(null); + add(scroll); + + updateTimer = new Timer(500, e -> updateTelemetry()); + updateTimer.start(); + addWindowListener(new java.awt.event.WindowAdapter() { + @Override public void windowClosing(java.awt.event.WindowEvent e) { updateTimer.stop(); } + }); + } + + private JPanel createSection(String title, JComponent content) { + JPanel section = new JPanel(new BorderLayout(0, 10)); + section.setOpaque(false); + + JLabel l = new JLabel(title.toUpperCase()); + l.setFont(UIUtils.getFont(Font.BOLD, 11f)); + l.setForeground(new Color(120, 120, 130)); + + section.add(l, BorderLayout.NORTH); + section.add(content, BorderLayout.CENTER); + return section; + } + + private JPanel createHardwareGrid() { + JPanel grid = new JPanel(new GridLayout(0, 2, 15, 8)); + grid.setOpaque(false); + + grid.add(createKV("OS", System.getProperty("os.name"))); + grid.add(createKV("Architecture", System.getProperty("os.arch"))); + grid.add(createKV("Processor", getProcessorName())); + grid.add(createKV("Logical Cores", String.valueOf(Runtime.getRuntime().availableProcessors()))); + grid.add(createKV("Graphics Device", GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getIDstring())); + grid.add(createKV("JVM", System.getProperty("java.version"))); + + return grid; + } + + private String getProcessorName() { + String os = System.getProperty("os.name").toLowerCase(); + if (os.contains("linux")) { + try { + java.nio.file.Path path = java.nio.file.Paths.get("/proc/cpuinfo"); + if (java.nio.file.Files.exists(path)) { + try (java.util.stream.Stream lines = java.nio.file.Files.lines(path)) { + return lines.filter(line -> line.contains("model name")) + .map(line -> line.split(":")[1].trim()) + .findFirst() + .orElse(System.getProperty("os.arch")); + } + } + } catch (Exception ignored) {} + } + String envCpu = System.getenv("PROCESSOR_IDENTIFIER"); + return (envCpu != null) ? envCpu : System.getProperty("os.arch"); + } + + private JPanel createKV(String key, String val) { + JPanel p = new JPanel(new BorderLayout()); + p.setOpaque(false); + JLabel k = new JLabel(key); + k.setFont(UIUtils.getFont(Font.PLAIN, 11f)); + k.setForeground(new Color(150, 150, 155)); + JLabel v = new JLabel(val); + v.setFont(UIUtils.getFont(Font.BOLD, 11f)); + v.setForeground(new Color(210, 210, 215)); + p.add(k, BorderLayout.NORTH); + p.add(v, BorderLayout.CENTER); + return p; + } + + private void updateTelemetry() { + float fps = 58f + (float)Math.random() * 4f; + fpsHistory.add(fps); if (fpsHistory.size() > 60) fpsHistory.remove(0); + fpsGraph.setData(fpsHistory, 0, 120, String.format("Current: %.1f FPS", fps)); + + Runtime r = Runtime.getRuntime(); + float used = (r.totalMemory() - r.freeMemory()) / 1024f / 1024f; + memHistory.add(used); if (memHistory.size() > 60) memHistory.remove(0); + memGraph.setData(memHistory, 0, r.maxMemory()/1024f/1024f, String.format("Used: %.0f MB", used)); + } + } + + private static class GraphPanel extends JPanel { + private List data = new ArrayList<>(); + private float min, max; + private String label = ""; + private final Color color; + + public GraphPanel(Color c) { + this.color = c; + setBackground(new Color(35, 35, 40)); + setBorder(BorderFactory.createLineBorder(new Color(60, 60, 65))); + } + + public void setData(List d, float min, float max, String l) { + this.data = new ArrayList<>(d); this.min = min; this.max = max; this.label = l; repaint(); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + if (data.size() < 2) return; + Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + int w = getWidth(), h = getHeight(); + float xStep = (float)w / (data.size()-1); + + // Path for gradient fill + Path2D.Float path = new Path2D.Float(); + path.moveTo(0, h); + for (int i=0; i-#%kx$skMivW1XsEQ4qy`@T~{wqY>FPDz-^mOV`NtmT^}*|Mdv?`xSD zBw-@EkiB>M{jT?YulK#)_m6Yk_xU`}{rP;(d9HKLeV#ZIBW?PNTo(ZVpx4#WFarP( znSuZsN-`XTIBbxC&soRJ5C9$t0|53Z034G;*cAW>lm>vG4gjE>2>|Rqxy`037Llq>XWhJC#EM%0FW#pBm<;10>m8GSd`M2-<4*|v->Fyf*zXfv2($Iek zw7u9)$b#$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=}Ilrss~sYS-G5JNg$g7rZBP^UWVqXZOtD zoSeG);2M0QNT)p-Q*b2s8(sbjnHe(Fk^QG)|EdY3mSTNzBTnqsVUm)|>r!Q@h*Hsb zKj-P<*9@c5%|WRr%7dMTLe{eSh<`-DD)(Wh`vhv~-ln*a`pHLJtP59#KfmwR>}XPh zKD&Ez z9Zj?mKHH|c?)Ey%J0|3(J>i_@% literal 0 HcmV?d00001 diff --git a/src/main/resources/com/parafield/storming/icons/png/fullscreen.png b/src/main/resources/com/parafield/storming/icons/png/fullscreen.png new file mode 100644 index 0000000000000000000000000000000000000000..300ff265b03833a138507605f315aa2455e819ba GIT binary patch literal 2749 zcmc&$doSO2m_lXAoqplC4`)skBzef0GIazK)(*a3Ix$70SGq)VA=}+R1N@& zq&xLa$DjqV3-;EQ0F)(Z7(>|>l8t*PAoF|@m1qD)Jwhkwyro~~~Wp|K_32P9f z8Funq*hTL!9Lk4`gB&n6G(N0vXrgauiXlrTi8ZjUo3Jl2d zQ<9n&ISAxe(`(=rs3-PP2i-3`o&CYR{zWU+Fl014J9l}}+^6tjW@31^8V}qKA*>-- zb5=+cqp3L7h&8ngGP@U>l}sK7sV#OD_V+m`nK4uqa@z27tER6)X9cGG712*4KhFv3 z=c4bHnDMKT$1T4fHLZBX(|HIVv)Pu8bJt_j#jQvRQjer6QBDtg#$=e*iUT}1audRF z%%DGk8+4+!t4#ef%e~V+M}vHuP*K~?YqGP(W%S@H19znQe#MNYNBydeb}O$r>$|OY zCB53eGPu+B{vP}4BGvv72_94Tb##?qWBGT|ljRe1$p}J)MJWMO%zdMp zSAuC0ox43f?dZO<{4~CW?-Ch9^EorkC;1Kh0yga}+n;-jiNKx~3(lv5qTN54FC`aWl(k0@9HCHr8VX9=Q2<-`Xl}AsHTDX3# z?mA8#<7}7@0~?da1nRcQpLfhvzaWRM*K6sk7-d{$w|tE%|g0&~SbVC+WmJm?7E(ZK5XsHU3ROOyep-vDRV4+#A7pPt#4U|Y z$~NI4cs`DXDo2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~TV+V;7pEg_KpP-n~zXj25RH1R?T3?k^Gq@#($Vta39qYv0WXx<>;M1& literal 0 HcmV?d00001 diff --git a/src/main/resources/com/parafield/storming/icons/png/performance.png b/src/main/resources/com/parafield/storming/icons/png/performance.png new file mode 100644 index 0000000000000000000000000000000000000000..7220a28864bbbf33afbf2596f32d902b386ea5fe GIT binary patch literal 5161 zcmb`LXE5C1x5s~rSWzQNkVQn4h_d=FLZSpw6212tUG(S#QI;TjixOQzh_Z;)+hWD) zz4zYxHS?djGk5O0J9p-s`JU%I-_JZ}=Dd5t-z&?K5YiC>06-!yC#?zqpt}+T5a8X( ziMR3gojfsn`_fB?s;bu&cb140r<>$9nC*jdi`$zD)1kms%9B^2eAM5 z3$7pREnHkp?4ABM!!P(BrdPM?Zu*C3^3t!>Jtwv^KBQ~5Cv;?O;L}Nu%e+(wh@Uv)gpkN=Jp?Kv}sdgx|-n6~dx(pYXGS+-P3YJL^Bdv%&xiE#JvyUYS$a z>$Kz3AuqeZn5rZ1qzQ+{-O1J2S!BI(MzM>-G*Y8L85Hz{;QuQm-xOj9&2f7%_c8{l z%RFucBwYZDF(Q`=O0pvxwsz&ID2vNiss8)hh#^|Uea4mv#f~%}qm$Q?P zvqjRU@GrqMoe^aQZaK?Eu0*tyQI$Kp`%7w5?iJ(c2})#$!*e>YF+Xt|EsXr7%0fjd z9cN2ga&(G~!WwmbHUT8S7fNGg0?=7%uPZl%eDKuqr9>WAQ&!=YKjKE+Tcdp+G620t zf$hxpZb`>+1FBmsYVmv}H!IS}_5@f9e@T|8@EG3*f8_Ik&K52ZlbQu%uGO&RaL1+9 zY%coVk2ev0lBa4aEhmt6MD})CgyR`hG;HTrPSEr@rAKIW3AHFJ5FEBslM|3}?iomX zD_RUs0f+1~1%+GG<=*0l0JEJJaX3V7XcsKHV)T4^T?1S9Siy8$uBMF-`drPlX&1h z;#qPj<4!zX<3*<6Nnhj1->iAVt`eL*wNZA{cLn!#(4Z38>W0sVWR=eEsq5-5Ia5BF z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V-RUO##7>4#=dwBNB5 zib+woU;YrjthcAMy24hnh$}h{Z~r@8u$BJZn}Y18Xj(YYJFyHs=3cFobmD54Kr++R z%J_=a#W6&rSaQ}gMr90Aqs61sw%dhfW?Sa)v$b^em#c%P^4A0UwqVa^*{^>sM`O(R zXBGtr=fZr_s@VEf4f_+|y+7wH6w@j8A2^)mUmBpjeg??0;17y_YsA(6I`-X0d2!%I z==<;I11qqfhn80cVsVnE9gu$cKLR?P@{mkc?ido-K*@=b3+KSXY0B7mh{R$Q&lPwGES8! zQs8Rhn*2V;6{t~4m=lLcVXOg%Zq7D7?^#MYN$`{<-fBilfuB+@ewE<6FbiIsLXHLq zaywR_8Jldc%9IloAIN&=aptVeKH6u>h{IXjbdMYYYi^ z*^3a3M86*iT<3<&={Gz;vTZzHW#9Y(dqny^=v}Om17Wt1!eFcTi{jv#jN)dq?8_X( zgD;VJwaWR9cA->W^<3(ub|{cdWFrmRp}{eUDxT?mWv{W2b9w{-=*_!Wvxq({J;MjH zv(-^SeD{k)FD;%Zi zeiPS9{u-y}n>;&20F>kL6GBy?{wWBx>#6W9uFNF*iU(y7f`@v%juV_$k+qNE^s!>p>xi}{JVx#{+C-(`|QVhvMOo_ m@|#fq*AMXiPjL|2ghRF@{&i+Zx8UyI43L*mmi{Se9Q0pnowBC@ literal 0 HcmV?d00001 diff --git a/src/main/resources/com/parafield/storming/icons/svg/camera.svg b/src/main/resources/com/parafield/storming/icons/svg/camera.svg new file mode 100644 index 0000000..1fb448a --- /dev/null +++ b/src/main/resources/com/parafield/storming/icons/svg/camera.svg @@ -0,0 +1,7 @@ + + + + + + camera Created with Sketch Beta. + \ No newline at end of file diff --git a/src/main/resources/com/parafield/storming/icons/svg/fullscreen.svg b/src/main/resources/com/parafield/storming/icons/svg/fullscreen.svg new file mode 100644 index 0000000..5044a9d --- /dev/null +++ b/src/main/resources/com/parafield/storming/icons/svg/fullscreen.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/com/parafield/storming/icons/svg/performance.svg b/src/main/resources/com/parafield/storming/icons/svg/performance.svg new file mode 100644 index 0000000..1cc6d62 --- /dev/null +++ b/src/main/resources/com/parafield/storming/icons/svg/performance.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file From 4283789140ada7d90dd75f5f3b4ee6ca2cff474b Mon Sep 17 00:00:00 2001 From: BatistaCakewalk <118333712+BatistaCakewalk@users.noreply.github.com> Date: Sun, 1 Mar 2026 14:38:16 -0500 Subject: [PATCH 3/6] performance --- .../com/parafield/storming/ui/windows/SimulationWindow.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java index 2282547..20082f1 100644 --- a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java +++ b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java @@ -325,7 +325,7 @@ private static class PerformanceMonitorDialog extends JDialog { public PerformanceMonitorDialog(Frame owner) { super(owner, "Performance Monitor", false); - setSize(550, 650); + setSize(800, 600); // Wider window setLocationRelativeTo(owner); JPanel main = new JPanel(); @@ -374,7 +374,7 @@ private JPanel createSection(String title, JComponent content) { } private JPanel createHardwareGrid() { - JPanel grid = new JPanel(new GridLayout(0, 2, 15, 8)); + JPanel grid = new JPanel(new GridLayout(0, 3, 20, 12)); // 3 columns, more spacing grid.setOpaque(false); grid.add(createKV("OS", System.getProperty("os.name"))); From 275a38287358559e0789ddcdeae0593609cea761 Mon Sep 17 00:00:00 2001 From: BatistaCakewalk <118333712+BatistaCakewalk@users.noreply.github.com> Date: Sun, 1 Mar 2026 14:39:29 -0500 Subject: [PATCH 4/6] performance --- .../storming/ui/windows/SimulationWindow.java | 71 ++++++++++++++----- 1 file changed, 55 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java index 20082f1..832508f 100644 --- a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java +++ b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java @@ -320,12 +320,17 @@ private static class PerformanceMonitorDialog extends JDialog { private final Timer updateTimer; private final List fpsHistory = new ArrayList<>(); private final List memHistory = new ArrayList<>(); + private final List cpuHistory = new ArrayList<>(); + private final List gpuHistory = new ArrayList<>(); + private final GraphPanel fpsGraph; private final GraphPanel memGraph; + private final GraphPanel cpuGraph; + private final GraphPanel gpuGraph; public PerformanceMonitorDialog(Frame owner) { super(owner, "Performance Monitor", false); - setSize(800, 600); // Wider window + setSize(950, 700); // Slightly wider to fit 3 graphs comfortably setLocationRelativeTo(owner); JPanel main = new JPanel(); @@ -333,21 +338,34 @@ public PerformanceMonitorDialog(Frame owner) { main.setBorder(new EmptyBorder(25, 25, 25, 25)); main.setBackground(new Color(25, 25, 30)); - // hardware Section + // 1. Hardware Section main.add(createSection("Hardware & System", createHardwareGrid())); main.add(Box.createVerticalStrut(25)); - // Frame Timing Section + // 2. Frame Timing Section (Full Width) fpsGraph = new GraphPanel(new Color(46, 204, 113)); - fpsGraph.setPreferredSize(new Dimension(0, 140)); + fpsGraph.setPreferredSize(new Dimension(0, 120)); main.add(createSection("Real-time Frame Timing", fpsGraph)); main.add(Box.createVerticalStrut(25)); - // Memory Section - memGraph = new GraphPanel(new Color(52, 152, 219)); - memGraph.setPreferredSize(new Dimension(0, 140)); - main.add(createSection("Memory Usage (JVM Heap)", memGraph)); + // 3. Resource Usage Row (3 Columns) + JPanel resourceRow = new JPanel(new GridLayout(1, 3, 15, 0)); + resourceRow.setOpaque(false); + + cpuGraph = new GraphPanel(new Color(231, 76, 60)); // Red for CPU + cpuGraph.setPreferredSize(new Dimension(0, 120)); + resourceRow.add(createSection("CPU Usage", cpuGraph)); + + gpuGraph = new GraphPanel(new Color(155, 89, 182)); // Purple for GPU + gpuGraph.setPreferredSize(new Dimension(0, 120)); + resourceRow.add(createSection("GPU Usage", gpuGraph)); + + memGraph = new GraphPanel(new Color(52, 152, 219)); // Blue for Memory + memGraph.setPreferredSize(new Dimension(0, 120)); + resourceRow.add(createSection("Memory (JVM)", memGraph)); + + main.add(resourceRow); JScrollPane scroll = new JScrollPane(main); scroll.setBorder(null); @@ -361,11 +379,11 @@ public PerformanceMonitorDialog(Frame owner) { } private JPanel createSection(String title, JComponent content) { - JPanel section = new JPanel(new BorderLayout(0, 10)); + JPanel section = new JPanel(new BorderLayout(0, 8)); section.setOpaque(false); JLabel l = new JLabel(title.toUpperCase()); - l.setFont(UIUtils.getFont(Font.BOLD, 11f)); + l.setFont(UIUtils.getFont(Font.BOLD, 10f)); l.setForeground(new Color(120, 120, 130)); section.add(l, BorderLayout.NORTH); @@ -374,7 +392,7 @@ private JPanel createSection(String title, JComponent content) { } private JPanel createHardwareGrid() { - JPanel grid = new JPanel(new GridLayout(0, 3, 20, 12)); // 3 columns, more spacing + JPanel grid = new JPanel(new GridLayout(0, 3, 20, 12)); grid.setOpaque(false); grid.add(createKV("OS", System.getProperty("os.name"))); @@ -410,7 +428,7 @@ private JPanel createKV(String key, String val) { JPanel p = new JPanel(new BorderLayout()); p.setOpaque(false); JLabel k = new JLabel(key); - k.setFont(UIUtils.getFont(Font.PLAIN, 11f)); + k.setFont(UIUtils.getFont(Font.PLAIN, 10f)); k.setForeground(new Color(150, 150, 155)); JLabel v = new JLabel(val); v.setFont(UIUtils.getFont(Font.BOLD, 11f)); @@ -421,14 +439,35 @@ private JPanel createKV(String key, String val) { } private void updateTelemetry() { + // 1. FPS float fps = 58f + (float)Math.random() * 4f; fpsHistory.add(fps); if (fpsHistory.size() > 60) fpsHistory.remove(0); - fpsGraph.setData(fpsHistory, 0, 120, String.format("Current: %.1f FPS", fps)); - + fpsGraph.setData(fpsHistory, 0, 120, String.format("%.1f FPS", fps)); + + // 2. CPU (Using system load if available) + float cpuUsage = 0; + try { + java.lang.management.OperatingSystemMXBean osBean = java.lang.management.ManagementFactory.getOperatingSystemMXBean(); + if (osBean instanceof com.sun.management.OperatingSystemMXBean sunBean) { + cpuUsage = (float)sunBean.getProcessCpuLoad() * 100f; + } else { + cpuUsage = (float)osBean.getSystemLoadAverage(); // Fallback + } + } catch (Exception e) { cpuUsage = (float)Math.random() * 15f; } + if (cpuUsage < 0) cpuUsage = (float)Math.random() * 10f; // Handle startup -1 + cpuHistory.add(cpuUsage); if (cpuHistory.size() > 40) cpuHistory.remove(0); + cpuGraph.setData(cpuHistory, 0, 100, String.format("CPU: %.1f%%", cpuUsage)); + + // 3. GPU (Placeholder - requires engine integration) + float gpuUsage = 20f + (float)Math.random() * 10f; + gpuHistory.add(gpuUsage); if (gpuHistory.size() > 40) gpuHistory.remove(0); + gpuGraph.setData(gpuHistory, 0, 100, String.format("GPU (Est): %.1f%%", gpuUsage)); + + // 4. Memory Runtime r = Runtime.getRuntime(); float used = (r.totalMemory() - r.freeMemory()) / 1024f / 1024f; - memHistory.add(used); if (memHistory.size() > 60) memHistory.remove(0); - memGraph.setData(memHistory, 0, r.maxMemory()/1024f/1024f, String.format("Used: %.0f MB", used)); + memHistory.add(used); if (memHistory.size() > 40) memHistory.remove(0); + memGraph.setData(memHistory, 0, r.maxMemory()/1024f/1024f, String.format("Memory: %.0f MB", used)); } } From 9344fa896b3e2550f33968b5c63acd723dbb3946 Mon Sep 17 00:00:00 2001 From: BatistaCakewalk <118333712+BatistaCakewalk@users.noreply.github.com> Date: Sun, 1 Mar 2026 14:51:44 -0500 Subject: [PATCH 5/6] performance --- .../storming/ui/windows/SimulationWindow.java | 164 +++++++++++------- 1 file changed, 98 insertions(+), 66 deletions(-) diff --git a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java index 832508f..220129e 100644 --- a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java +++ b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java @@ -10,7 +10,6 @@ import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; -import java.awt.geom.Area; import java.awt.geom.Path2D; import java.util.ArrayList; import java.util.List; @@ -182,7 +181,7 @@ private AlphaPanel createFooter() { JLabel stats = new JLabel(" 60 FPS | 16.6ms | OpenGL 4.5 Core"); stats.setFont(UIUtils.getFont(Font.PLAIN, 10f)); - stats.setForeground(new Color(150, 150, 150)); + stats.setForeground(new Color(150, 150, 155)); left.add(stats); p.add(left, BorderLayout.WEST); @@ -191,7 +190,7 @@ private AlphaPanel createFooter() { memLabel = new JLabel("0 / 0 MB"); memLabel.setFont(UIUtils.getFont(Font.PLAIN, 10f)); - memLabel.setForeground(new Color(150, 150, 150)); + memLabel.setForeground(new Color(150, 150, 155)); memBar = new JProgressBar(0, 100); memBar.setPreferredSize(new Dimension(80, 6)); @@ -302,12 +301,16 @@ public void startSimulation() { private static class AlphaPanel extends JPanel { private float alpha = 1.0f; - public AlphaPanel(LayoutManager layout) { super(layout); } + private int yOffset = 0; + public AlphaPanel(LayoutManager layout) { super(layout); setOpaque(false); } public void setAlpha(float a) { this.alpha = a; repaint(); } + public void setYOffset(int y) { this.yOffset = y; repaint(); } @Override public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); + g2.translate(0, yOffset); super.paint(g2); g2.dispose(); } @@ -327,81 +330,91 @@ private static class PerformanceMonitorDialog extends JDialog { private final GraphPanel memGraph; private final GraphPanel cpuGraph; private final GraphPanel gpuGraph; + + private final AlphaPanel mainContent; public PerformanceMonitorDialog(Frame owner) { super(owner, "Performance Monitor", false); - setSize(950, 700); // Slightly wider to fit 3 graphs comfortably + setSize(950, 750); setLocationRelativeTo(owner); + setLayout(new BorderLayout()); + getContentPane().setBackground(new Color(25, 25, 30)); - JPanel main = new JPanel(); - main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); - main.setBorder(new EmptyBorder(25, 25, 25, 25)); - main.setBackground(new Color(25, 25, 30)); + mainContent = new AlphaPanel(null); + mainContent.setLayout(new BoxLayout(mainContent, BoxLayout.Y_AXIS)); + mainContent.setBorder(new EmptyBorder(35, 35, 35, 35)); + mainContent.setAlpha(0.0f); + mainContent.setYOffset(20); // 1. Hardware Section - main.add(createSection("Hardware & System", createHardwareGrid())); - main.add(Box.createVerticalStrut(25)); + mainContent.add(createSection("Hardware & System", createHardwareGrid())); + mainContent.add(Box.createVerticalStrut(35)); // 2. Frame Timing Section (Full Width) fpsGraph = new GraphPanel(new Color(46, 204, 113)); - fpsGraph.setPreferredSize(new Dimension(0, 120)); - main.add(createSection("Real-time Frame Timing", fpsGraph)); + fpsGraph.setPreferredSize(new Dimension(0, 140)); + mainContent.add(createSection("Real-time Frame Timing", fpsGraph)); - main.add(Box.createVerticalStrut(25)); + mainContent.add(Box.createVerticalStrut(35)); // 3. Resource Usage Row (3 Columns) - JPanel resourceRow = new JPanel(new GridLayout(1, 3, 15, 0)); + JPanel resourceRow = new JPanel(new GridLayout(1, 3, 20, 0)); resourceRow.setOpaque(false); - cpuGraph = new GraphPanel(new Color(231, 76, 60)); // Red for CPU - cpuGraph.setPreferredSize(new Dimension(0, 120)); + cpuGraph = new GraphPanel(new Color(231, 76, 60)); + cpuGraph.setPreferredSize(new Dimension(0, 140)); resourceRow.add(createSection("CPU Usage", cpuGraph)); - gpuGraph = new GraphPanel(new Color(155, 89, 182)); // Purple for GPU - gpuGraph.setPreferredSize(new Dimension(0, 120)); + gpuGraph = new GraphPanel(new Color(155, 89, 182)); + gpuGraph.setPreferredSize(new Dimension(0, 140)); resourceRow.add(createSection("GPU Usage", gpuGraph)); - memGraph = new GraphPanel(new Color(52, 152, 219)); // Blue for Memory - memGraph.setPreferredSize(new Dimension(0, 120)); + memGraph = new GraphPanel(new Color(52, 152, 219)); + memGraph.setPreferredSize(new Dimension(0, 140)); resourceRow.add(createSection("Memory (JVM)", memGraph)); - main.add(resourceRow); + mainContent.add(resourceRow); - JScrollPane scroll = new JScrollPane(main); - scroll.setBorder(null); - add(scroll); + // Removing the JScrollPane to prevent scrolling as requested + add(mainContent, BorderLayout.CENTER); updateTimer = new Timer(500, e -> updateTelemetry()); + updateTimer.setInitialDelay(1500); updateTimer.start(); + addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { updateTimer.stop(); } }); + + // Entrance Animation + SwingUtilities.invokeLater(() -> { + UIAnimator.animate(0.0f, 1.0f, 500, a -> { + mainContent.setAlpha(a); + mainContent.setYOffset((int)(20 * (1.0f - a))); + }, null); + }); } private JPanel createSection(String title, JComponent content) { - JPanel section = new JPanel(new BorderLayout(0, 8)); + JPanel section = new JPanel(new BorderLayout(0, 12)); section.setOpaque(false); - JLabel l = new JLabel(title.toUpperCase()); - l.setFont(UIUtils.getFont(Font.BOLD, 10f)); + l.setFont(UIUtils.getFont(Font.BOLD, 14f)); l.setForeground(new Color(120, 120, 130)); - section.add(l, BorderLayout.NORTH); section.add(content, BorderLayout.CENTER); return section; } private JPanel createHardwareGrid() { - JPanel grid = new JPanel(new GridLayout(0, 3, 20, 12)); + JPanel grid = new JPanel(new GridLayout(0, 3, 25, 15)); grid.setOpaque(false); - grid.add(createKV("OS", System.getProperty("os.name"))); grid.add(createKV("Architecture", System.getProperty("os.arch"))); grid.add(createKV("Processor", getProcessorName())); grid.add(createKV("Logical Cores", String.valueOf(Runtime.getRuntime().availableProcessors()))); grid.add(createKV("Graphics Device", GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getIDstring())); grid.add(createKV("JVM", System.getProperty("java.version"))); - return grid; } @@ -414,8 +427,7 @@ private String getProcessorName() { try (java.util.stream.Stream lines = java.nio.file.Files.lines(path)) { return lines.filter(line -> line.contains("model name")) .map(line -> line.split(":")[1].trim()) - .findFirst() - .orElse(System.getProperty("os.arch")); + .findFirst().orElse(System.getProperty("os.arch")); } } } catch (Exception ignored) {} @@ -428,10 +440,10 @@ private JPanel createKV(String key, String val) { JPanel p = new JPanel(new BorderLayout()); p.setOpaque(false); JLabel k = new JLabel(key); - k.setFont(UIUtils.getFont(Font.PLAIN, 10f)); + k.setFont(UIUtils.getFont(Font.PLAIN, 14f)); k.setForeground(new Color(150, 150, 155)); JLabel v = new JLabel(val); - v.setFont(UIUtils.getFont(Font.BOLD, 11f)); + v.setFont(UIUtils.getFont(Font.BOLD, 18f)); v.setForeground(new Color(210, 210, 215)); p.add(k, BorderLayout.NORTH); p.add(v, BorderLayout.CENTER); @@ -439,31 +451,30 @@ private JPanel createKV(String key, String val) { } private void updateTelemetry() { - // 1. FPS + fpsGraph.setCalculating(false); + cpuGraph.setCalculating(false); + gpuGraph.setCalculating(false); + memGraph.setCalculating(false); + float fps = 58f + (float)Math.random() * 4f; fpsHistory.add(fps); if (fpsHistory.size() > 60) fpsHistory.remove(0); fpsGraph.setData(fpsHistory, 0, 120, String.format("%.1f FPS", fps)); - // 2. CPU (Using system load if available) float cpuUsage = 0; try { java.lang.management.OperatingSystemMXBean osBean = java.lang.management.ManagementFactory.getOperatingSystemMXBean(); if (osBean instanceof com.sun.management.OperatingSystemMXBean sunBean) { cpuUsage = (float)sunBean.getProcessCpuLoad() * 100f; - } else { - cpuUsage = (float)osBean.getSystemLoadAverage(); // Fallback } - } catch (Exception e) { cpuUsage = (float)Math.random() * 15f; } - if (cpuUsage < 0) cpuUsage = (float)Math.random() * 10f; // Handle startup -1 + } catch (Exception e) {} + if (cpuUsage <= 0) cpuUsage = (float)Math.random() * 10f; cpuHistory.add(cpuUsage); if (cpuHistory.size() > 40) cpuHistory.remove(0); cpuGraph.setData(cpuHistory, 0, 100, String.format("CPU: %.1f%%", cpuUsage)); - // 3. GPU (Placeholder - requires engine integration) float gpuUsage = 20f + (float)Math.random() * 10f; gpuHistory.add(gpuUsage); if (gpuHistory.size() > 40) gpuHistory.remove(0); gpuGraph.setData(gpuHistory, 0, 100, String.format("GPU (Est): %.1f%%", gpuUsage)); - // 4. Memory Runtime r = Runtime.getRuntime(); float used = (r.totalMemory() - r.freeMemory()) / 1024f / 1024f; memHistory.add(used); if (memHistory.size() > 40) memHistory.remove(0); @@ -476,6 +487,7 @@ private static class GraphPanel extends JPanel { private float min, max; private String label = ""; private final Color color; + private boolean isCalculating = true; public GraphPanel(Color c) { this.color = c; @@ -483,50 +495,70 @@ public GraphPanel(Color c) { setBorder(BorderFactory.createLineBorder(new Color(60, 60, 65))); } + public void setCalculating(boolean calc) { this.isCalculating = calc; repaint(); } + public void setData(List d, float min, float max, String l) { - this.data = new ArrayList<>(d); this.min = min; this.max = max; this.label = l; repaint(); + this.data = new ArrayList<>(d); + this.min = min; + this.max = (max <= min) ? min + 1.0f : max; + this.label = l; + repaint(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); - if (data.size() < 2) return; Graphics2D g2 = (Graphics2D) g.create(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int w = getWidth(), h = getHeight(); - float xStep = (float)w / (data.size()-1); - // Path for gradient fill + // Draw Background Grid + g2.setColor(new Color(255, 255, 255, 10)); + g2.setStroke(new BasicStroke(1f)); + for (int i = 1; i < 4; i++) { + int y = h * i / 4; + g2.drawLine(0, y, w, y); + } + for (int i = 1; i < 10; i++) { + int x = w * i / 10; + g2.drawLine(x, 0, x, h); + } + + if (isCalculating || data.size() < 2) { + g2.setColor(new Color(100, 100, 110)); + g2.setFont(UIUtils.getFont(Font.BOLD, 18f)); + FontMetrics fm = g2.getFontMetrics(); + String text = "CALCULATING..."; + g2.drawString(text, (getWidth() - fm.stringWidth(text)) / 2, (getHeight() + fm.getAscent()) / 2); + g2.dispose(); + return; + } + + float xStep = (float)w / (data.size()-1); Path2D.Float path = new Path2D.Float(); path.moveTo(0, h); for (int i=0; i Date: Sun, 1 Mar 2026 14:55:35 -0500 Subject: [PATCH 6/6] Documentation --- Docs/JavaArchitecture.md | 14 +++++++++++--- .../storming/ui/windows/SettingsWindow.java | 3 ++- .../storming/ui/windows/SimulationWindow.java | 3 +++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Docs/JavaArchitecture.md b/Docs/JavaArchitecture.md index f1f2429..39db6e3 100644 --- a/Docs/JavaArchitecture.md +++ b/Docs/JavaArchitecture.md @@ -5,13 +5,19 @@ This document provides an overview of the Java-based Editor for the Storming Eng ## Core Application Lifecycle * **`EditorApp`**: The entry point for the Java application. It manages global themes (using FlatLaf), configures UI refinements, and handles the initial startup sequence (Splash Screen -> Project Selector -> Main Window). -* **`EngineLauncher`**: Responsible for the lifecycle of the C++ Storming Engine process. It handles launching with shared memory arguments, capturing engine logs, and graceful termination. +* **`EngineLauncher`**: Responsible for the lifecycle of the C++ Storming Engine process. It handles launching with shared memory arguments, capturing engine logs, and graceful termination. Supports multiple log listeners for real-time broadcasting. ## Window Management * **`MainWindow`**: The central orchestrator of the editor's layout. It manages complex nested split panes, JetBrains-style sidebars, and the main workspace tabs. * **`ProjectSelectorWindow`**: The initial launcher for the engine. Features a modern, animated interface for project management. -* **`SimulationWindow`**: A dedicated debugging window for running engine simulations with integrated playback controls and real-time statistics. +* **`SimulationWindow`**: A dedicated debugging window for running engine simulations. Includes: + * Godot-inspired UI with integrated header and footer. + * Pulsating "LIVE" indicator. + * Collapsible **Mini-Console** linked to the engine output. + * **Performance Monitor** with real-time graphs (FPS, CPU, GPU, Memory) and hardware detection. + * Utility controls for **Always-on-Top**, **Screenshots**, and **Resolution Scaling**. +* **`SettingsWindow`**: A centralized configuration dialog with a searchable sidebar. Supports dynamic theme switching and categorized panels for Engine and Editor preferences. * **`SplashWindow`**: A simple, stylized startup window displayed during initialization. ## UI Components & Utilities @@ -20,7 +26,7 @@ This document provides an overview of the Java-based Editor for the Storming Eng * **`SideBar`**: A specialized JetBrains-style sidebar for hosting tool window toggles and action shortcuts. * **`StormingMenuBar`**: A custom menu bar supporting alpha-fade animations, integrated playback controls, and a "hamburger" mode for space efficiency. * **`UIAnimator`**: A comprehensive animation utility providing cubic ease-out transitions for split panes and alpha properties. -* **`Icons`**: A centralized resource manager for SVG and PNG icons, supporting automatic scaling and theme-aware fallback. +* **`Icons`**: A centralized resource manager for SVG and PNG icons. Features theme-aware SVG filtering (automatic light/dark mode tinting). ## Editor Panels & Systems @@ -39,3 +45,5 @@ This document provides an overview of the Java-based Editor for the Storming Eng ## Development Note (WIP Features) As outlined in the [Roadmap](Roadmap.md), several high-level editor systems (Git, PR, Hierarchy, Inspector, and Analyzer) are currently in an early **Work-in-Progress (WIP)** state. These components serve as visual placeholders and utilize mock data to illustrate the final intended user experience. They will be incrementally integrated with the C++ engine and external providers in upcoming development phases. + +Telemetry data shown in the **Simulation Window** (FPS, CPU Load, etc.) is currently simulated or best-effort based on the JVM environment and will be fully linked to the engine's telemetry bridge in the future. diff --git a/src/main/java/com/parafield/storming/ui/windows/SettingsWindow.java b/src/main/java/com/parafield/storming/ui/windows/SettingsWindow.java index c861de8..c1e6eae 100644 --- a/src/main/java/com/parafield/storming/ui/windows/SettingsWindow.java +++ b/src/main/java/com/parafield/storming/ui/windows/SettingsWindow.java @@ -16,7 +16,8 @@ /** * The Settings window for the Storming Engine Editor. * Provides a categorized interface for application and engine configuration, - * featuring a searchable category list and dynamic content panels with smooth transitions. + * including Appearance (with dynamic theme switching), Engine, and Editor preferences. + * Features a searchable category list and animated content panels. */ public class SettingsWindow extends JDialog { diff --git a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java index 220129e..1ed8635 100644 --- a/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java +++ b/src/main/java/com/parafield/storming/ui/windows/SimulationWindow.java @@ -18,6 +18,9 @@ * An advanced simulation window with a Godot-inspired aesthetic. * Features a pulsating "LIVE" indicator, real-time resource tracking, * always-on-top toggle, resolution scaling, and an integrated mini-console. + * + * Note: Telemetry data (FPS, CPU/GPU usage) is currently simulated using mock data + * and will be linked to the engine's telemetry bridge in future updates. */ public class SimulationWindow extends JFrame {