VisualJava
API Reference

Code & API

Every built-in JVL class, with the methods you'll actually use and a runnable example for each. For the language rules themselves (classes, events, named parameters) see the Wiki.

Quick examples

A minimal moving-and-shooting player, entirely in JVL:

class Main {

    VJObject player;

    @onStart
    void setup() {
        player = VJObject.rect("player", 0, 0, 40, 40, Color.CYAN);
        Physics.gravity(0, 0.6);
    }

    @onUpdate
    void loop() {
        if (KEY_LEFT)  player.moveX(-4);
        if (KEY_RIGHT) player.moveX(4);
        if (KEY_SPACE) player.rotate(5);
    }

    void Main(String[] args) {
        System.print("Game started.");
    }
}

Reading and writing a save file:

Config.write("resources/save.cfg", "highscore", 4200);
int best = Config.readInt("resources/save.cfg", "highscore", 0);
System.print("Best score: " + best);

Esempi rapidi

Un player minimo che si muove e "spara", interamente in JVL:

class Main {

    VJObject player;

    @onStart
    void setup() {
        player = VJObject.rect("player", 0, 0, 40, 40, Color.CYAN);
        Physics.gravity(0, 0.6);
    }

    @onUpdate
    void loop() {
        if (KEY_LEFT)  player.moveX(-4);
        if (KEY_RIGHT) player.moveX(4);
        if (KEY_SPACE) player.rotate(5);
    }

    void Main(String[] args) {
        System.print("Game started.");
    }
}

Leggere e scrivere un file di salvataggio:

Config.write("resources/save.cfg", "highscore", 4200);
int best = Config.readInt("resources/save.cfg", "highscore", 0);
System.print("Best score: " + best);

VJObject

core

The base type for anything drawn in a 2D scene: rectangles, circles, triangles and images. Created with a factory method, loaded from a saved scene, or read back with Scene.find(...).

VJObject player = VJObject.rect("player", 100, 300, 40, 40, Color.CYAN);
VJObject e = VJObject.circle("enemy", 500, 300, 40, Color.RED);
VJObject loaded = VJObject.load("player", "resources/vj/player.vj");
VJObject byName = Scene.find("player");

Create

MethodDescription
VJObject.rect(name, x, y, w, h, color)Creates a rectangle at (x, y) and adds it to the running scene.
VJObject.circle(name, x, y, diameter, color)Creates a circle.
VJObject.create(name, shape, x, y, w, h, color)Generic factory; shape is one of the Shape constants.
VJObject.createImage(name, path, x, y, w, h)Creates an image-backed object from a file under resources.
VJObject.load(name, resourcePath)Loads transform/color/texture from a .vj file saved by the Scene Editor.

Position, rotation, scale

MethodDescription
getX() / getY()Current position.
setX(x) / setY(y)Set a single axis.
setPosition(x, y) / setPos(x, y)Set both axes at once.
move(dx, dy)Move by an offset on both axes.
move(speed)Move forward along the object's current rotation.
moveX(dx) / moveY(dy)Move on one axis, blocked automatically by solid colliders.
changeX(dx) / changeY(dy)Like moveX/moveY but without re-sending the scene command (cheaper for bulk updates).
setRotation(deg) / getRotation()Absolute rotation in degrees.
rotate(deg)Rotate relative to current rotation.
lookAtMouse()Rotate to face the current mouse position.
setScale(s) / setScale(sx, sy) / getScale()Uniform or per-axis scale.

Appearance

MethodDescription
setColor(r, g, b) / setColor(Color c)Fill color.
setSize(w, h)Width and height in pixels.
setTexture(path) / setImage(path)Render an image instead of a flat color.
setLayer(l) / getLayer()Draw order — higher layers draw on top.
hide() / show() / visible(bool) / isVisible()Toggle visibility without destroying the object.
setTrasparency(alpha0to255)Opacity.
setLight(level)Glow intensity (matches the Inspector's "Light" slider).

Tags, groups, collisions

MethodDescription
setTag(t) / addTag(t) / hasTag(t) / removeTag(t) / getTags()Free-text tags, usable with Scene.findByTag.
touch(other)Returns true if this object's bounds overlap other's right now.
canColaid(other, enabled)Enable/disable solid collision resolution between two specific objects.
onCollisionEnter/Stay/Exit(handler)Fires when a solid Collider starts/continues/stops touching this object.
onTriggerEnter/Stay/Exit(handler)Same, but for non-solid trigger colliders.

Lifetime & tweens

MethodDescription
clone() / clone(tag)Spawns a copy at the same position; useful for bullets, particles, enemies.
kill() / isDead()Removes the object from the scene.
moveTo(x, y, ms)Animates position to a target over time.
rotateTo(deg, ms) / scaleTo(sx, sy, ms)Animates rotation/scale over time.
fadeIn(ms) / fadeOut(ms)Animates opacity in/out.
sleep(ms)Pauses only this object's own scripted timeline.

VJObject

core

Il tipo base per tutto ciò che viene disegnato in una scena 2D: rettangoli, cerchi, triangoli e immagini. Creato con un metodo factory, caricato da una scena salvata, oppure recuperato con Scene.find(...).

VJObject player = VJObject.rect("player", 100, 300, 40, 40, Color.CYAN);
VJObject e = VJObject.circle("enemy", 500, 300, 40, Color.RED);
VJObject loaded = VJObject.load("player", "resources/vj/player.vj");
VJObject byName = Scene.find("player");

Creazione

MetodoDescrizione
VJObject.rect(name, x, y, w, h, color)Crea un rettangolo in (x, y) e lo aggiunge alla scena in esecuzione.
VJObject.circle(name, x, y, diametro, color)Crea un cerchio.
VJObject.create(name, shape, x, y, w, h, color)Factory generica; shape è una delle costanti di Shape.
VJObject.createImage(name, path, x, y, w, h)Crea un oggetto basato su immagine da un file sotto resources.
VJObject.load(name, resourcePath)Carica trasformazione/colore/texture da un file .vj salvato dall'editor di scena.

Posizione, rotazione, scala

MetodoDescrizione
getX() / getY()Posizione attuale.
setX(x) / setY(y)Imposta un singolo asse.
setPosition(x, y) / setPos(x, y)Imposta entrambi gli assi insieme.
move(dx, dy)Sposta di un offset su entrambi gli assi.
move(speed)Avanza lungo la rotazione attuale dell'oggetto.
moveX(dx) / moveY(dy)Sposta su un asse, bloccato automaticamente dai collider solidi.
changeX(dx) / changeY(dy)Come moveX/moveY ma senza reinviare il comando di scena (più economico per aggiornamenti massivi).
setRotation(deg) / getRotation()Rotazione assoluta in gradi.
rotate(deg)Ruota relativamente alla rotazione attuale.
lookAtMouse()Ruota per guardare verso la posizione attuale del mouse.
setScale(s) / setScale(sx, sy) / getScale()Scala uniforme o per asse.

Aspetto

MetodoDescrizione
setColor(r, g, b) / setColor(Color c)Colore di riempimento.
setSize(w, h)Larghezza e altezza in pixel.
setTexture(path) / setImage(path)Renderizza un'immagine al posto di un colore piatto.
setLayer(l) / getLayer()Ordine di disegno — i layer più alti si disegnano sopra.
hide() / show() / visible(bool) / isVisible()Attiva/disattiva la visibilità senza distruggere l'oggetto.
setTrasparency(alpha0a255)Opacità.
setLight(livello)Intensità del glow (corrisponde allo slider "Light" dell'Inspector).

Tag, gruppi, collisioni

MetodoDescrizione
setTag(t) / addTag(t) / hasTag(t) / removeTag(t) / getTags()Tag testuali liberi, usabili con Scene.findByTag.
touch(other)Ritorna true se i bounds di questo oggetto si sovrappongono a quelli di other in questo momento.
canColaid(other, enabled)Abilita/disabilita la risoluzione della collisione solida tra due oggetti specifici.
onCollisionEnter/Stay/Exit(handler)Si attiva quando un Collider solido inizia/continua/smette di toccare questo oggetto.
onTriggerEnter/Stay/Exit(handler)Come sopra, ma per collider trigger non solidi.

Ciclo di vita e animazioni

MetodoDescrizione
clone() / clone(tag)Crea una copia nella stessa posizione; utile per proiettili, particelle, nemici.
kill() / isDead()Rimuove l'oggetto dalla scena.
moveTo(x, y, ms)Anima la posizione verso un target nel tempo.
rotateTo(deg, ms) / scaleTo(sx, sy, ms)Anima rotazione/scala nel tempo.
fadeIn(ms) / fadeOut(ms)Anima l'opacità in entrata/uscita.
sleep(ms)Mette in pausa solo la timeline scriptata di questo oggetto.

Scene

Scene-wide operations: background, search and grouping.

Scene.setBackgroundColor(new Color(20, 22, 30));
VJObject e = Scene.find("enemy");
java.util.List<VJObject> coins = Scene.findAll("coin");
Group enemies = Scene.group("enemies");
MethodDescription
clear() / clearPrints()Removes every object from the scene, or just clears console prints.
setBackgroundColor(Color)Scene background color.
setpos(x, y)Moves the scene's origin/viewport.
setGrid(visible)Toggles the editor's reference grid.
find(name)Finds a live object by its exact name.
findByTag(tag) / findAll(tag)Finds the first, or every, object carrying a tag.
group(name)Gets (creating if needed) a named Group of objects.

Scene

Operazioni a livello di scena: sfondo, ricerca e raggruppamento.

Scene.setBackgroundColor(new Color(20, 22, 30));
VJObject e = Scene.find("enemy");
java.util.List<VJObject> coins = Scene.findAll("coin");
Group enemies = Scene.group("enemies");
MetodoDescrizione
clear() / clearPrints()Rimuove tutti gli oggetti dalla scena, oppure pulisce solo i print in console.
setBackgroundColor(Color)Colore di sfondo della scena.
setpos(x, y)Sposta l'origine/viewport della scena.
setGrid(visible)Attiva/disattiva la griglia di riferimento dell'editor.
find(name)Trova un oggetto vivo per nome esatto.
findByTag(tag) / findAll(tag)Trova il primo, o tutti, gli oggetti con un dato tag.
group(name)Ottiene (creandolo se serve) un Group di oggetti con quel nome.

Camera

Camera.follow(player);
Camera.zoom(1.4);

@onUpdate
void loop() {
    Camera._tickFollow();
}
MethodDescription
move(dx, dy)Pans the camera by an offset.
setPosition(x, y) / getX() / getY()Absolute camera position.
follow(target)Camera tracks a VJObject's position every frame.
zoom(factor)Sets zoom level.
rotate(deg)Rotates the camera.

Camera

Camera.follow(player);
Camera.zoom(1.4);

@onUpdate
void loop() {
    Camera._tickFollow();
}
MetodoDescrizione
move(dx, dy)Sposta la camera di un offset.
setPosition(x, y) / getX() / getY()Posizione assoluta della camera.
follow(target)La camera segue la posizione di un VJObject ogni frame.
zoom(factor)Imposta il livello di zoom.
rotate(deg)Ruota la camera.

Mouse

@onUpdate
void loop() {
    if (Mouse.left()) System.print(Mouse.getX() + "," + Mouse.getY());
}
MethodDescription
getX() / getY()Cursor position in scene coordinates.
left() / right() / middle()Whether that mouse button is currently held.

Mouse

@onUpdate
void loop() {
    if (Mouse.left()) System.print(Mouse.getX() + "," + Mouse.getY());
}
MetodoDescrizione
getX() / getY()Posizione del cursore in coordinate di scena.
left() / right() / middle()Se quel pulsante del mouse è attualmente premuto.

Keyboard — KEY_*

Any KEY_NAME used as a boolean condition checks the live keyboard state — no method call needed.

if (KEY_LEFT)  player.moveX(-4);
if (KEY_RIGHT) player.moveX(4);
if (KEY_UP)    player.moveY(-4);
if (KEY_DOWN)  player.moveY(4);
if (KEY_SPACE) player.rotate(90);
if (KEY_A)     System.print("A is down");

For the exact key that triggered an event, use @onKeyPress, which passes the key name as a String argument (see Events).

Tastiera — KEY_*

Qualsiasi KEY_NOME usato come condizione booleana verifica lo stato attuale della tastiera — nessuna chiamata a metodo necessaria.

if (KEY_LEFT)  player.moveX(-4);
if (KEY_RIGHT) player.moveX(4);
if (KEY_UP)    player.moveY(-4);
if (KEY_DOWN)  player.moveY(4);
if (KEY_SPACE) player.rotate(90);
if (KEY_A)     System.print("A is down");

Per sapere esattamente quale tasto ha attivato un evento, usa @onKeyPress, che passa il nome del tasto come argomento String (vedi Eventi).

Physics · Rigidbody2D · Collider · Layer

Every VJObject carries a rigidbody and a collider. Setting a velocity or force "activates" the body — until then, an object is just visually positioned, not simulated.

Physics.gravity(0, 0.8);

VJObject crate = VJObject.rect("crate", 0, -100, 40, 40, Color.ORANGE);
crate.rigidbody.setMass(2);
crate.rigidbody.addForce(0, 0);      // dynamic bodies fall under gravity automatically

VJObject wall = VJObject.rect("wall", 200, 0, 20, 300, Color.GRAY);
wall.rigidbody.setStatic();
wall.collider.setLayer(Layer.WORLD);

crate.collider.setMask(Layer.WORLD); // crate reacts to WORLD-layer colliders
crate.onCollisionEnter(other -> System.print("Landed on " + other));

Physics

MethodDescription
Physics.gravity(x, y)Sets global gravity applied to every dynamic rigidbody.
Physics.gravity()Reads the current gravity vector.

Rigidbody2D (obj.rigidbody)

MethodDescription
setVelocity(x, y) / getVelocityX() / getVelocityY()Direct velocity control.
addForce(x, y)Accumulates force applied over the next step (mass-dependent).
addImpulse(x, y)Instant velocity change, ignoring mass scaling of forces.
setMass(m) / getMass()Body mass, affects force response.
setGravityScale(g)Multiplier on global gravity for this body (0 = unaffected).
setDrag(d) / setAngularDrag(d)Velocity damping per step (0–1).
setStatic() / setKinematic() / setDynamic()Body type: immovable, moved by script only, or fully simulated.
setRotationLocked(bool)Prevents physics from rotating the body.

Collider (obj.collider) & Layer

MethodDescription
setEnabled(bool) / isEnabled()Turns collision detection on/off for this object.
setTrigger(bool) / isTrigger()Non-solid colliders report overlap via onTrigger* but don't block movement.
setLayer(l) / getLayer()Which Layer this collider belongs to.
setMask(m) / getMask()Which layers this collider should react to.
Layer.DEFAULT / PLAYER / ENEMY / WORLD / PROJECTILE / PICKUP / UI / ALL / NONEPredefined layer bit-flags; combine with |, or use Layer.bit(n) for a custom one.

Physics · Rigidbody2D · Collider · Layer

Ogni VJObject ha un rigidbody e un collider. Impostare una velocità o una forza "attiva" il corpo — fino a quel momento, un oggetto è solo posizionato visivamente, non simulato.

Physics.gravity(0, 0.8);

VJObject crate = VJObject.rect("crate", 0, -100, 40, 40, Color.ORANGE);
crate.rigidbody.setMass(2);
crate.rigidbody.addForce(0, 0);      // i corpi dinamici cadono automaticamente per gravità

VJObject wall = VJObject.rect("wall", 200, 0, 20, 300, Color.GRAY);
wall.rigidbody.setStatic();
wall.collider.setLayer(Layer.WORLD);

crate.collider.setMask(Layer.WORLD); // crate reagisce ai collider del layer WORLD
crate.onCollisionEnter(other -> System.print("Atterrato su " + other));

Physics

MetodoDescrizione
Physics.gravity(x, y)Imposta la gravità globale applicata a ogni rigidbody dinamico.
Physics.gravity()Legge il vettore di gravità attuale.

Rigidbody2D (obj.rigidbody)

MetodoDescrizione
setVelocity(x, y) / getVelocityX() / getVelocityY()Controllo diretto della velocità.
addForce(x, y)Accumula una forza applicata nel prossimo step (dipendente dalla massa).
addImpulse(x, y)Cambio istantaneo di velocità, ignorando lo scaling della massa sulle forze.
setMass(m) / getMass()Massa del corpo, influenza la risposta alle forze.
setGravityScale(g)Moltiplicatore della gravità globale per questo corpo (0 = non influenzato).
setDrag(d) / setAngularDrag(d)Smorzamento della velocità per step (0–1).
setStatic() / setKinematic() / setDynamic()Tipo di corpo: immobile, mosso solo da script, o completamente simulato.
setRotationLocked(bool)Impedisce alla fisica di ruotare il corpo.

Collider (obj.collider) e Layer

MetodoDescrizione
setEnabled(bool) / isEnabled()Attiva/disattiva il rilevamento delle collisioni per questo oggetto.
setTrigger(bool) / isTrigger()I collider non solidi segnalano la sovrapposizione tramite onTrigger* ma non bloccano il movimento.
setLayer(l) / getLayer()A quale Layer appartiene questo collider.
setMask(m) / getMask()A quali layer questo collider deve reagire.
Layer.DEFAULT / PLAYER / ENEMY / WORLD / PROJECTILE / PICKUP / UI / ALL / NONEBit-flag di layer predefiniti; combinali con |, oppure usa Layer.bit(n) per uno personalizzato.

Color · Shape

VJObject o = VJObject.rect("box", 0, 0, 40, 40, Color.CYAN);
o.setColor(new Color(255, 128, 0));
VJObject img = VJObject.create("badge", Shape.IMAGE, 0, 0, 32, 32, Color.WHITE);
ItemDescription
new Color(r, g, b)0–255 RGB components.
Color.RED / GREEN / BLUE / WHITE / BLACK / …Named preset colors.
Shape.RECT / CIRCLE / TRIANGLE / RHOMBUS / IMAGEShape constants used with VJObject.create(...).

Color · Shape

VJObject o = VJObject.rect("box", 0, 0, 40, 40, Color.CYAN);
o.setColor(new Color(255, 128, 0));
VJObject img = VJObject.create("badge", Shape.IMAGE, 0, 0, 32, 32, Color.WHITE);
ElementoDescrizione
new Color(r, g, b)Componenti RGB 0–255.
Color.RED / GREEN / BLUE / WHITE / BLACK / …Colori predefiniti con nome.
Shape.RECT / CIRCLE / TRIANGLE / RHOMBUS / IMAGECostanti di forma usate con VJObject.create(...).

UI widgets — UiText · UiButton · UiTextField · UiPanel

Screen-space widgets for menus and HUDs, positioned independently of the game camera.

UiText score = new UiText("Score: 0", 20, 20);
UiButton restart = new UiButton("Restart", 20, 60, 120, 36);
restart.onClick(() -> Scene.clear());

UiTextField name = new UiTextField(20, 110, 160, 28);
UiPanel hud = new UiPanel(0, 0, 200, 140);
WidgetTypical use
UiTextStatic or updatable label text (score, timers, messages).
UiButtonClickable button with an onClick(...) handler.
UiTextFieldSingle-line text input, e.g. player name entry.
UiPanelA background container to group other widgets visually.

All four share position/size setters and can be shown or hidden like a VJObject.

Widget UI — UiText · UiButton · UiTextField · UiPanel

Widget in coordinate schermo per menu e HUD, posizionati indipendentemente dalla camera di gioco.

UiText score = new UiText("Score: 0", 20, 20);
UiButton restart = new UiButton("Restart", 20, 60, 120, 36);
restart.onClick(() -> Scene.clear());

UiTextField name = new UiTextField(20, 110, 160, 28);
UiPanel hud = new UiPanel(0, 0, 200, 140);
WidgetUso tipico
UiTextTesto statico o aggiornabile (punteggio, timer, messaggi).
UiButtonPulsante cliccabile con handler onClick(...).
UiTextFieldCampo di testo su una riga, es. inserimento nome giocatore.
UiPanelUn contenitore di sfondo per raggruppare visivamente altri widget.

Tutti e quattro condividono setter di posizione/dimensione e possono essere mostrati o nascosti come un VJObject.

Files & data — FileSystem · Json · Config · Zip · Clipboard · FileDialog

Reading, writing and browsing files from JVL code — for save files, settings, and asset management.

// Plain text
FileSystem.write("resources/notes.txt", "Hello!");
String content = FileSystem.read("resources/notes.txt");
FileSystem.append("resources/log.txt", "line\n");
boolean ok = FileSystem.exists("resources/notes.txt");
FileSystem.createFolder("resources/saves");
String[] files = FileSystem.list("resources/saves");

// Key/value config, typed reads
Config.write("resources/save.cfg", "level", 3);
int level = Config.readInt("resources/save.cfg", "level", 1);

// JSON
Json.save("resources/state.json", myMap);
Object data = Json.load("resources/state.json");

// Pick a file / folder with a native dialog
String picked = FileDialog.openFile("Images", "*.png");
String folder = FileDialog.selectFolder();

// Zip an asset folder
Zip.compress("resources/level1", "resources/level1.zip");
Zip.extract("resources/level1.zip", "resources/level1");

// Clipboard
Clipboard.setText("copied!");
String pasted = Clipboard.getText();
ClassHighlights
FileSystemcreate, write, append, read, readLines, writeLines, exists, delete, copy, move, rename, size, lastModified, createFolder, deleteFolder, list, listFolders, home/desktop/documents/downloads/temp/appData, info(path)
ConfigSimple key/value files: write(path,key,value) (String/int/double/boolean overloads), readString/readInt/readDouble/readBool(path,key,default), has, remove, keys.
Jsonsave(path,obj[,pretty]), load(path), stringify(obj[,pretty]), parse(json).
FileDialogopenFile(), openFiles(), saveFile(), selectFolder() — each with optional filter name/pattern and start folder.
Zipcompress(sourceFolderOrFile, outputZip), extract(zipFile, destinationFolder).
ClipboardgetText(), setText(text).

File e dati — FileSystem · Json · Config · Zip · Clipboard · FileDialog

Leggere, scrivere e sfogliare file da codice JVL — per salvataggi, impostazioni e gestione degli asset.

// Testo semplice
FileSystem.write("resources/notes.txt", "Hello!");
String content = FileSystem.read("resources/notes.txt");
FileSystem.append("resources/log.txt", "line\n");
boolean ok = FileSystem.exists("resources/notes.txt");
FileSystem.createFolder("resources/saves");
String[] files = FileSystem.list("resources/saves");

// Config chiave/valore, letture tipizzate
Config.write("resources/save.cfg", "level", 3);
int level = Config.readInt("resources/save.cfg", "level", 1);

// JSON
Json.save("resources/state.json", myMap);
Object data = Json.load("resources/state.json");

// Scegli un file / una cartella con una finestra di dialogo nativa
String picked = FileDialog.openFile("Images", "*.png");
String folder = FileDialog.selectFolder();

// Comprimi una cartella di asset
Zip.compress("resources/level1", "resources/level1.zip");
Zip.extract("resources/level1.zip", "resources/level1");

// Appunti
Clipboard.setText("copied!");
String pasted = Clipboard.getText();
ClasseMetodi principali
FileSystemcreate, write, append, read, readLines, writeLines, exists, delete, copy, move, rename, size, lastModified, createFolder, deleteFolder, list, listFolders, home/desktop/documents/downloads/temp/appData, info(path)
ConfigFile chiave/valore semplici: write(path,key,value) (overload String/int/double/boolean), readString/readInt/readDouble/readBool(path,key,default), has, remove, keys.
Jsonsave(path,obj[,pretty]), load(path), stringify(obj[,pretty]), parse(json).
FileDialogopenFile(), openFiles(), saveFile(), selectFolder() — ciascuno con filtro nome/pattern e cartella iniziale opzionali.
Zipcompress(sourceFolderOrFile, outputZip), extract(zipFile, destinationFolder).
ClipboardgetText(), setText(text).

Terminal & OS — VJSystem · CMD · VJProcess · Browser

Run shell commands or external programs, wait on them or read their output, and open files, folders and URLs — this is Visual Java's terminal-command layer.

// Run a shell command and block until it finishes, capturing output
String out = CMD.execute("dir");             // Windows; use "ls" style commands on other OSes
System.print(out);

// Same thing, explicitly
String out2 = VJSystem.exec("git status");

// Launch a long-running external program without blocking
VJProcess proc = VJSystem.run("java", "-version");
proc.waitFor(2000);              // wait up to 2s
System.print(proc.getOutput());
System.print(proc.getError());
if (proc.isAlive()) proc.kill();

// Open things with the OS
VJSystem.open("resources/readme.txt");
VJSystem.openFolder("resources");
VJSystem.showInExplorer("resources/readme.txt");
Browser.open("https://github.com/srokopollo-design/visual-java-engen");
Browser.mail("team@example.com");

// System info
System.print(VJSystem.getOS() + " / " + VJSystem.getArchitecture());
System.print("CPUs: " + VJSystem.getCPUCount());
ClassHighlights
VJSystemrun(cmd...) (async, returns VJProcess), exec(command) (blocking, returns combined output), open/openFolder/showInExplorer/openURL, exit(), restartApplication(), getOS, getUserName, getComputerName, getArchitecture, getJavaVersion, getCPUCount, getFreeMemory, getTotalMemory, getEnv(name), path shortcuts getDesktop/getDocuments/getDownloads/getAppData/getTemp.
CMDexecute(command) — a one-line shortcut for VJSystem.exec(...).
VJProcessReturned by VJSystem.run(...): isAlive(), getPID(), waitFor(), waitFor(timeoutMs), kill(), killForcibly(), getExitCode(), getOutput(), getError().
Browseropen(url), mail(address).
Blocking vs. non-blocking

Use CMD.execute/VJSystem.exec for short commands you want the result of immediately; use VJSystem.run(...) for anything long-running so your game loop keeps ticking while it works in the background.

Terminale e OS — VJSystem · CMD · VJProcess · Browser

Esegui comandi shell o programmi esterni, aspettali o leggine l'output, e apri file, cartelle e URL — questo è il livello di comandi da terminale di Visual Java.

// Esegue un comando shell e blocca finché non termina, catturando l'output
String out = CMD.execute("dir");             // Windows; usa comandi tipo "ls" su altri OS
System.print(out);

// Stessa cosa, in modo esplicito
String out2 = VJSystem.exec("git status");

// Avvia un programma esterno di lunga durata senza bloccare
VJProcess proc = VJSystem.run("java", "-version");
proc.waitFor(2000);              // aspetta fino a 2s
System.print(proc.getOutput());
System.print(proc.getError());
if (proc.isAlive()) proc.kill();

// Apri elementi con il sistema operativo
VJSystem.open("resources/readme.txt");
VJSystem.openFolder("resources");
VJSystem.showInExplorer("resources/readme.txt");
Browser.open("https://github.com/srokopollo-design/visual-java-engen");
Browser.mail("team@example.com");

// Informazioni di sistema
System.print(VJSystem.getOS() + " / " + VJSystem.getArchitecture());
System.print("CPU: " + VJSystem.getCPUCount());
ClasseMetodi principali
VJSystemrun(cmd...) (asincrono, ritorna VJProcess), exec(command) (bloccante, ritorna l'output combinato), open/openFolder/showInExplorer/openURL, exit(), restartApplication(), getOS, getUserName, getComputerName, getArchitecture, getJavaVersion, getCPUCount, getFreeMemory, getTotalMemory, getEnv(name), scorciatoie percorso getDesktop/getDocuments/getDownloads/getAppData/getTemp.
CMDexecute(command) — scorciatoia in una riga per VJSystem.exec(...).
VJProcessRestituito da VJSystem.run(...): isAlive(), getPID(), waitFor(), waitFor(timeoutMs), kill(), killForcibly(), getExitCode(), getOutput(), getError().
Browseropen(url), mail(address).
Bloccante o no

Usa CMD.execute/VJSystem.exec per comandi brevi di cui vuoi subito il risultato; usa VJSystem.run(...) per qualsiasi cosa di lunga durata, così il tuo game loop continua a girare mentre lavora in background.

Window

Controls the main runtime window created automatically at program start.

Window.main().setTitle("My Game");
Window.main().setSize(1024, 640);
Window.main().setFullscreen(true);
Current limits

Only the main window is controllable in 1.7 — creating additional independent windows (Window.create(...) / dialogs) isn't implemented yet.

Window

Controlla la finestra principale del runtime, creata automaticamente all'avvio del programma.

Window.main().setTitle("My Game");
Window.main().setSize(1024, 640);
Window.main().setFullscreen(true);
Limiti attuali

Nella 1.7 è controllabile solo la finestra principale — la creazione di finestre indipendenti aggiuntive (Window.create(...) / dialog) non è ancora implementata.