Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
win32_dialog_test.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
4 
6 {
14  {
15  public:
17  {
18  name = "win32_dialog_test";
19  description = "";
20 
22  }
23 
25  {
26  delete this;
27  }
28 
29  BlamCommandResult onCommand(std::vector<std::string> arguments)
30  {
31  int dialog_result = DialogBox(NULL, MAKEINTRESOURCE(IDD_PROPPAGE_MEDIUM), NULL, NULL);
32 
33  if (dialog_result == IDC_BUTTON1)
34  {
35  Blam::Logger::LogEventForce("Notice: Dialog exited with IDOK", WSV_INFO);
36  }
37  else if (dialog_result == IDC_BUTTON2)
38  {
39  Blam::Logger::LogEventForce("Notice: Dialog exited with IDOK", WSV_INFO);
40  }
41  else if (dialog_result == -1)
42  {
43  std::string error_description = std::to_string(GetLastError());
44 
45  std::string dialog_result_str = std::to_string(dialog_result);
46 
47  MessageBoxA(NULL, dialog_result_str.c_str(), NULL, MB_OK);
48 
49  Blam::Logger::LogEventForce("Error: Dialog failed! Return code:", WSV_ERROR);
50  Blam::Logger::LogEventForce(dialog_result_str, WSV_ERROR);
51  }
52 
53  return BlamCommandResult::Ok;
54  }
55  };
56 }
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.
Blam::Resources::Console::Win32DialogTestCommand
Class for the win32_dialog_test command.
Definition: win32_dialog_test.hpp:13
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:54
IDC_BUTTON2
#define IDC_BUTTON2
Definition: resource.h:62
WSV_ERROR
#define WSV_ERROR
Macro for 'Error' log seveirty. Original pre-enum value was 2.
Definition: logger.h:17
IDD_PROPPAGE_MEDIUM
#define IDD_PROPPAGE_MEDIUM
Definition: resource.h:13
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message, BlamLogLevel severity)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:218
Blam::Resources::Console::Win32DialogTestCommand::onCommand
BlamCommandResult onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: win32_dialog_test.hpp:29
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:56
WSV_INFO
#define WSV_INFO
Macro for 'Info' log seveirty.
Definition: logger.h:27
Blam::Resources::Console::Win32DialogTestCommand::~Win32DialogTestCommand
~Win32DialogTestCommand()
Definition: win32_dialog_test.hpp:24
Blam::Resources::Console::Win32DialogTestCommand::Win32DialogTestCommand
Win32DialogTestCommand()
Definition: win32_dialog_test.hpp:16
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.
IDC_BUTTON1
#define IDC_BUTTON1
Definition: resource.h:50
BlamCommandResult
BlamCommandResult
Indicates the return state of a console command.
Definition: console.h:22
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5