Make connecting client GUI, and added warning when no layers are selected
This commit is contained in:
parent
e760834592
commit
777b6540db
3 changed files with 150 additions and 99 deletions
|
|
@ -371,6 +371,7 @@ void Toolbar::update() {
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
top_toolbar();
|
top_toolbar();
|
||||||
|
if(!main.world->clientStillConnecting)
|
||||||
drawing_program_gui();
|
drawing_program_gui();
|
||||||
if(viewWebVersionWelcome)
|
if(viewWebVersionWelcome)
|
||||||
web_version_welcome();
|
web_version_welcome();
|
||||||
|
|
@ -382,14 +383,21 @@ void Toolbar::update() {
|
||||||
file_picker_gui();
|
file_picker_gui();
|
||||||
else if(optionsMenuOpen)
|
else if(optionsMenuOpen)
|
||||||
options_menu();
|
options_menu();
|
||||||
|
else if(main.world->clientStillConnecting)
|
||||||
|
still_connecting_center_message();
|
||||||
else if(playerMenuOpen)
|
else if(playerMenuOpen)
|
||||||
player_list();
|
player_list();
|
||||||
|
else if(!main.world->drawProg.layerMan.is_a_layer_being_edited())
|
||||||
|
no_layers_being_edited_message();
|
||||||
|
|
||||||
if(showPerformance)
|
if(showPerformance)
|
||||||
performance_metrics();
|
performance_metrics();
|
||||||
}
|
}
|
||||||
|
if(!main.world->clientStillConnecting)
|
||||||
chat_box();
|
chat_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!main.world->clientStillConnecting) {
|
||||||
if(io->hoverObstructed && (io->mouse.leftClick || io->mouse.rightClick))
|
if(io->hoverObstructed && (io->mouse.leftClick || io->mouse.rightClick))
|
||||||
rightClickPopupLocation = std::nullopt;
|
rightClickPopupLocation = std::nullopt;
|
||||||
|
|
||||||
|
|
@ -400,6 +408,7 @@ void Toolbar::update() {
|
||||||
|
|
||||||
if(io->hoverObstructed && io->mouse.rightClick) // This runs specifically if the paint popup has the cursor
|
if(io->hoverObstructed && io->mouse.rightClick) // This runs specifically if the paint popup has the cursor
|
||||||
rightClickPopupLocation = std::nullopt;
|
rightClickPopupLocation = std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
end_gui();
|
end_gui();
|
||||||
|
|
||||||
|
|
@ -477,6 +486,7 @@ void Toolbar::top_toolbar() {
|
||||||
tabNames.emplace_back(main.worlds[i]->netObjMan.is_connected() ? "data/icons/network.svg" : "", main.worlds[i]->name);
|
tabNames.emplace_back(main.worlds[i]->netObjMan.is_connected() ? "data/icons/network.svg" : "", main.worlds[i]->name);
|
||||||
std::optional<size_t> closedTab;
|
std::optional<size_t> closedTab;
|
||||||
gui.tab_list("file tab list", tabNames, main.worldIndex, closedTab);
|
gui.tab_list("file tab list", tabNames, main.worldIndex, closedTab);
|
||||||
|
if(!main.world->clientStillConnecting) {
|
||||||
if(main.world->netObjMan.is_connected() && gui.svg_icon_button_transparent("Player List Toggle Button", "data/icons/list.svg", playerMenuOpen))
|
if(main.world->netObjMan.is_connected() && gui.svg_icon_button_transparent("Player List Toggle Button", "data/icons/list.svg", playerMenuOpen))
|
||||||
playerMenuOpen = !playerMenuOpen;
|
playerMenuOpen = !playerMenuOpen;
|
||||||
if(gui.svg_icon_button_transparent("Menu Undo Button", "data/icons/undo.svg"))
|
if(gui.svg_icon_button_transparent("Menu Undo Button", "data/icons/undo.svg"))
|
||||||
|
|
@ -521,6 +531,7 @@ void Toolbar::top_toolbar() {
|
||||||
bookmark_menu(bookmarkMenuPopUpJustOpen);
|
bookmark_menu(bookmarkMenuPopUpJustOpen);
|
||||||
if(layerMenuPopupOpen)
|
if(layerMenuPopupOpen)
|
||||||
layer_menu(layerMenuPopUpJustOpen);
|
layer_menu(layerMenuPopUpJustOpen);
|
||||||
|
}
|
||||||
if(menuPopUpOpen) {
|
if(menuPopUpOpen) {
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
|
|
@ -540,12 +551,13 @@ void Toolbar::top_toolbar() {
|
||||||
.isClient = false
|
.isClient = false
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
if(gui.text_button_left_transparent("open file", "Open"))
|
||||||
|
open_world_file(false, "", "");
|
||||||
|
if(!main.world->clientStillConnecting) {
|
||||||
if(gui.text_button_left_transparent("save file", "Save"))
|
if(gui.text_button_left_transparent("save file", "Save"))
|
||||||
save_func();
|
save_func();
|
||||||
if(gui.text_button_left_transparent("save as file", "Save As"))
|
if(gui.text_button_left_transparent("save as file", "Save As"))
|
||||||
save_as_func();
|
save_as_func();
|
||||||
if(gui.text_button_left_transparent("open file", "Open"))
|
|
||||||
open_world_file(false, "", "");
|
|
||||||
if(gui.text_button_left_transparent("screenshot", "Take Screenshot"))
|
if(gui.text_button_left_transparent("screenshot", "Take Screenshot"))
|
||||||
main.world->drawProg.switch_to_tool(DrawingProgramToolType::SCREENSHOT);
|
main.world->drawProg.switch_to_tool(DrawingProgramToolType::SCREENSHOT);
|
||||||
if(gui.text_button_left_transparent("add image or file to canvas", "Add Image/File to Canvas")) {
|
if(gui.text_button_left_transparent("add image or file to canvas", "Add Image/File to Canvas")) {
|
||||||
|
|
@ -583,15 +595,16 @@ void Toolbar::top_toolbar() {
|
||||||
optionsMenuOpen = true;
|
optionsMenuOpen = true;
|
||||||
optionsMenuType = HOST_MENU;
|
optionsMenuType = HOST_MENU;
|
||||||
}
|
}
|
||||||
|
if(gui.text_button_left_transparent("canvas specific settings", "Canvas Settings")) {
|
||||||
|
optionsMenuOpen = true;
|
||||||
|
optionsMenuType = CANVAS_SETTINGS_MENU;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(gui.text_button_left_transparent("start connecting", "Connect")) {
|
if(gui.text_button_left_transparent("start connecting", "Connect")) {
|
||||||
serverToConnectTo.clear();
|
serverToConnectTo.clear();
|
||||||
optionsMenuOpen = true;
|
optionsMenuOpen = true;
|
||||||
optionsMenuType = CONNECT_MENU;
|
optionsMenuType = CONNECT_MENU;
|
||||||
}
|
}
|
||||||
if(gui.text_button_left_transparent("canvas specific settings", "Canvas Settings")) {
|
|
||||||
optionsMenuOpen = true;
|
|
||||||
optionsMenuType = CANVAS_SETTINGS_MENU;
|
|
||||||
}
|
|
||||||
if(gui.text_button_left_transparent("open options", "Settings")) {
|
if(gui.text_button_left_transparent("open options", "Settings")) {
|
||||||
optionsMenuOpen = true;
|
optionsMenuOpen = true;
|
||||||
optionsMenuType = GENERAL_SETTINGS_MENU;
|
optionsMenuType = GENERAL_SETTINGS_MENU;
|
||||||
|
|
@ -643,6 +656,40 @@ If you like this app, consider downloading the native version for your system)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Toolbar::still_connecting_center_message() {
|
||||||
|
CLAY_AUTO_ID({
|
||||||
|
.layout = {
|
||||||
|
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) },
|
||||||
|
.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 = {.attachPoints = {.element = CLAY_ATTACH_POINT_CENTER_CENTER, .parent = CLAY_ATTACH_POINT_CENTER_CENTER}, .attachTo = CLAY_ATTACH_TO_PARENT}
|
||||||
|
}) {
|
||||||
|
gui.text_label("Connecting to server...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Toolbar::no_layers_being_edited_message() {
|
||||||
|
CLAY_AUTO_ID({
|
||||||
|
.layout = {
|
||||||
|
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) },
|
||||||
|
.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 = {.attachPoints = {.element = CLAY_ATTACH_POINT_CENTER_CENTER, .parent = CLAY_ATTACH_POINT_CENTER_CENTER}, .attachTo = CLAY_ATTACH_TO_PARENT}
|
||||||
|
}) {
|
||||||
|
gui.text_label("Select a layer to edit");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
void Toolbar::update_notification_check() {
|
void Toolbar::update_notification_check() {
|
||||||
if(!updateCheckerData.updateCheckDone) {
|
if(!updateCheckerData.updateCheckDone) {
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,8 @@ class Toolbar {
|
||||||
void load_default_theme();
|
void load_default_theme();
|
||||||
void about_menu_gui();
|
void about_menu_gui();
|
||||||
void web_version_welcome();
|
void web_version_welcome();
|
||||||
|
void still_connecting_center_message();
|
||||||
|
void no_layers_being_edited_message();
|
||||||
|
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
void update_notification_gui();
|
void update_notification_gui();
|
||||||
|
|
|
||||||
|
|
@ -548,6 +548,7 @@ void World::list_debug_test_update() {
|
||||||
|
|
||||||
void World::draw(SkCanvas* canvas) {
|
void World::draw(SkCanvas* canvas) {
|
||||||
drawData.refresh_draw_optimizing_values();
|
drawData.refresh_draw_optimizing_values();
|
||||||
|
if(!clientStillConnecting) {
|
||||||
if(drawData.drawGrids)
|
if(drawData.drawGrids)
|
||||||
gridMan.draw_back(canvas, drawData);
|
gridMan.draw_back(canvas, drawData);
|
||||||
drawProg.draw(canvas, drawData);
|
drawProg.draw(canvas, drawData);
|
||||||
|
|
@ -557,3 +558,4 @@ void World::draw(SkCanvas* canvas) {
|
||||||
}
|
}
|
||||||
draw_other_player_cursors(canvas, drawData);
|
draw_other_player_cursors(canvas, drawData);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue