feat: add top run toolbar controls
This commit is contained in:
@@ -176,6 +176,26 @@ inline ActionBinding MakeTogglePlayModeAction(EditorRuntimeMode mode, bool enabl
|
||||
Shortcut(ImGuiKey_F5));
|
||||
}
|
||||
|
||||
inline ActionBinding MakeStartPlayModeAction(EditorRuntimeMode mode, bool hasActiveScene = true) {
|
||||
return MakeAction(
|
||||
"Play",
|
||||
"F5",
|
||||
IsEditorRuntimeActive(mode),
|
||||
mode == EditorRuntimeMode::Edit && hasActiveScene,
|
||||
false,
|
||||
Shortcut(ImGuiKey_F5));
|
||||
}
|
||||
|
||||
inline ActionBinding MakeStopPlayModeAction(EditorRuntimeMode mode) {
|
||||
return MakeAction(
|
||||
"Stop",
|
||||
"F5",
|
||||
false,
|
||||
IsEditorRuntimeActive(mode),
|
||||
false,
|
||||
Shortcut(ImGuiKey_F5));
|
||||
}
|
||||
|
||||
inline ActionBinding MakeTogglePauseModeAction(EditorRuntimeMode mode, bool enabled = true) {
|
||||
const bool paused = mode == EditorRuntimeMode::Paused;
|
||||
return MakeAction(
|
||||
|
||||
@@ -62,15 +62,31 @@ inline void RequestDockLayoutReset(IEditorContext& context) {
|
||||
context.GetEventBus().Publish(DockLayoutResetRequestedEvent{});
|
||||
}
|
||||
|
||||
inline void RequestTogglePlayMode(IEditorContext& context) {
|
||||
if (context.GetRuntimeMode() == EditorRuntimeMode::Edit) {
|
||||
context.GetEventBus().Publish(PlayModeStartRequestedEvent{});
|
||||
inline void RequestStartPlayMode(IEditorContext& context) {
|
||||
if (context.GetRuntimeMode() != EditorRuntimeMode::Edit) {
|
||||
return;
|
||||
}
|
||||
|
||||
context.GetEventBus().Publish(PlayModeStartRequestedEvent{});
|
||||
}
|
||||
|
||||
inline void RequestStopPlayMode(IEditorContext& context) {
|
||||
if (!IsEditorRuntimeActive(context.GetRuntimeMode())) {
|
||||
return;
|
||||
}
|
||||
|
||||
context.GetEventBus().Publish(PlayModeStopRequestedEvent{});
|
||||
}
|
||||
|
||||
inline void RequestTogglePlayMode(IEditorContext& context) {
|
||||
if (context.GetRuntimeMode() == EditorRuntimeMode::Edit) {
|
||||
RequestStartPlayMode(context);
|
||||
return;
|
||||
}
|
||||
|
||||
RequestStopPlayMode(context);
|
||||
}
|
||||
|
||||
inline void RequestTogglePauseMode(IEditorContext& context) {
|
||||
if (context.GetRuntimeMode() == EditorRuntimeMode::Play) {
|
||||
context.GetEventBus().Publish(PlayModePauseRequestedEvent{});
|
||||
|
||||
Reference in New Issue
Block a user