Elaztek Developer Hub
Switch Project...
blam!
Editing Kit
Guerilla
Sapien
Tool
Foundry
Libraries
Keystone
Strings
Forums
Discord
Doxygen
Jenkins
Guides
Gitlab
Blamite Game Engine - blam!
00310.02.05.21.0336.blamite
The core library for the Blamite Game Engine.
history.hpp
Go to the documentation of this file.
1
#include "../console.h"
2
3
#include "
components/diagnostics/logger/logger.h
"
4
#include "
components/rendering/directx11/render_stack/stack_types/blam_ui/console.hpp
"
5
#include "
core.h
"
6
7
namespace
Blam::Resources::Console
8
{
14
class
HistoryCommand
:
public
BlamConsoleCommand
15
{
16
public
:
17
HistoryCommand
()
18
{
19
name
=
"history"
;
20
description
=
"Shows recently executed commands."
;
21
22
type
=
BlamCommandType::Builtin
;
23
}
24
25
~HistoryCommand
()
26
{
27
delete
this
;
28
}
29
30
BlamCommandResult
onCommand
(std::vector<std::string> arguments)
31
{
32
using namespace
BlamRendering::RenderStack
;
33
34
StackObjectBase
* stack_item = (
StackObjectBase
*)
GetStackItem
(
"console"
);
35
36
if
(stack_item)
37
{
38
if
(stack_item->
type_label
==
STACKTYPE_CONSOLE
)
39
{
40
ConsoleUI
* console = (
ConsoleUI
*)stack_item;
41
42
if
(console->
getRecentInput
().size() == 0)
43
{
44
Blam::Logger::LogEvent
(
"no recent input found"
,
WSV_NONE
);
45
}
46
else
47
{
48
for
(
int
i = 0; i < console->
getRecentInput
().size(); i++)
49
{
50
Blam::Logger::LogEvent
(std::to_string(i + 1) +
". "
+ console->
getRecentInput
().at(i),
WSV_NONE
);
51
}
52
}
53
}
54
else
55
{
56
Blam::Logger::LogEvent
(
"failed to retrieve console ui stack object (got wrong stack type)"
,
WSV_ERROR
);
57
}
58
}
59
else
60
{
61
Blam::Logger::LogEvent
(
"failed to retrieve console ui stack object (GetStackItem returned nullptr)"
,
WSV_ERROR
);
62
}
63
64
return
BlamCommandResult::Ok
;
65
}
66
};
67
}
Blam::Resources::Console::HistoryCommand
Class for the history command.
Definition:
history.hpp:14
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition:
aliases.cpp:169
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition:
console.h:57
logger.h
BlamCommandResult::Ok
@ Ok
The command was run without error.
BlamConsoleCommand
Class used to represent a console command.
Definition:
console.h:54
BlamRendering::RenderStack::StackObjectBase::type_label
StackType type_label
The type of the object.
Definition:
render_stack.h:372
BlamRendering::RenderStack
Namespace containing things relating to the Render Stack.
Definition:
drawing.h:14
WSV_ERROR
#define WSV_ERROR
Macro for 'Error' log seveirty. Original pre-enum value was 2.
Definition:
logger.h:17
Blam::Resources::Console::HistoryCommand::~HistoryCommand
~HistoryCommand()
Definition:
history.hpp:25
Blam::Resources::Console::HistoryCommand::onCommand
BlamCommandResult onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition:
history.hpp:30
BlamRendering::RenderStack::ConsoleUI::getRecentInput
std::vector< std::string > getRecentInput()
Definition:
console.hpp:418
Blam::Resources::Console::HistoryCommand::HistoryCommand
HistoryCommand()
Definition:
history.hpp:17
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition:
console.h:56
WSV_NONE
#define WSV_NONE
Macro for 'None' log seveirty. Original pre-enum value was 0.
Definition:
logger.h:16
STACKTYPE_CONSOLE
#define STACKTYPE_CONSOLE
Definition:
render_stack.h:26
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition:
console.h:61
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.
core.h
BlamCommandResult
BlamCommandResult
Indicates the return state of a console command.
Definition:
console.h:22
BlamRendering::RenderStack::StackObjectBase
Base class for all render stack objects.
Definition:
render_stack.h:194
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition:
abort.hpp:5
BlamRendering::RenderStack::GetStackItem
BLAM StackObjectBase * GetStackItem(std::string id)
Retrieves an item from the render stack.
Definition:
render_stack.cpp:75
BlamRendering::RenderStack::ConsoleUI
Definition:
console.hpp:66
console.hpp
blam
components
resources
console
commands
history.hpp
Generated on Fri Feb 5 2021 03:59:00 for Blamite Game Engine - blam! by
1.8.17