From 2528a37e36ba93102236c7fc68523b6c8af7dfcc Mon Sep 17 00:00:00 2001 From: "C. J. Howard" Date: Sat, 16 Jan 2021 23:05:46 +0800 Subject: [PATCH] Move console commands from cc namespace to debug::cc namespace --- CMakeLists.txt | 1 - src/{game => debug}/console-commands.cpp | 2 ++ src/{game => debug}/console-commands.hpp | 10 +++++++--- src/game/bootloader.cpp | 10 +++++----- 4 files changed, 14 insertions(+), 9 deletions(-) rename src/{game => debug}/console-commands.cpp (97%) rename src/{game => debug}/console-commands.hpp (83%) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc40e61..d4aa351 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,6 @@ find_package(SDL2 REQUIRED COMPONENTS SDL2::SDL2-static SDL2::SDL2main CONFIG) find_package(OpenAL REQUIRED CONFIG) find_library(physfs REQUIRED NAMES physfs-static PATHS "${CMAKE_PREFIX_PATH}/lib") - # Determine dependencies set(STATIC_LIBS dr_wav diff --git a/src/game/console-commands.cpp b/src/debug/console-commands.cpp similarity index 97% rename from src/game/console-commands.cpp rename to src/debug/console-commands.cpp index 5ce363e..79b9f43 100644 --- a/src/game/console-commands.cpp +++ b/src/debug/console-commands.cpp @@ -23,6 +23,7 @@ #include "game/game-context.hpp" #include "debug/cli.hpp" +namespace debug { namespace cc { std::string echo(std::string text) @@ -53,3 +54,4 @@ std::string cue(game_context* ctx, float t, std::string command) } } // namespace cc +} // namespace debug diff --git a/src/game/console-commands.hpp b/src/debug/console-commands.hpp similarity index 83% rename from src/game/console-commands.hpp rename to src/debug/console-commands.hpp index d31767e..17bbaa5 100644 --- a/src/game/console-commands.hpp +++ b/src/debug/console-commands.hpp @@ -17,13 +17,16 @@ * along with Antkeeper source code. If not, see . */ -#ifndef ANTKEEPER_CONSOLE_COMMANDS_HPP -#define ANTKEEPER_CONSOLE_COMMANDS_HPP +#ifndef ANTKEEPER_DEBUG_CONSOLE_COMMANDS_HPP +#define ANTKEEPER_DEBUG_CONSOLE_COMMANDS_HPP #include struct game_context; +namespace debug { + +/// Console commands namespace cc { std::string echo(std::string text); @@ -35,5 +38,6 @@ std::string scrot(game_context* ctx); std::string cue(game_context* ctx, float t, std::string command); } // namespace cc +} // namespace debug -#endif // ANTKEEPER_CONSOLE_COMMANDS_HPP +#endif // ANTKEEPER_DEBUG_CONSOLE_COMMANDS_HPP diff --git a/src/game/bootloader.cpp b/src/game/bootloader.cpp index a97f103..7a7a2af 100644 --- a/src/game/bootloader.cpp +++ b/src/game/bootloader.cpp @@ -24,7 +24,7 @@ #include "animation/timeline.hpp" #include "application.hpp" #include "debug/cli.hpp" -#include "game/console-commands.hpp" +#include "debug/console-commands.hpp" #include "debug/logger.hpp" #include "game/game-context.hpp" #include "rasterizer/framebuffer.hpp" @@ -1238,10 +1238,10 @@ void setup_controls(game_context* ctx) void setup_cli(game_context* ctx) { ctx->cli = new debug::cli(); - ctx->cli->register_command("echo", cc::echo); - ctx->cli->register_command("exit", std::function(std::bind(&cc::exit, ctx))); - ctx->cli->register_command("scrot", std::function(std::bind(&cc::scrot, ctx))); - ctx->cli->register_command("cue", std::function(std::bind(&cc::cue, ctx, std::placeholders::_1, std::placeholders::_2))); + ctx->cli->register_command("echo", debug::cc::echo); + ctx->cli->register_command("exit", std::function(std::bind(&debug::cc::exit, ctx))); + ctx->cli->register_command("scrot", std::function(std::bind(&debug::cc::scrot, ctx))); + ctx->cli->register_command("cue", std::function(std::bind(&debug::cc::cue, ctx, std::placeholders::_1, std::placeholders::_2))); //std::string cmd = "cue 20 exit"; //logger->log(cmd); //logger->log(cli.interpret(cmd));