MXVK Vulkan Framework
0.33.1
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
#include "
mxvk/mxvk.hpp
"
2
#include "
mxvk/mxvk_cfg.hpp
"
3
#include <cstdlib>
4
#include <iostream>
5
#include <string>
6
7
int
main
(
void
) {
8
try
{
9
mxvk::VK_Config
config(
"test.dat"
);
10
auto
it = config.
itemAtKey
(
"global"
,
"key"
,
"0"
);
11
auto
int_value = std::strtol(it.value.c_str(), 0, 0);
12
int_value += 1;
13
std::cout <<
"You ran this program: "
<< int_value <<
" times.\n"
;
14
config.
setItem
(
"global"
,
"key"
, std::to_string(int_value));
15
}
catch
(
mxvk::Exception
&e) {
16
std::cerr << std::format(
"Exception: {}\n"
, e.
text
());
17
return
EXIT_FAILURE;
18
}
19
return
EXIT_SUCCESS;
20
}
mxvk::Exception
Definition
mxvk_exception.hpp:7
mxvk::Exception::text
std::string text() const
Definition
mxvk_exception.hpp:10
mxvk::VK_Config
Parses and manages an INI-style configuration file.
Definition
mxvk_cfg.hpp:36
mxvk::VK_Config::itemAtKey
VK_ConfigItem itemAtKey(const std::string §ion, const std::string &key, const std::string &default_value="") const
Retrieve a configuration item by section and key.
Definition
mxvk_cfg.cpp:85
mxvk::VK_Config::setItem
void setItem(const std::string §ion, const std::string &key, const std::string &value)
Insert or update a configuration item.
Definition
mxvk_cfg.cpp:97
main
int main(int argc, char **argv)
Definition
main.cpp:173
mxvk.hpp
mxvk_cfg.hpp
INI-style configuration file reader/writer.
examples
cfg_example
main.cpp
Generated by
1.18.0