Embedding game process in editor
This commit is contained in:
@@ -37,6 +37,10 @@
|
||||
#include "scene/debugger/scene_debugger.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
|
||||
class EmbeddedProcess;
|
||||
class VSeparator;
|
||||
class WindowWrapper;
|
||||
|
||||
class GameViewDebugger : public EditorDebuggerPlugin {
|
||||
GDCLASS(GameViewDebugger, EditorDebuggerPlugin);
|
||||
|
||||
@@ -82,11 +86,24 @@ class GameView : public VBoxContainer {
|
||||
CAMERA_RESET_3D,
|
||||
CAMERA_MODE_INGAME,
|
||||
CAMERA_MODE_EDITORS,
|
||||
EMBED_RUN_GAME_EMBEDDED,
|
||||
EMBED_MAKE_FLOATING_ON_PLAY,
|
||||
};
|
||||
|
||||
inline static GameView *singleton = nullptr;
|
||||
|
||||
Ref<GameViewDebugger> debugger;
|
||||
WindowWrapper *window_wrapper = nullptr;
|
||||
|
||||
int active_sessions = 0;
|
||||
int screen_index_before_start = -1;
|
||||
|
||||
bool embed_on_play = true;
|
||||
bool make_floating_on_play = true;
|
||||
|
||||
Rect2i floating_window_rect;
|
||||
int floating_window_screen = -1;
|
||||
Rect2i floating_window_screen_rect;
|
||||
|
||||
Button *suspend_button = nullptr;
|
||||
Button *next_frame_button = nullptr;
|
||||
@@ -99,7 +116,14 @@ class GameView : public VBoxContainer {
|
||||
Button *camera_override_button = nullptr;
|
||||
MenuButton *camera_override_menu = nullptr;
|
||||
|
||||
VSeparator *embedding_separator = nullptr;
|
||||
Button *keep_aspect_button = nullptr;
|
||||
MenuButton *embed_options_menu = nullptr;
|
||||
Label *game_size_label = nullptr;
|
||||
|
||||
Panel *panel = nullptr;
|
||||
EmbeddedProcess *embedded_process = nullptr;
|
||||
Label *state_label = nullptr;
|
||||
|
||||
void _sessions_changed();
|
||||
|
||||
@@ -109,12 +133,31 @@ class GameView : public VBoxContainer {
|
||||
|
||||
void _node_type_pressed(int p_option);
|
||||
void _select_mode_pressed(int p_option);
|
||||
void _embed_options_menu_menu_id_pressed(int p_id);
|
||||
void _keep_aspect_button_pressed();
|
||||
|
||||
void _play_pressed();
|
||||
static void _instance_starting_static(int p_idx, List<String> &r_arguments);
|
||||
void _instance_starting(int p_idx, List<String> &r_arguments);
|
||||
void _stop_pressed();
|
||||
void _embedding_completed();
|
||||
void _embedding_failed();
|
||||
void _embedded_process_updated();
|
||||
void _project_settings_changed();
|
||||
|
||||
void _update_ui();
|
||||
void _update_embed_menu_options();
|
||||
void _update_embed_window_size();
|
||||
void _update_arguments_for_instance(int p_idx, List<String> &r_arguments);
|
||||
|
||||
void _hide_selection_toggled(bool p_pressed);
|
||||
|
||||
void _camera_override_button_toggled(bool p_pressed);
|
||||
void _camera_override_menu_id_pressed(int p_id);
|
||||
|
||||
void _window_before_closing();
|
||||
void _update_floating_window_settings();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
@@ -122,16 +165,26 @@ public:
|
||||
void set_state(const Dictionary &p_state);
|
||||
Dictionary get_state() const;
|
||||
|
||||
GameView(Ref<GameViewDebugger> p_debugger);
|
||||
void set_window_layout(Ref<ConfigFile> p_layout);
|
||||
void get_window_layout(Ref<ConfigFile> p_layout);
|
||||
|
||||
GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper);
|
||||
};
|
||||
|
||||
class GameViewPlugin : public EditorPlugin {
|
||||
GDCLASS(GameViewPlugin, EditorPlugin);
|
||||
|
||||
GameView *game_view = nullptr;
|
||||
WindowWrapper *window_wrapper = nullptr;
|
||||
|
||||
Ref<GameViewDebugger> debugger;
|
||||
|
||||
String last_editor;
|
||||
|
||||
void _window_visibility_changed(bool p_visible);
|
||||
void _save_last_editor(const String &p_editor);
|
||||
void _focus_another_editor();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
@@ -141,6 +194,10 @@ public:
|
||||
virtual void edit(Object *p_object) override {}
|
||||
virtual bool handles(Object *p_object) const override { return false; }
|
||||
virtual void make_visible(bool p_visible) override;
|
||||
virtual void selected_notify() override;
|
||||
|
||||
virtual void set_window_layout(Ref<ConfigFile> p_layout) override;
|
||||
virtual void get_window_layout(Ref<ConfigFile> p_layout) override;
|
||||
|
||||
virtual void set_state(const Dictionary &p_state) override;
|
||||
virtual Dictionary get_state() const override;
|
||||
|
||||
Reference in New Issue
Block a user