Blamite Game Engine - blam!  00272.10.26.20.0001.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 
5 namespace Blam::Console
6 {
14  {
15  public:
17  {
18  name = "win32_dialog_test";
19  description = "";
20 
22  }
23 
25  {
26  delete this;
27  }
28 
29  CommandStatus 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 CommandStatus::Ok;
54  }
55  };
56 }
Blam::Console::Win32DialogTestCommand::Win32DialogTestCommand
Win32DialogTestCommand()
Definition: win32_dialog_test.hpp:16
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:13
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:58
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
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::Win32DialogTestCommand::~Win32DialogTestCommand
~Win32DialogTestCommand()
Definition: win32_dialog_test.hpp:24
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:150
Blam::Console::Win32DialogTestCommand::onCommand
CommandStatus onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: win32_dialog_test.hpp:29
IDC_BUTTON1
#define IDC_BUTTON1
Definition: resource.h:46
Blam::Globals::Ok
@ Ok
The global was updated successfully.
Definition: globals.h:202