载入中...
搜索中...
未找到
eve::ui 命名空间参考

class  Component
 React-style UI component: implement build(), call setState / markDirty, then rebuild(). Mounts onto a named UIHost via mountAs / attach. 更多...
 
class  EditorHost
 Headless MCP editor host (MVVM). 更多...
 
struct  FlexItemSpec
 
struct  FlexRect
 
struct  FlexResult
 
class  ImGuiBackend
 Dear ImGui + SDL input + Vulkan present overlay. 更多...
 
struct  Theme
 Unified UI design tokens (colors, geometry, typography). Applied to ImGui each frame via applyThemeToImGui; metrics are design-time units at uiScale=1 and are multiplied by the current UI scale. 更多...
 
class  UI
 Declarative UI module (eve.UI). 更多...
 
class  UIBackend
 Platform / renderer backend for declarative UI. Concrete implementations live under ui/<backend>/ (e.g. ui/imgui). 更多...
 
struct  UIChange
 Value/text/toggle change for script: "hostName/nodeId". 更多...
 
struct  UIClick
 One script-facing click: "hostName/nodeId". 更多...
 
struct  UIEvent
 
class  UIHost
 ECS mount point for one UI panel/screen. Subclass to attach UI to game entities, e.g. class Hud : public UIHost. UISystem walks ecs::View<UIHost, Meta, Tree> (includes subclasses). 更多...
 
struct  UINode
 Retained UI widget node (arena tree). Conceptual counterpart of eve::scene::SceneNode; built declaratively from WidgetDesc. 更多...
 
struct  UIStats
 
class  UISystem
 
struct  ViewportState
 
struct  WidgetDesc
 Declarative widget description (build once / on dirty → flatten into UIHost::Tree). 更多...
 

枚举

enum class  NodeType : uint8_t {
  Window = 0 , Text = 1 , Button = 2 , SameLine = 3 ,
  Group = 4 , Separator = 5 , Checkbox = 6 , Slider = 7 ,
  Progress = 8 , InputText = 9 , CollapsingHeader = 10 , Child = 11 ,
  Flex = 12 , Spacer = 13 , Image = 14 , ImageButton = 15 ,
  Combo = 16 , ScrollList = 17 , Viewport = 18
}
 Widget node kinds understood by the UI renderer. 更多...
 
enum class  FlexDirection : uint8_t { Row = 0 , Column = 1 }
 Main-axis direction for Flex containers. 更多...
 
enum class  FlexAlign : uint8_t { Start = 0 , Center = 1 , End = 2 , Stretch = 3 }
 Cross-axis alignment of Flex children. 更多...
 
enum class  FlexJustify : uint8_t {
  Start = 0 , Center = 1 , End = 2 , SpaceBetween = 3 ,
  SpaceAround = 4
}
 Main-axis distribution of free space in a Flex container. 更多...
 

函数

void registerEditorHostCapabilities ()
 
std::unique_ptr< UIBackendcreateImGuiBackend ()
 Default backend: Dear ImGui + SDL + Vulkan (see ui/imgui/).
 
FlexResult flexArrange (bool row, float gap, float availMain, float availCross, FlexAlign containerAlign, FlexJustify justify, const std::vector< FlexItemSpec > &items)
 
void measureFlowChildren (UIHost::Tree &tree, int firstChild, float *outW, float *outH)
 
void measureNode (UIHost::Tree &tree, int index)
 
void measureTree (UIHost::Tree &tree)
 
ThemeglobalTheme ()
 
const std::string & globalThemeName ()
 Current preset name: "dark", "light", or "custom".
 
void setGlobalTheme (const Theme &theme)
 
void setGlobalTheme (const Theme &theme, const std::string &name)
 
bool setThemeByName (const std::string &name)
 Apply a named preset ("dark" / "light"). Case-insensitive. Returns false if unknown.
 
void setThemeUiScale (float scale)
 Logical (point-space) UI scale. Default 1.0.
 
float themeUiScale ()
 
void setThemeDpiScale (float dpiScale)
 
float themeDpiScale ()
 
void applyThemeToImGui (const Theme &theme)
 Push tokens into ImGui style. Metrics are multiplied by uiScale (default: themeUiScale()).
 
void applyThemeToImGui (const Theme &theme, float uiScale)
 
 Module_IMPL (UI, new UI())
 
WidgetDesc window (std::string title, std::vector< WidgetDesc > children={}, std::string id="root")
 Top-level window widget with a title bar.
 
WidgetDesc text (std::string content, std::string id="")
 Static text label.
 
WidgetDesc button (std::string label, std::string id="", std::function< void()> onClick={})
 Clickable button; fires onClick.
 
WidgetDesc group (std::vector< WidgetDesc > children={}, std::string id="")
 Plain group container.
 
WidgetDesc sameLine (std::string id="")
 Holds the next widget on the same line as the previous one.
 
WidgetDesc separator (std::string id="")
 Horizontal separator line.
 
WidgetDesc checkbox (std::string label, bool checked=false, std::string id="", std::function< void(bool)> onToggle={})
 Checkbox with a label; fires onToggle.
 
WidgetDesc slider (std::string label, float value, float minV, float maxV, std::string id="", std::function< void(float)> onValue={})
 Horizontal slider; fires onValue.
 
WidgetDesc progress (float fraction, std::string id="", std::string overlay="")
 Progress bar; fraction is clamped to [0,1].
 
WidgetDesc combo (std::string label, std::vector< std::string > options, int selected, std::string id, std::function< void(int)> onValue)
 
WidgetDesc image (std::string id, float width, float height, std::function< void()> onClick)
 
WidgetDesc imageButton (std::string id, float width, float height, std::function< void()> onClick)
 
WidgetDesc viewport (std::string id, float width, float height)
 
WidgetDesc inputText (std::string label, std::string value, std::string id="", std::function< void(const std::string &)> onChange={})
 Editable text field; fires onTextChange.
 
WidgetDesc collapsingHeader (std::string label, std::vector< WidgetDesc > children={}, std::string id="", bool defaultOpen=true)
 Collapsible header containing child widgets.
 
WidgetDesc child (std::string id, std::vector< WidgetDesc > children={}, float width=0.f, float height=120.f)
 Scrollable child region with an explicit size.
 
WidgetDesc scrollList (std::string id, std::vector< WidgetDesc > children, float height, float itemHeight)
 
WidgetDesc virtualList (std::string listId, const std::vector< std::string > &items, float height, float itemHeight)
 
WidgetDesc flex (FlexDirection direction, std::vector< WidgetDesc > children={}, std::string id="")
 Elastic layout container (row/column). Prefer row / column shorthands.
 
WidgetDesc row (std::vector< WidgetDesc > children={}, std::string id="")
 Horizontal elastic layout row.
 
WidgetDesc column (std::vector< WidgetDesc > children={}, std::string id="")
 Vertical elastic layout column.
 
WidgetDesc spacer (std::string id="", float grow=1.f)
 Flexible empty space; default flexGrow=1 so it absorbs free space in a Flex parent.
 
WidgetDesc when (bool cond, WidgetDesc child)
 Conditional: include child only when cond is true (empty group otherwise).
 
WidgetDesc whenElse (bool cond, WidgetDesc ifTrue, WidgetDesc ifFalse)
 
WidgetDesc list (std::string listId, const std::vector< std::string > &items, const std::function< WidgetDesc(const std::string &, int)> &itemFn)
 Expand a string list into a Group of item widgets. itemFn(label, index) builds each row; keys default to id.
 
WidgetDesc listButtons (std::string listId, const std::vector< std::string > &items)
 Default list: one Button per item, id = listId + "/" + index.
 
void applyTree (UIHost *host, WidgetDesc root)
 Full replace flatten.
 
bool applyTreeReconcile (UIHost *host, WidgetDesc root)
 Patch by key/id when structure (type + child keys) matches; otherwise full replace. Returns true if a structural rebuild occurred.
 

枚举类型说明

◆ FlexAlign

enum class eve::ui::FlexAlign : uint8_t
strong

Cross-axis alignment of Flex children.

枚举值
Start 
Center 
End 
Stretch 

在文件 UIHost.h39 行定义.

◆ FlexDirection

enum class eve::ui::FlexDirection : uint8_t
strong

Main-axis direction for Flex containers.

枚举值
Row 
Column 

在文件 UIHost.h36 行定义.

◆ FlexJustify

enum class eve::ui::FlexJustify : uint8_t
strong

Main-axis distribution of free space in a Flex container.

枚举值
Start 
Center 
End 
SpaceBetween 
SpaceAround 

在文件 UIHost.h42 行定义.

◆ NodeType

enum class eve::ui::NodeType : uint8_t
strong

Widget node kinds understood by the UI renderer.

枚举值
Window 
Text 
Button 
SameLine 
Group 
Separator 
Checkbox 
Slider 
Progress 
InputText 
CollapsingHeader 
Child 
Flex 
Spacer 
Image 
ImageButton 
Combo 
ScrollList 
Viewport 

在文件 UIHost.h13 行定义.

函数说明

◆ applyThemeToImGui() [1/2]

void eve::ui::applyThemeToImGui ( const Theme theme)

Push tokens into ImGui style. Metrics are multiplied by uiScale (default: themeUiScale()).

在文件 Theme.cpp135 行定义.

引用了 applyThemeToImGui() , 以及 theme.

被这些函数引用 applyThemeToImGui(), eve::ui::ImGuiBackend::init() , 以及 eve::ui::UISystem::render().

◆ applyThemeToImGui() [2/2]

void eve::ui::applyThemeToImGui ( const Theme theme,
float  uiScale 
)

在文件 Theme.cpp137 行定义.

引用了 s , 以及 theme.

◆ applyTree()

void eve::ui::applyTree ( UIHost host,
WidgetDesc  root 
)

Full replace flatten.

在文件 Widget.cpp477 行定义.

被这些函数引用 applyTreeReconcile() , 以及 eve::ui::UIHost::setTree().

◆ applyTreeReconcile()

bool eve::ui::applyTreeReconcile ( UIHost host,
WidgetDesc  root 
)

Patch by key/id when structure (type + child keys) matches; otherwise full replace. Returns true if a structural rebuild occurred.

在文件 Widget.cpp490 行定义.

引用了 applyTree().

被这些函数引用 eve::ui::UIHost::setTreeReconcile().

◆ button()

WidgetDesc eve::ui::button ( std::string  label,
std::string  id,
std::function< void()>  onClick 
)

Clickable button; fires onClick.

在文件 Widget.cpp244 行定义.

引用了 Button, d , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::addButton(), eve::ui::UI::addListItem(), listButtons(), eve::ui::UI::mountSimple(), eve::ui::UIHost::setSimplePanel() , 以及 virtualList().

◆ checkbox()

WidgetDesc eve::ui::checkbox ( std::string  label,
bool  checked,
std::string  id,
std::function< void(bool)>  onToggle 
)

Checkbox with a label; fires onToggle.

在文件 Widget.cpp279 行定义.

引用了 Checkbox, d , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::addCheckbox().

◆ child()

WidgetDesc eve::ui::child ( std::string  id,
std::vector< WidgetDesc children,
float  width,
float  height 
)

Scrollable child region with an explicit size.

在文件 Widget.cpp387 行定义.

引用了 Child, children, d, height, eve::ui::WidgetDesc::type , 以及 width.

被这些函数引用 eve::ui::UI::beginChild(), measureNode() , 以及 when().

◆ collapsingHeader()

WidgetDesc eve::ui::collapsingHeader ( std::string  label,
std::vector< WidgetDesc children,
std::string  id,
bool  defaultOpen 
)

Collapsible header containing child widgets.

在文件 Widget.cpp375 行定义.

引用了 children, CollapsingHeader, d , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::beginCollapsing().

◆ column()

WidgetDesc eve::ui::column ( std::vector< WidgetDesc children,
std::string  id 
)

Vertical elastic layout column.

在文件 Widget.cpp435 行定义.

引用了 children, Column , 以及 flex().

◆ combo()

WidgetDesc eve::ui::combo ( std::string  label,
std::vector< std::string >  options,
int  selected,
std::string  id = "",
std::function< void(int)>  onValue = {} 
)

Dropdown; options joined by '
', selected index in selected.

在文件 Widget.cpp315 行定义.

引用了 Combo, d , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::addCombo().

◆ createImGuiBackend()

std::unique_ptr< UIBackend > eve::ui::createImGuiBackend ( )

Default backend: Dear ImGui + SDL + Vulkan (see ui/imgui/).

在文件 ImGuiBackend.cpp101 行定义.

被这些函数引用 eve::ui::UI::initBackend().

◆ flex()

WidgetDesc eve::ui::flex ( FlexDirection  direction,
std::vector< WidgetDesc children,
std::string  id 
)

Elastic layout container (row/column). Prefer row / column shorthands.

在文件 Widget.cpp421 行定义.

引用了 children, d, Flex , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::beginFlex(), column() , 以及 row().

◆ flexArrange()

FlexResult eve::ui::flexArrange ( bool  row,
float  gap,
float  availMain,
float  availCross,
FlexAlign  containerAlign,
FlexJustify  justify,
const std::vector< FlexItemSpec > &  items 
)

◆ globalTheme()

Theme & eve::ui::globalTheme ( )

◆ globalThemeName()

const std::string & eve::ui::globalThemeName ( )

Current preset name: "dark", "light", or "custom".

在文件 Theme.cpp101 行定义.

被这些函数引用 eve::ui::UI::getTheme().

◆ group()

WidgetDesc eve::ui::group ( std::vector< WidgetDesc children,
std::string  id 
)

Plain group container.

在文件 Widget.cpp254 行定义.

引用了 children, d, Group , 以及 eve::ui::WidgetDesc::type.

◆ image()

WidgetDesc eve::ui::image ( std::string  id = "",
float  width = 0.f,
float  height = 0.f,
std::function< void()>  onClick = {} 
)

Colored / textured image. Size defaults to texture size via layout.

在文件 Widget.cpp331 行定义.

引用了 d, height, image, Image, eve::ui::WidgetDesc::type , 以及 width.

◆ imageButton()

WidgetDesc eve::ui::imageButton ( std::string  id,
float  width,
float  height,
std::function< void()>  onClick = {} 
)

Clickable image (renders via ImGui ImageButton).

在文件 Widget.cpp342 行定义.

引用了 d, height, ImageButton, eve::ui::WidgetDesc::type , 以及 width.

被这些函数引用 eve::ui::UI::addImageButton().

◆ inputText()

WidgetDesc eve::ui::inputText ( std::string  label,
std::string  value,
std::string  id,
std::function< void(const std::string &)>  onChange 
)

Editable text field; fires onTextChange.

在文件 Widget.cpp363 行定义.

引用了 d, InputText, eve::ui::WidgetDesc::type , 以及 value.

被这些函数引用 eve::ui::UI::addInputText().

◆ list()

WidgetDesc eve::ui::list ( std::string  listId,
const std::vector< std::string > &  items,
const std::function< WidgetDesc(const std::string &, int)> &  itemFn 
)

Expand a string list into a Group of item widgets. itemFn(label, index) builds each row; keys default to id.

在文件 Widget.cpp457 行定义.

引用了 children, group, eve::ui::WidgetDesc::id, eve::ui::WidgetDesc::key , 以及 row().

被这些函数引用 listButtons() , 以及 virtualList().

◆ listButtons()

WidgetDesc eve::ui::listButtons ( std::string  listId,
const std::vector< std::string > &  items 
)

Default list: one Button per item, id = listId + "/" + index.

在文件 Widget.cpp470 行定义.

引用了 button(), list() , 以及 eve::ui::WidgetDesc::withKey().

被这些函数引用 eve::ui::UI::setListItems().

◆ measureFlowChildren()

void eve::ui::measureFlowChildren ( UIHost::Tree tree,
int  firstChild,
float *  outW,
float *  outH 
)

Flow measure helpers for non-flex containers (Window/Group/Child/Header).

在文件 Layout.cpp170 行定义.

引用了 h, measureNode(), n, eve::ui::UIHost::Tree::nodes, SameLine , 以及 w.

被这些函数引用 measureNode().

◆ measureNode()

◆ measureTree()

void eve::ui::measureTree ( UIHost::Tree tree)

Measure the whole tree from its root.

在文件 Layout.cpp348 行定义.

引用了 measureNode() , 以及 eve::ui::UIHost::Tree::root.

被这些函数引用 eve::ui::UISystem::render().

◆ Module_IMPL()

eve::ui::Module_IMPL ( UI  ,
new   UI() 
)

◆ progress()

WidgetDesc eve::ui::progress ( float  fraction,
std::string  id,
std::string  overlay 
)

Progress bar; fraction is clamped to [0,1].

在文件 Widget.cpp305 行定义.

引用了 d, Progress , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::addProgress().

◆ registerEditorHostCapabilities()

void eve::ui::registerEditorHostCapabilities ( )

在文件 EditorHostCapabilities.cpp69 行定义.

引用了 impl , 以及 eve::cap::query().

被这些函数引用 eve::ui::UI::UI().

◆ row()

WidgetDesc eve::ui::row ( std::vector< WidgetDesc children,
std::string  id 
)

Horizontal elastic layout row.

在文件 Widget.cpp431 行定义.

引用了 children, flex() , 以及 Row.

被这些函数引用 flexArrange(), list() , 以及 measureNode().

◆ sameLine()

WidgetDesc eve::ui::sameLine ( std::string  id)

Holds the next widget on the same line as the previous one.

在文件 Widget.cpp263 行定义.

引用了 d, SameLine , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::addSameLine().

◆ scrollList()

WidgetDesc eve::ui::scrollList ( std::string  id,
std::vector< WidgetDesc children = {},
float  height = 0.f,
float  itemHeight = 0.f 
)

Virtualized scroll list: only visible rows are drawn each frame. Children are the full item set (rows laid out top-to-bottom at itemHeight px). Set a height for the viewport; 0 = fill available space.

在文件 Widget.cpp398 行定义.

引用了 children, d, height, ScrollList , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::beginScrollList() , 以及 virtualList().

◆ separator()

WidgetDesc eve::ui::separator ( std::string  id)

Horizontal separator line.

在文件 Widget.cpp271 行定义.

引用了 d, Separator , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::addSeparator().

◆ setGlobalTheme() [1/2]

void eve::ui::setGlobalTheme ( const Theme theme)

在文件 Theme.cpp103 行定义.

引用了 setGlobalTheme() , 以及 theme.

被这些函数引用 setGlobalTheme() , 以及 setThemeByName().

◆ setGlobalTheme() [2/2]

void eve::ui::setGlobalTheme ( const Theme theme,
const std::string &  name 
)

在文件 Theme.cpp105 行定义.

引用了 name , 以及 theme.

◆ setThemeByName()

bool eve::ui::setThemeByName ( const std::string &  name)

Apply a named preset ("dark" / "light"). Case-insensitive. Returns false if unknown.

在文件 Theme.cpp110 行定义.

引用了 eve::ui::Theme::dark(), eve::ui::Theme::light(), name , 以及 setGlobalTheme().

被这些函数引用 eve::ui::UI::setTheme(), eve::ui::UI::setThemeDark() , 以及 eve::ui::UI::setThemeLight().

◆ setThemeDpiScale()

void eve::ui::setThemeDpiScale ( float  dpiScale)

Display/framebuffer DPI ratio (e.g. 2.0 on Retina). The font atlas is rasterized at this resolution so glyphs stay crisp, but ImGui already scales the whole frame by io.DisplayFramebufferScale (the same ratio), so applyThemeToImGui cancels it via FontGlobalScale to avoid double scaling.

在文件 Theme.cpp129 行定义.

被这些函数引用 eve::ui::ImGuiBackend::init().

◆ setThemeUiScale()

void eve::ui::setThemeUiScale ( float  scale)

Logical (point-space) UI scale. Default 1.0.

在文件 Theme.cpp123 行定义.

引用了 scale.

被这些函数引用 eve::ui::ImGuiBackend::init() , 以及 eve::ui::UI::setScale().

◆ slider()

WidgetDesc eve::ui::slider ( std::string  label,
float  value,
float  minV,
float  maxV,
std::string  id,
std::function< void(float)>  onValue 
)

Horizontal slider; fires onValue.

在文件 Widget.cpp291 行定义.

引用了 d, Slider, eve::ui::WidgetDesc::type , 以及 value.

被这些函数引用 eve::ui::UI::addSlider().

◆ spacer()

WidgetDesc eve::ui::spacer ( std::string  id,
float  grow 
)

Flexible empty space; default flexGrow=1 so it absorbs free space in a Flex parent.

在文件 Widget.cpp439 行定义.

引用了 d, Spacer , 以及 eve::ui::WidgetDesc::type.

被这些函数引用 eve::ui::UI::addSpacer().

◆ text()

WidgetDesc eve::ui::text ( std::string  content,
std::string  id 
)

◆ themeDpiScale()

float eve::ui::themeDpiScale ( )

在文件 Theme.cpp133 行定义.

◆ themeUiScale()

float eve::ui::themeUiScale ( )

在文件 Theme.cpp127 行定义.

◆ viewport()

WidgetDesc eve::ui::viewport ( std::string  id = "",
float  width = 0.f,
float  height = 0.f 
)

Embedded render target widget: shows an offscreen Canvas, routes input.

在文件 Widget.cpp353 行定义.

引用了 d, height, eve::ui::WidgetDesc::type, Viewport , 以及 width.

被这些函数引用 eve::ui::UI::addViewport().

◆ virtualList()

WidgetDesc eve::ui::virtualList ( std::string  listId,
const std::vector< std::string > &  items,
float  height = 200.f,
float  itemHeight = 0.f 
)

One-line convenience: virtualized list of buttons from string items.

在文件 Widget.cpp410 行定义.

引用了 button(), eve::ui::WidgetDesc::children, height, list(), scrollList() , 以及 eve::ui::WidgetDesc::withKey().

◆ when()

WidgetDesc eve::ui::when ( bool  cond,
WidgetDesc  child 
)

Conditional: include child only when cond is true (empty group otherwise).

在文件 Widget.cpp448 行定义.

引用了 child() , 以及 group.

◆ whenElse()

WidgetDesc eve::ui::whenElse ( bool  cond,
WidgetDesc  ifTrue,
WidgetDesc  ifFalse 
)

在文件 Widget.cpp453 行定义.

◆ window()

WidgetDesc eve::ui::window ( std::string  title,
std::vector< WidgetDesc children,
std::string  id 
)