Blamite Game Engine - Blam (Core)
win32_dialog_test.hpp
Go to the documentation of this file.
1 #include "../console.h"
3 
4 namespace Blam::Console
5 {
13  {
14  public:
16  {
17  name = "win32_dialog_test";
18  description = "";
19 
21  }
22 
24  {
25  delete this;
26  }
27 
28  CommandStatus onCommand(std::vector<std::string> arguments)
29  {
30  int dialog_result = DialogBox(NULL, MAKEINTRESOURCE(IDD_PROPPAGE_MEDIUM), NULL, NULL);
31 
32  if (dialog_result == IDC_BUTTON1)
33  {
34  Blam::Logger::LogEventForce("Notice: Dialog exited with IDOK", WSV_INFO);
35  }
36  else if (dialog_result == IDC_BUTTON2)
37  {
38  Blam::Logger::LogEventForce("Notice: Dialog exited with IDOK", WSV_INFO);
39  }
40  else if (dialog_result == -1)
41  {
42  std::string error_description = std::to_string(GetLastError());
43 
44  std::string dialog_result_str = std::to_string(dialog_result);
45 
46  MessageBoxA(NULL, dialog_result_str.c_str(), NULL, MB_OK);
47 
48  Blam::Logger::LogEventForce("Error: Dialog failed! Return code:", WSV_ERROR);
49  Blam::Logger::LogEventForce(dialog_result_str, WSV_ERROR);
50  }
51 
52  return CommandStatus::Ok;
53  }
54  };
55 }
Blam::Console::Win32DialogTestCommand::Win32DialogTestCommand
Win32DialogTestCommand()
Definition: win32_dialog_test.hpp:15
Blam::Console::ConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:73
Blam::Console::ConsoleCommand::type
CommandType type
The type of command this is. See Blam::Console::CommandType for more information.
Definition: console.h:77
Blam::Console::CommandStatus
CommandStatus
Indicates the return state of a console command.
Definition: console.h:28
logger.h
Blam::Console::Win32DialogTestCommand
Class for the win32_dialog_test command.
Definition: win32_dialog_test.hpp:12
Blam::Console::Builtin
@ Builtin
A command that is hard-coded into the engine.
Definition: console.h:41
Blam::Console::ConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:70
IDC_BUTTON2
#define IDC_BUTTON2
Definition: resource.h:54
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:14
WSV_INFO
#define WSV_INFO
Macro for 'Info' log seveirty. Original pre-enum value was 1.
Definition: logger.h:16
Blam::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
Blam::Console::Ok
@ Ok
The command was run without error.
Definition: console.h:30
Blam::Console::Win32DialogTestCommand::~Win32DialogTestCommand
~Win32DialogTestCommand()
Definition: win32_dialog_test.hpp:23
Blam::Console::ConsoleCommand
Class used to represent a console command.
Definition: console.h:50
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message, LogSeverity severity)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:137
Blam::Console::Win32DialogTestCommand::onCommand
CommandStatus onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: win32_dialog_test.hpp:28
IDC_BUTTON1
#define IDC_BUTTON1
Definition: resource.h:42