改为使用glfw, 并仅实现opengl rhi
This commit is contained in:
@@ -1,21 +1,16 @@
|
||||
#include "command_line.h"
|
||||
|
||||
void command_line::init(int argc, char** argv)
|
||||
{
|
||||
void command_line::init(int argc, char **argv) {
|
||||
// parser argv
|
||||
args_.clear();
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
std::string arg = argv[i];
|
||||
if (arg[0] == '-')
|
||||
{
|
||||
if (arg[0] == '-') {
|
||||
std::string key = arg.substr(1);
|
||||
std::string value;
|
||||
if (i + 1 < argc)
|
||||
{
|
||||
if (i + 1 < argc) {
|
||||
std::string next_arg = argv[i + 1];
|
||||
if (next_arg[0] != '-')
|
||||
{
|
||||
if (next_arg[0] != '-') {
|
||||
value = next_arg;
|
||||
++i;
|
||||
}
|
||||
@@ -25,54 +20,38 @@ void command_line::init(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
void command_line::get_arg(const std::string& key, std::string& out) const
|
||||
{
|
||||
void command_line::get_arg(const std::string &key, std::string &out) const {
|
||||
const auto it = args_.find(key);
|
||||
if (it != args_.end())
|
||||
{
|
||||
if (it != args_.end()) {
|
||||
out = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
out = "";
|
||||
}
|
||||
}
|
||||
|
||||
void command_line::get_arg(const std::string& key, int& out) const
|
||||
{
|
||||
void command_line::get_arg(const std::string &key, int &out) const {
|
||||
const auto it = args_.find(key);
|
||||
if (it != args_.end())
|
||||
{
|
||||
if (it != args_.end()) {
|
||||
out = std::stoi(it->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
out = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void command_line::get_arg(const std::string& key, float& out) const
|
||||
{
|
||||
void command_line::get_arg(const std::string &key, float &out) const {
|
||||
const auto it = args_.find(key);
|
||||
if (it != args_.end())
|
||||
{
|
||||
if (it != args_.end()) {
|
||||
out = std::stof(it->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
out = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void command_line::get_arg(const std::string& key, bool& out) const
|
||||
{
|
||||
void command_line::get_arg(const std::string &key, bool &out) const {
|
||||
const auto it = args_.find(key);
|
||||
if (it != args_.end())
|
||||
{
|
||||
if (it != args_.end()) {
|
||||
out = it->second != "false";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
out = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user