Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Docs/JavaArchitecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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.
5 changes: 5 additions & 0 deletions src/main/java/com/parafield/storming/Icons.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
47 changes: 34 additions & 13 deletions src/main/java/com/parafield/storming/core/EngineLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> logConsumer;
private final List<Consumer<String>> 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<String> 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<String> listener) {
logListeners.add(listener);
}

/**
* Removes a log listener.
* @param listener The callback to remove.
*/
public void removeLogListener(Consumer<String> listener) {
logListeners.remove(listener);
}

private void broadcast(String message) {
for (Consumer<String> listener : new ArrayList<>(logListeners)) {
listener.accept(message);
}
}

/**
Expand All @@ -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.");
}
}

Expand All @@ -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.
*/
Expand All @@ -71,7 +92,7 @@ public void launch(String shmName) {
return;
}

logConsumer.accept("Launching Storming Engine...");
broadcast("Launching Storming Engine...");
new Thread(() -> {
try {
ProcessBuilder pb;
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Loading
Loading