Elaztek Developer Hub
Blamite Game Engine - blam!  00423.10.27.24.0533.blamite
The core library for the Blamite Game Engine.
resolution.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
4 
6 {
16  {
17  public:
19  {
20  name = "screenres";
21  description = "Allows specifying the display resolution manually.";
22  syntax = "screenres <string>";
23  aliases = { "Settings.ScreenResolution" };
24 
26  }
27 
28  BlamResult Execute(std::vector<std::string> arguments)
29  {
30  if (arguments.size() < 1 || arguments.size() > 2)
31  {
32  return BlamResult::Error_Command_WrongArgumentCount;
33  }
34 
35  int x = 640;
36  int y = 480;
37 
38  if (arguments.size() == 1)
39  {
40  std::vector<std::string> resolution = BlamStrings::Utils::String::Split(arguments[0], "x");
41 
42  x = atoi(resolution[0].c_str());
43  y = atoi(resolution[1].c_str());
44  }
45  else if (arguments.size() == 2)
46  {
47  x = atoi(arguments[0].c_str());
48  y = atoi(arguments[1].c_str());
49  }
50 
52  Blam::Logger::LogEvent("Screen resolution set to " + std::to_string(x) + "x" + std::to_string(y), WSV_NONE);
53  return BlamResult::Success_OK;
54  }
55  };
56 }
Blam::Resources::Console::ResolutionCommand::Execute
BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition: resolution.hpp:28
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:130
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::ResolutionCommand::ResolutionCommand
ResolutionCommand()
Definition: resolution.hpp:18
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:33
Blam::Rendering::HandleWindowReisze
BLAM void HandleWindowReisze(int width, int height)
Instructs OGRE to handle a window resize.
Definition: ogre.cpp:497
y
font DisplayOffset y
Definition: README.txt:68
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:35
BlamConsoleCommand::syntax
std::string syntax
The syntax information for the command. Shown to the user when using the help command with an argumen...
Definition: console.h:37
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:40
Blam::Resources::Console::ResolutionCommand
Class for the screenres command.
Definition: resolution.hpp:15
x
config GlyphExtraSpacing x
Definition: README.txt:30
BlamConsoleCommand::aliases
std::vector< std::string > aliases
A list of aliases for the command. Executing any of these instead of the command name will behave the...
Definition: console.h:38
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.