Browse Source

Move console commands from cc namespace to debug::cc namespace

master
C. J. Howard 3 years ago
parent
commit
2528a37e36
4 changed files with 14 additions and 9 deletions
  1. +0
    -1
      CMakeLists.txt
  2. +2
    -0
      src/debug/console-commands.cpp
  3. +7
    -3
      src/debug/console-commands.hpp
  4. +5
    -5
      src/game/bootloader.cpp

+ 0
- 1
CMakeLists.txt View File

@ -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

src/game/console-commands.cpp → src/debug/console-commands.cpp View File

@ -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

src/game/console-commands.hpp → src/debug/console-commands.hpp View File

@ -17,13 +17,16 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_CONSOLE_COMMANDS_HPP
#define ANTKEEPER_CONSOLE_COMMANDS_HPP
#ifndef ANTKEEPER_DEBUG_CONSOLE_COMMANDS_HPP
#define ANTKEEPER_DEBUG_CONSOLE_COMMANDS_HPP
#include <string>
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

+ 5
- 5
src/game/bootloader.cpp View File

@ -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::string()>(std::bind(&cc::exit, ctx)));
ctx->cli->register_command("scrot", std::function<std::string()>(std::bind(&cc::scrot, ctx)));
ctx->cli->register_command("cue", std::function<std::string(float, std::string)>(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::string()>(std::bind(&debug::cc::exit, ctx)));
ctx->cli->register_command("scrot", std::function<std::string()>(std::bind(&debug::cc::scrot, ctx)));
ctx->cli->register_command("cue", std::function<std::string(float, std::string)>(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));

Loading…
Cancel
Save