Skip to content

Commit

Permalink
refactor: move devtools related files to endstone_devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jun 30, 2024
1 parent c66ccc1 commit 748f9c5
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 666 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ if (ENDSTONE_DEVTOOLS_ENABLED)
add_library(endstone_devtools ${ENDSTONE_DEVTOOLS_SOURCE_FILES})
add_library(endstone::devtools ALIAS endstone_devtools)

target_include_directories(endstone_devtools PRIVATE "include/endstone/detail/devtools/imgui")
target_link_libraries(endstone_devtools PUBLIC endstone::core GLEW::GLEW glfw imgui::imgui)

include(GNUInstallDirs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,8 @@

#pragma once

#ifndef ENDSTONE_DISABLE_DEVTOOLS

#include <nlohmann/json.hpp>

#include "endstone/detail/server.h"

namespace endstone::detail {
class DevTools {
public:
static void render();
static void show();
static void hide();

private:
static void showAboutWindow(bool *open);
static void showBlockWindow(bool *open, EndstoneServer *server, nlohmann::json &block_types,
nlohmann::json &block_states, nlohmann::json &block_tags, nlohmann::json &materials);
static void showItemWindow(bool *open, EndstoneServer *server, nlohmann::json &items, nlohmann::json &item_tags);
};
} // namespace endstone::detail

#endif
namespace endstone::detail::devtools {
void render();
void show();
void hide();
} // namespace endstone::detail::devtools
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include "endstone/detail/command/endstone_command.h"

namespace endstone::detail {
class DebugCommand : public EndstoneCommand {
class DevToolsCommand : public EndstoneCommand {
public:
DebugCommand();
DevToolsCommand();
bool execute(CommandSender &sender, const std::vector<std::string> &args) const override;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ inline std::string ImGui::FileBrowser::u8StrToStr(std::string s)

#endif // #ifndef WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <Windows.h>

#ifdef IMGUI_FILEBROWSER_UNDEF_WIN32_LEAN_AND_MEAN
#undef IMGUI_FILEBROWSER_UNDEF_WIN32_LEAN_AND_MEAN
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ extern "C" {
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
#include <Windows.h>
#endif
#ifndef APIENTRY
#define APIENTRY
Expand Down
6 changes: 4 additions & 2 deletions src/endstone_core/command/command_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#include "endstone/detail/command/bedrock_command.h"
#include "endstone/detail/command/command_adapter.h"
#include "endstone/detail/command/command_usage_parser.h"
#include "endstone/detail/command/defaults/debug_command.h"
#include "endstone/detail/command/defaults/plugins_command.h"
#include "endstone/detail/command/defaults/version_command.h"
#include "endstone/detail/devtools/devtools_command.h"
#include "endstone/detail/permissions/default_permissions.h"
#include "endstone/detail/server.h"

Expand Down Expand Up @@ -64,9 +64,11 @@ Command *EndstoneCommandMap::getCommand(std::string name) const

void EndstoneCommandMap::setDefaultCommands()
{
registerCommand(std::make_unique<DebugCommand>());
registerCommand(std::make_unique<PluginsCommand>());
registerCommand(std::make_unique<VersionCommand>());
#ifdef ENDSTONE_DEVTOOLS
registerCommand(std::make_unique<DevToolsCommand>());
#endif
}

void EndstoneCommandMap::setMinecraftCommands()
Expand Down
Loading

0 comments on commit 748f9c5

Please sign in to comment.