AcresMenu.h#
Acres/Source/Acres/AcresMenu.h Generated
Front end: the full-screen menu, the terrain-brush editor and the in-session pause menu.
The menu is what the game shows when started without a mode flag. It is a Slate UI (Unreal's C++ UI toolkit, written in a declarative SNew(Widget).Property(...)[Child] style) drawn over a slow aerial orbit of the farm. The camera for that orbit is AAcresMenuPawn; the widgets live in AcresMenu.cpp.
Starting a session does not create the simulation in place. FAcresSession::Prepare writes a session folder and returns command-line arguments; StartSession swaps the process command line and reloads the map, and the game mode then spawns the tractor instead of the menu camera. "End simulation" goes back the same way. This keeps the simulation code independent of the menu: every session can also be started from a plain command line.
Unreal notes: an APawn is an actor a player controls; here it only carries the camera. BeginPlay, Tick and EndPlay run on the game thread.
StartSession#
Starts a session: sets the process command line to the original launch arguments (without -Menu) plus ExtraArgs and reloads the farm map. The game mode reads the new flags and spawns the tractor.
| Argument | Description |
|---|---|
World |
Any world object's GetWorld(). |
ExtraArgs |
Arguments from FAcresSession::Prepare. |
ReturnToMenu#
Ends the running session and reloads the map with the menu. Logs are closed by the actors' EndPlay.
TogglePause#
Opens or closes the in-session pause overlay (Resume / End simulation / Quit) and pauses the game.
| Argument | Description |
|---|---|
PC |
The local player controller. |
Returns: True when the overlay was opened, false when it was closed.
AAcresMenuPawn#
Camera and host for the front-end menu.
BeginPlay creates the Slate menu and adds it to the game viewport; Tick flies a slow orbit over the farm, or eases to a field and draws the brush ring while the terrain editor is open.
Test hooks, read from the command line so the menu can be driven without a mouse: -MenuOpen=simulation|pilot|replay|optimizer, -MenuTab=<tab>, -MenuSet=<id>=<value>;..., -MenuBrushTest=<field>, -MenuRunNow (press Run/Start immediately), -MenuShot=<png> (screenshot after 6 s), -MenuAutoStart, -MenuOptVisualize=<field>, -MenuExitAfterShot. -MenuDemo=<script.json>: scripted demo (see AcresMenu.cpp).
AAcresMenuPawn::BeginPlay#
Creates the menu widget, applies test hooks and gives the menu keyboard and mouse focus.
AAcresMenuPawn::EndPlay#
Removes the menu widget from the viewport.
AAcresMenuPawn::Tick#
Moves the camera (orbit or field framing) and runs the timed test hooks.
AAcresMenuPawn::FocusField#
Frames a field from the south, about 50 degrees down, for the terrain brush.
| Argument | Description |
|---|---|
Field |
Field number (1..59). |
AAcresMenuPawn::ResumeOrbit#
Leaves the field view: back to the orbit, brush ring and edit preview hidden.
AAcresMenuPawn::UpdatePreview#
Redraws the edit preview for one field: a coloured overlay of what the brush changed (orange = raised, blue = lowered) plus the field outline. Only edited cells are drawn so the real ground stays visible.
| Argument | Description |
|---|---|
Setup |
Field setup holding the terrain edits. |
Field |
Field number to draw. |
AAcresMenuPawn::ShowBrush#
Sets where the brush ring is drawn on the next frames.
| Argument | Description |
|---|---|
CentreCm |
Ring centre, world centimetres. |
RadiusM |
Ring radius, metres. |
bVisible |
False hides the ring (cursor outside the field). |
AAcresMenuPawn::MouseRay#
World-space ray under the mouse cursor.
| Argument | Description |
|---|---|
Origin |
Ray start, world centimetres. |
Direction |
Unit direction. |
Returns: False when there is no mouse position (for example no window focus).