Improved android networking
This commit is contained in:
parent
a533494b3a
commit
ad1844adc7
27 changed files with 568 additions and 69 deletions
|
|
@ -83,3 +83,14 @@ void DesktopDrawingProgramScreen::open_file_selector(const std::string& filePick
|
|||
else
|
||||
toolbar.open_file_selector_non_native(filePickerName, extensionFilters, postSelectionFunc, fileName, isSaving);
|
||||
}
|
||||
|
||||
void DesktopDrawingProgramScreen::on_tab_close() {
|
||||
if(main.worlds.empty())
|
||||
main.create_new_tab({
|
||||
.isClient = false
|
||||
});
|
||||
else if(main.world)
|
||||
main.worldIndex = std::find(main.worlds.begin(), main.worlds.end(), main.world) - main.worlds.begin();
|
||||
else
|
||||
main.switch_to_tab(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class DesktopDrawingProgramScreen : public DrawingProgramScreen {
|
|||
virtual void input_key_callback(const InputManager::KeyCallbackArgs& key) override;
|
||||
virtual void input_text_key_callback(const InputManager::KeyCallbackArgs& key) override;
|
||||
virtual void open_file_selector(const std::string& filePickerName, const std::vector<ExtensionFilter>& extensionFilters, OpenFileSelectorCallback postSelectionFunc, const std::string& fileName = "", bool isSaving = false) override;
|
||||
virtual void on_tab_close() override;
|
||||
|
||||
private:
|
||||
Toolbar toolbar;
|
||||
|
|
|
|||
|
|
@ -220,6 +220,9 @@ void FileSelectScreen::main_display() {
|
|||
case SelectedMenu::TRASH:
|
||||
file_view();
|
||||
break;
|
||||
case SelectedMenu::CONNECT:
|
||||
connect_view();
|
||||
break;
|
||||
case SelectedMenu::SETTINGS:
|
||||
settings_view();
|
||||
break;
|
||||
|
|
@ -491,13 +494,16 @@ void FileSelectScreen::title_bar() {
|
|||
});
|
||||
switch(selectedMenu) {
|
||||
case SelectedMenu::FILES:
|
||||
mutable_text_label(gui, "main screen header text", "Files");
|
||||
mutable_text_label(gui, "main screen header text files", "Files");
|
||||
break;
|
||||
case SelectedMenu::TRASH:
|
||||
mutable_text_label(gui, "main screen header text", "Trash");
|
||||
mutable_text_label(gui, "main screen header text trash", "Trash");
|
||||
break;
|
||||
case SelectedMenu::CONNECT:
|
||||
mutable_text_label(gui, "main screen header text connect", "Connect");
|
||||
break;
|
||||
case SelectedMenu::SETTINGS:
|
||||
mutable_text_label(gui, "main screen header text", "Settings");
|
||||
mutable_text_label(gui, "main screen header text settings", "Settings");
|
||||
break;
|
||||
}
|
||||
CLAY_AUTO_ID({
|
||||
|
|
@ -696,6 +702,11 @@ void FileSelectScreen::main_menu() {
|
|||
mainMenuOpenAnim->animation_trigger_reverse();
|
||||
if(mainViewScrollArea) mainViewScrollArea->reset_scroll();
|
||||
});
|
||||
icon_text_transparent_option_selected_button("Connect", "data/icons/network.svg", "Connect", selectedMenu == SelectedMenu::CONNECT, [&] {
|
||||
selectedMenu = SelectedMenu::CONNECT;
|
||||
mainMenuOpenAnim->animation_trigger_reverse();
|
||||
if(mainViewScrollArea) mainViewScrollArea->reset_scroll();
|
||||
});
|
||||
icon_text_transparent_option_selected_button("Settings", "data/icons/RemixIcon/settings-3-line.svg", "Settings", selectedMenu == SelectedMenu::SETTINGS, [&] {
|
||||
selectedMenu = SelectedMenu::SETTINGS;
|
||||
mainMenuOpenAnim->animation_trigger_reverse();
|
||||
|
|
@ -854,6 +865,50 @@ void FileSelectScreen::file_view() {
|
|||
}
|
||||
}
|
||||
|
||||
void FileSelectScreen::connect_view() {
|
||||
auto& gui = main.g.gui;
|
||||
|
||||
mainViewScrollArea = gui.element<ScrollArea>("connect scroll area", ScrollArea::Options{
|
||||
.scrollVertical = true,
|
||||
.clipVertical = true,
|
||||
.scrollbarY = ScrollArea::ScrollbarType::NORMAL,
|
||||
.innerContent = [&] (auto&) {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)},
|
||||
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||
},
|
||||
}) {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_GROW(0, 300), .height = CLAY_SIZING_GROW(0)},
|
||||
.childGap = gui.io.theme->childGap1,
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
}) {
|
||||
input_text_field(gui, "Connect lobby field", "Lobby", &connectLobbyStr);
|
||||
text_button(gui, "Connect button", "Connect", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
CustomEvents::emit_event<CustomEvents::OpenInfiniPaintFileEvent>({
|
||||
.isClient = true,
|
||||
.netSource = connectLobbyStr
|
||||
});
|
||||
}
|
||||
});
|
||||
text_button(gui, "Paste and Connect button", "Paste & Connect", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
connectOnPaste = true;
|
||||
main.input.call_paste(CustomEvents::PasteEvent::DataType::TEXT, { .allowRichText = false });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void FileSelectScreen::settings_view() {
|
||||
auto& gui = main.g.gui;
|
||||
|
||||
|
|
@ -875,6 +930,7 @@ void FileSelectScreen::settings_view() {
|
|||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
}) {
|
||||
input_text_field(gui, "display name input", "Display name", &main.conf.displayName);
|
||||
color_picker_button_field(gui, "defaultCanvasBackgroundColor", "Default canvas background color", &main.conf.defaultCanvasBackgroundColor, { .hasAlpha = false });
|
||||
input_scalar_field(gui, "Max GUI Scale", "Max GUI Scale", &main.conf.guiScale, 1.0f, 2.0f, {
|
||||
.decimalPrecision = 1,
|
||||
|
|
@ -926,6 +982,15 @@ void FileSelectScreen::start_edit_mode() {
|
|||
editMode = true;
|
||||
}
|
||||
|
||||
void FileSelectScreen::input_paste_callback(const CustomEvents::PasteEvent& paste) {
|
||||
if(connectOnPaste && paste.type == CustomEvents::PasteEvent::DataType::TEXT) {
|
||||
CustomEvents::emit_event<CustomEvents::OpenInfiniPaintFileEvent>({
|
||||
.isClient = true,
|
||||
.netSource = paste.data
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void FileSelectScreen::input_open_infinipaint_file_callback(const CustomEvents::OpenInfiniPaintFileEvent& openFile) {
|
||||
main.create_new_tab(openFile);
|
||||
main.set_screen([&] (std::unique_ptr<Screen>) { return std::make_unique<PhoneDrawingProgramScreen>(main); });
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class FileSelectScreen : public Screen {
|
|||
FileSelectScreen(MainProgram& m);
|
||||
virtual void gui_layout_run() override;
|
||||
virtual void draw(SkCanvas* canvas) override;
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste) override;
|
||||
virtual void input_open_infinipaint_file_callback(const CustomEvents::OpenInfiniPaintFileEvent& openFile) override;
|
||||
virtual void input_global_back_button_callback() override;
|
||||
virtual void input_app_about_to_go_to_background_callback() override;
|
||||
|
|
@ -65,6 +66,9 @@ class FileSelectScreen : public Screen {
|
|||
|
||||
void save_files();
|
||||
|
||||
bool connectOnPaste = false;
|
||||
std::string connectLobbyStr;
|
||||
|
||||
struct FileInfo {
|
||||
std::string fileName;
|
||||
SDL_Time lastModifyTime;
|
||||
|
|
@ -85,6 +89,7 @@ class FileSelectScreen : public Screen {
|
|||
void main_display();
|
||||
void main_menu();
|
||||
void file_view();
|
||||
void connect_view();
|
||||
void settings_view();
|
||||
void create_file_button();
|
||||
void file_view_edit();
|
||||
|
|
@ -115,6 +120,7 @@ class FileSelectScreen : public Screen {
|
|||
enum class SelectedMenu {
|
||||
FILES,
|
||||
TRASH,
|
||||
CONNECT,
|
||||
SETTINGS
|
||||
} selectedMenu = SelectedMenu::FILES;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "../GUIStuff/ElementHelpers/TextLabelHelpers.hpp"
|
||||
#include "../GUIStuff/ElementHelpers/TextBoxHelpers.hpp"
|
||||
#include "FileSelectScreen.hpp"
|
||||
#include "../NetThreadManager.hpp"
|
||||
#include <Helpers/Logger.hpp>
|
||||
|
||||
using namespace GUIStuff;
|
||||
|
|
@ -71,9 +72,21 @@ void PhoneDrawingProgramScreen::center_message(const char* id, const std::string
|
|||
}
|
||||
|
||||
void PhoneDrawingProgramScreen::gui_layout_run() {
|
||||
gui_layout_safety_checks();
|
||||
main_display();
|
||||
}
|
||||
|
||||
void PhoneDrawingProgramScreen::gui_layout_safety_checks() {
|
||||
if(!main.world->netServer) {
|
||||
if(topToolbarSettingsPopup == TopToolbarSettingsPopup::LOBBY_INFO)
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}
|
||||
if(!main.world->netClient && !main.world->netServer) {
|
||||
if(topToolbarSettingsPopup == TopToolbarSettingsPopup::PLAYER_LIST)
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void PhoneDrawingProgramScreen::main_display() {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
|
|
@ -83,18 +96,22 @@ void PhoneDrawingProgramScreen::main_display() {
|
|||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
}) {
|
||||
if(hideGUI)
|
||||
hidden_gui();
|
||||
if(main.world->netClient && main.world->clientStillConnecting)
|
||||
center_message("Connecting to server message", "Connecting to server...");
|
||||
else {
|
||||
top_toolbar();
|
||||
top_toolbar_settings_popup();
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)}}
|
||||
}) {}
|
||||
bottom_toolbar();
|
||||
if(hideGUI)
|
||||
hidden_gui();
|
||||
else {
|
||||
top_toolbar();
|
||||
top_toolbar_settings_popup();
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)}}
|
||||
}) {}
|
||||
bottom_toolbar();
|
||||
}
|
||||
if(!main.world->drawProg.layerMan.is_a_layer_being_edited())
|
||||
center_message("Select layer to edit message", "Select a layer to edit");
|
||||
}
|
||||
if(!main.world->drawProg.layerMan.is_a_layer_being_edited())
|
||||
center_message("Select layer to edit message", "Select a layer to edit");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -241,6 +258,97 @@ void PhoneDrawingProgramScreen::top_toolbar_settings_popup() {
|
|||
});
|
||||
break;
|
||||
}
|
||||
case TopToolbarSettingsPopup::LOBBY_INFO: {
|
||||
gui.set_z_index(gui.get_z_index() + 20, [&] {
|
||||
gui.element<LayoutElement>("host lobby info menu", [&] (LayoutElement*, const Clay_ElementId& lId) {
|
||||
Vector2f popupSize = {
|
||||
std::clamp(gui.io.safeWindowRect.width() - 10.0f, 20.0f, 300.0f),
|
||||
std::clamp(gui.io.safeWindowRect.height() - 40.0f, 50.0f, 600.0f)
|
||||
};
|
||||
CLAY(lId, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIT(popupSize.x()), .height = CLAY_SIZING_FIT(0, popupSize.y()) },
|
||||
.padding = CLAY_PADDING_ALL(io.theme->padding1),
|
||||
.childGap = io.theme->childGap1,
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP},
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1),
|
||||
.floating = {.offset = {.x = 0, .y = static_cast<float>(io.theme->padding1)}, .zIndex = gui.get_z_index(), .attachPoints = {.element = CLAY_ATTACH_POINT_RIGHT_TOP, .parent = CLAY_ATTACH_POINT_RIGHT_BOTTOM}, .attachTo = CLAY_ATTACH_TO_PARENT}
|
||||
}) {
|
||||
text_label_centered(gui, "Lobby Info");
|
||||
input_text_field(gui, "lobby", "Lobby", &serverToConnectTo, {
|
||||
.immutable = true
|
||||
});
|
||||
text_button(gui, "Copy button", "Copy", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
main.input.set_clipboard_str(serverToConnectTo);
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
case TopToolbarSettingsPopup::PLAYER_LIST: {
|
||||
gui.set_z_index(gui.get_z_index() + 20, [&] {
|
||||
gui.element<LayoutElement>("player list menu", [&] (LayoutElement*, const Clay_ElementId& lId) {
|
||||
Vector2f popupSize = {
|
||||
std::clamp(gui.io.safeWindowRect.width() - 10.0f, 20.0f, 300.0f),
|
||||
std::clamp(gui.io.safeWindowRect.height() - 40.0f, 50.0f, 600.0f)
|
||||
};
|
||||
CLAY(lId, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIT(popupSize.x()), .height = CLAY_SIZING_FIT(0, popupSize.y()) },
|
||||
.padding = CLAY_PADDING_ALL(io.theme->padding1),
|
||||
.childGap = io.theme->childGap1,
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP},
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1),
|
||||
.floating = {.offset = {.x = 0, .y = static_cast<float>(io.theme->padding1)}, .zIndex = gui.get_z_index(), .attachPoints = {.element = CLAY_ATTACH_POINT_RIGHT_TOP, .parent = CLAY_ATTACH_POINT_RIGHT_BOTTOM}, .attachTo = CLAY_ATTACH_TO_PARENT}
|
||||
}) {
|
||||
text_label_centered(gui, "Player List");
|
||||
left_to_right_line_layout(gui, [&]() {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(20), .height = CLAY_SIZING_FIXED(20)}
|
||||
},
|
||||
.backgroundColor = convert_vec4<Clay_Color>(SkColor4f{main.world->ownClientData->get_cursor_color().x(), main.world->ownClientData->get_cursor_color().y(), main.world->ownClientData->get_cursor_color().z(), 1.0f}),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(3)
|
||||
}) {}
|
||||
ellipse_wide_paragraph_label(gui, "own player name", main.world->ownClientData->get_display_name());
|
||||
});
|
||||
size_t num = 0;
|
||||
for(auto& client : main.world->clients->get_data()) {
|
||||
if(client != main.world->ownClientData) {
|
||||
gui.new_id(num++, [&] {
|
||||
left_to_right_line_layout(gui, [&]() {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(20), .height = CLAY_SIZING_FIXED(20)}
|
||||
},
|
||||
.backgroundColor = convert_vec4<Clay_Color>(SkColor4f{client->get_cursor_color().x(), client->get_cursor_color().y(), client->get_cursor_color().z(), 1.0f}),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(3)
|
||||
}) {}
|
||||
ellipse_wide_paragraph_label(gui, "other player name", client->get_display_name());
|
||||
text_button(gui, "teleport button", "Jump To", { .onClick = [&] {
|
||||
main.world->drawData.cam.smooth_move_to(*main.world, client->get_cam_coords(), client->get_window_size());
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -268,9 +376,8 @@ void PhoneDrawingProgramScreen::top_toolbar() {
|
|||
svg_icon_button(gui, "back exit button", "data/icons/RemixIcon/arrow-left-s-line.svg", {
|
||||
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
|
||||
.onClick = [&] {
|
||||
main.world->save_to_file(main.world->filePath);
|
||||
save_to_file();
|
||||
main.set_tab_to_close(main.world.get());
|
||||
main.set_screen([&] (std::unique_ptr<Screen>) { return std::make_unique<FileSelectScreen>(main); });
|
||||
}
|
||||
});
|
||||
top_toolbar_remaining_area();
|
||||
|
|
@ -350,17 +457,24 @@ void PhoneDrawingProgramScreen::top_toolbar_remaining_area() {
|
|||
break;
|
||||
spaceForWorldName -= BUTTON_WIDTH;
|
||||
}
|
||||
input_text(gui, "world name text", &main.world->name, {
|
||||
.decorations = false,
|
||||
.onSelect = [&] {
|
||||
fileOldPath = main.world->filePath;
|
||||
},
|
||||
.onDeselect = [&] {
|
||||
std::filesystem::remove(fileOldPath);
|
||||
std::filesystem::remove(fileOldPath.parent_path() / (fileOldPath.stem().string() + ".jpg"));
|
||||
main.world->autosave_to_directory(main.world->filePath.parent_path());
|
||||
}
|
||||
});
|
||||
if(main.world->netClient) {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {.sizing = {.width = CLAY_SIZING_GROW(0)}}
|
||||
}) { }
|
||||
}
|
||||
else {
|
||||
input_text(gui, "world name text", &main.world->name, {
|
||||
.decorations = false,
|
||||
.onSelect = [&] {
|
||||
fileOldPath = main.world->filePath;
|
||||
},
|
||||
.onDeselect = [&] {
|
||||
std::filesystem::remove(fileOldPath);
|
||||
std::filesystem::remove(fileOldPath.parent_path() / (fileOldPath.stem().string() + ".jpg"));
|
||||
main.world->autosave_to_directory(main.world->filePath.parent_path());
|
||||
}
|
||||
});
|
||||
}
|
||||
gui.new_id("visible buttons", [&] {
|
||||
for(size_t i = 0; i < buttonFreeSpace; i++) {
|
||||
gui.new_id(i, [&] {
|
||||
|
|
@ -418,15 +532,37 @@ void PhoneDrawingProgramScreen::top_toolbar_hidden_button_popup(GUIStuff::Elemen
|
|||
}
|
||||
});
|
||||
|
||||
l.emplace_back(TopToolbarRemainingAreaButton{
|
||||
.name = "Host",
|
||||
.svgPath = "data/icons/network.svg",
|
||||
.onClick = [&] {
|
||||
serverLocalID = NetLibrary::get_random_server_local_id();
|
||||
serverToConnectTo = NetLibrary::get_global_id() + serverLocalID;
|
||||
topToolbarSettingsPopup = topToolbarSettingsPopup == TopToolbarSettingsPopup::HOST ? TopToolbarSettingsPopup::NONE : TopToolbarSettingsPopup::HOST;
|
||||
}
|
||||
});
|
||||
if(!main.world->netClient && !main.world->netServer) {
|
||||
l.emplace_back(TopToolbarRemainingAreaButton{
|
||||
.name = "Host",
|
||||
.svgPath = "data/icons/network.svg",
|
||||
.onClick = [&] {
|
||||
serverLocalID = NetLibrary::get_random_server_local_id();
|
||||
serverToConnectTo = NetLibrary::get_global_id() + serverLocalID;
|
||||
topToolbarSettingsPopup = topToolbarSettingsPopup == TopToolbarSettingsPopup::HOST ? TopToolbarSettingsPopup::NONE : TopToolbarSettingsPopup::HOST;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(main.world->netServer) {
|
||||
l.emplace_back(TopToolbarRemainingAreaButton{
|
||||
.name = "Lobby Info",
|
||||
.svgPath = "data/icons/network.svg",
|
||||
.onClick = [&] {
|
||||
topToolbarSettingsPopup = topToolbarSettingsPopup == TopToolbarSettingsPopup::LOBBY_INFO ? TopToolbarSettingsPopup::NONE : TopToolbarSettingsPopup::LOBBY_INFO;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(main.world->netClient || main.world->netServer) {
|
||||
l.emplace_back(TopToolbarRemainingAreaButton{
|
||||
.name = "Player List",
|
||||
.svgPath = "data/icons/list.svg",
|
||||
.onClick = [&] {
|
||||
topToolbarSettingsPopup = topToolbarSettingsPopup == TopToolbarSettingsPopup::PLAYER_LIST ? TopToolbarSettingsPopup::NONE : TopToolbarSettingsPopup::PLAYER_LIST;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
gui.set_z_index(gui.get_z_index() + 20, [&] {
|
||||
dropdown_many_element_popup_layout(gui, "top toolbar hidden button popup", {
|
||||
|
|
@ -1017,15 +1153,23 @@ void PhoneDrawingProgramScreen::input_global_back_button_callback() {
|
|||
main.g.gui.set_to_layout();
|
||||
}
|
||||
else {
|
||||
main.world->save_to_file(main.world->filePath);
|
||||
save_to_file();
|
||||
main.set_tab_to_close(main.world.get());
|
||||
main.g.gui.set_to_layout();
|
||||
main.set_screen([&] (std::unique_ptr<Screen>) { return std::make_unique<FileSelectScreen>(main); });
|
||||
}
|
||||
}
|
||||
|
||||
void PhoneDrawingProgramScreen::save_to_file() {
|
||||
if(!main.world->netClient)
|
||||
main.world->save_to_file(main.world->filePath);
|
||||
}
|
||||
|
||||
void PhoneDrawingProgramScreen::input_app_about_to_go_to_background_callback() {
|
||||
main.world->save_to_file(main.world->filePath);
|
||||
save_to_file();
|
||||
}
|
||||
|
||||
void PhoneDrawingProgramScreen::on_tab_close() {
|
||||
main.set_screen([&] (std::unique_ptr<Screen>) { return std::make_unique<FileSelectScreen>(main); });
|
||||
}
|
||||
|
||||
void PhoneDrawingProgramScreen::color_selector(Vector4f* color, const ColorSelectorData& colorSelectorData) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen {
|
|||
virtual void gui_layout_run() override;
|
||||
virtual void input_global_back_button_callback() override;
|
||||
virtual void input_app_about_to_go_to_background_callback() override;
|
||||
virtual void on_tab_close() override;
|
||||
struct ColorSelectorData {
|
||||
std::function<void()> onChange;
|
||||
std::function<void()> onSelect;
|
||||
|
|
@ -73,7 +74,9 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen {
|
|||
BOOKMARKS,
|
||||
LAYERS,
|
||||
GRIDS,
|
||||
HOST
|
||||
HOST,
|
||||
LOBBY_INFO,
|
||||
PLAYER_LIST
|
||||
} topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
|
||||
bool hideGUI = false;
|
||||
|
|
@ -82,6 +85,7 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen {
|
|||
Vector4f* colorPickerPtr = nullptr;
|
||||
ColorSelectorData colorPickerData;
|
||||
|
||||
void gui_layout_safety_checks();
|
||||
void hidden_gui();
|
||||
void center_message(const char* id, const std::string& m);
|
||||
void default_bottom_toolbar();
|
||||
|
|
@ -95,6 +99,7 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen {
|
|||
void bottom_toolbar();
|
||||
void main_display();
|
||||
void tool_settings_popup();
|
||||
void save_to_file();
|
||||
|
||||
std::string serverToConnectTo;
|
||||
std::string serverLocalID;
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ void Screen::input_finger_motion_callback(const InputManager::FingerMotionCallba
|
|||
void Screen::input_window_resize_callback(const InputManager::WindowResizeCallbackArgs& w) {}
|
||||
void Screen::input_window_scale_callback(const InputManager::WindowScaleCallbackArgs& w) {}
|
||||
void Screen::input_app_about_to_go_to_background_callback() {}
|
||||
void Screen::input_app_about_to_go_to_foreground_callback() {}
|
||||
void Screen::on_tab_close() {}
|
||||
std::optional<InputManager::TextBoxStartInfo> Screen::get_text_box_start_info() { return std::nullopt; }
|
||||
|
||||
Screen::~Screen() {}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ class Screen {
|
|||
virtual void input_window_resize_callback(const InputManager::WindowResizeCallbackArgs& w);
|
||||
virtual void input_window_scale_callback(const InputManager::WindowScaleCallbackArgs& w);
|
||||
virtual void input_app_about_to_go_to_background_callback();
|
||||
virtual void input_app_about_to_go_to_foreground_callback();
|
||||
virtual void on_tab_close();
|
||||
virtual std::optional<InputManager::TextBoxStartInfo> get_text_box_start_info();
|
||||
|
||||
virtual void open_file_selector(const std::string& filePickerName, const std::vector<ExtensionFilter>& extensionFilters, OpenFileSelectorCallback postSelectionFunc, const std::string& fileName = "", bool isSaving = false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue