Elaztek Developer Hub
Blamite Game Engine - blam!  00423.10.27.24.0533.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 #include "res/resource.h"
5 
7 {
15  {
16  public:
18  {
19  name = "win32_dialog_test";
20  description = "";
21 
23  }
24 
25  BlamResult Execute(std::vector<std::string> arguments)
26  {
27  int dialog_result = DialogBox(NULL, MAKEINTRESOURCE(IDD_PROPPAGE_MEDIUM), NULL, NULL);
28 
29  if (dialog_result == IDC_BUTTON1)
30  {
31  Blam::Logger::LogEventForce("Notice: Dialog exited with IDOK", WSV_NONE);
32  }
33  else if (dialog_result == IDC_BUTTON2)
34  {
35  Blam::Logger::LogEventForce("Notice: Dialog exited with IDOK", WSV_NONE);
36  }
37  else if (dialog_result == -1)
38  {
39  std::string error_description = std::to_string(GetLastError());
40 
41  std::string dialog_result_str = std::to_string(dialog_result);
42 
43  MessageBoxA(NULL, dialog_result_str.c_str(), NULL, MB_OK);
44 
45  Blam::Logger::LogEventForce("Error: Dialog failed! Return code:", WSV_ERROR);
46  Blam::Logger::LogEventForce(dialog_result_str, WSV_ERROR);
47  }
48 
49  return BlamResult::Success_OK;
50  }
51  };
52 }
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:36
logger.h
Blam::Resources::Console::Win32DialogTestCommand
Class for the win32_dialog_test command.
Definition: win32_dialog_test.hpp:14
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:33
IDC_BUTTON2
#define IDC_BUTTON2
Definition: resource.h:65
IDD_PROPPAGE_MEDIUM
#define IDD_PROPPAGE_MEDIUM
Definition: resource.h:13
NULL
Add a fourth parameter to bake specific font ranges NULL
Definition: README.txt:57
resource.h
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:35
Blam::Resources::Console::Win32DialogTestCommand::Execute
BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition: win32_dialog_test.hpp:25
Blam::Resources::Console::Win32DialogTestCommand::Win32DialogTestCommand
Win32DialogTestCommand()
Definition: win32_dialog_test.hpp:17
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:40
IDC_BUTTON1
#define IDC_BUTTON1
Definition: resource.h:53
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:262
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.