GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
application_setting_record.h
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
8#ifndef DESIGNLAB_APPLICATION_SETTING_RECORD_H_
9#define DESIGNLAB_APPLICATION_SETTING_RECORD_H_
10
11#include <format>
12#include <map>
13#include <string>
14#include <vector>
15
16#include "boot_mode.h"
17#include "display_quality.h"
18#include "output_detail.h"
19#include "string_util.h"
21
22
23namespace designlab
24{
25
29{
30 static constexpr int kWindowWidthMin{ 512 };
31 static constexpr int kWindowWidthMax{ 1920 };
32 static constexpr int kWindowHeightMin{ 288 };
33 static constexpr int kWindowHeightMax{ 1080 };
34 static constexpr int kFpsMin{ 15 };
35 static constexpr int kFpsMax{ 60 };
36
37
38 int version_major{ 0 };
39 int version_minor{ 5 };
40 int version_patch{ 0 };
41
43 bool ask_about_modes{ true };
44
47
50
53
54
55 bool do_cmd_output{ true };
56
59
60 bool do_gui_display{ true };
61
64
65 int window_size_x{ 1600 };
66 int window_size_y{ 900 };
67 int window_fps{ 60 };
68};
69
70
72{
73 const std::vector<std::string> kFileDescription = {
74 "If this file is garbled, "
75 "the problem is most likely due to character encoding.",
76 "This file is written in utf - 8, and can be read by installing VS Code and "
77 "configuring it to automatically detect the character encoding.",
78 "This file is written in the TOML format. "
79 "Just google it and you'll find easy "
80 "to understand information on the wiki, so try looking it up.",
81 "This file is a file for describing program settings.",
82 "This file can also be edited with a text editor such as Notepad.",
83 "If you want to change the simulation conditions, "
84 "try changing them from here."
85 "Lines starting with a sharp are comments. They do not affect the program."
86 };
87
89
91 "Verion",
92 "The order is major.minor.patch.",
93 "Mode", "Setting the mode in which the program is to be run",
94 "Output", "Program output settings.");
95
96 DESIGNLAB_TOML11_VARIABLE_NO_DESCRIPTION(version_major, "Verion");
97 DESIGNLAB_TOML11_VARIABLE_NO_DESCRIPTION(version_minor, "Verion");
98 DESIGNLAB_TOML11_VARIABLE_NO_DESCRIPTION(version_patch, "Verion");
99
101 ask_about_modes, "Mode",
102 "Ask the user about the run mode at startup. ( true / false )");
104 default_mode, "Mode",
105 std::format("Sets the default run mode at startup. ( \"{}\" )",
108 do_step_execution_each_simulation, "Mode",
109 "Ask if you want to continue with each simulation. ( true / false )");
111 do_step_execution_each_gait, "Mode",
112 "Ask if you want to continue with each move. ( true / false )");
113
115 do_cmd_output, "Output",
116 "Output characters to the command line. ( true / false )");
118 cmd_output_detail, "Output",
119 std::format("How much output is allowed on the command line. ( \"{}\" )",
122 do_gui_display, "Output", "Display GUI. ( true / false )");
124 gui_display_quality, "Output",
125 std::format("GUI Image Quality.( \"{}\" )",
128 window_size_x, "Output",
129 std::format("Sets the width of the GUI. The range is from {} to {}. "
130 "The recommended value is 1600.",
134 window_size_y, "Output",
135 std::format("Sets the height of the GUI. The range is from {} to {}. "
136 "The recommended value is 900.",
140 window_fps, "Output",
141 std::format("Sets FPS. The range is from {} to {}. "
142 "The recommended value is 60.",
145};
146
147} // namespace designlab
148
149
152 version_major, version_minor, version_patch,
153 ask_about_modes, default_mode, do_step_execution_each_simulation,
154 do_step_execution_each_gait,
155 do_cmd_output, cmd_output_detail, do_gui_display,
156 gui_display_quality, window_size_x, window_size_y, window_fps);
157
158
159#endif // DESIGNLAB_APPLICATION_SETTING_RECORD_H_
std::string EnumValuesToString(const std::string separator)
enum型を渡すと,その要素を列挙した文字列を返す関数.
Definition string_util.h:75
BootMode
起動モードを表す列挙型.
Definition boot_mode.h:19
@ kSimulation
シミュレーションモード.
OutputDetail
コマンドラインに文字を出力する際に,その詳細を指定するための列挙体.
@ kInfo
優先度低めの情報.
DisplayQuality
描画の品質設定を示す列挙体.
アプリの設定を記録する構造体.
int window_size_x
グラフィカルウィンドウの横幅.
bool ask_about_modes
起動時にモード選択の確認をするかどうか.
bool do_gui_display
GUIを表示するかどうか.
bool do_step_execution_each_simulation
1シミュレーションごとにステップ実行をするかどうか.
int window_fps
グラフィカルウィンドウのFPS.
int window_size_y
グラフィカルウィンドウの縦幅.
bool do_step_execution_each_gait
1動作ごとにステップ実行をするかどうか.
OutputDetail cmd_output_detail
コマンドラインに出力する際,どこまで許可するか.
int version_major
バージョン番号(メジャー)
BootMode default_mode
デフォルトの起動モード.
int version_patch
バージョン番号(パッチ)
bool do_cmd_output
コマンドラインに出力するかどうか.
DisplayQuality gui_display_quality
GUIを表示する際,どこまで許可するか.
int version_minor
バージョン番号(マイナー)
#define DESIGNLAB_TOML11_SERIALIZE(NAME,...)
tomlファイルのシリアライズ/デシリアライズを行うためのマクロ. TOML11_DEFINE_CONVERSION_NON_INTRUSIVEをラッパしたもの. もともとのほうでは enum型...
#define DESIGNLAB_TOML11_DESCRIPTION_CLASS(CLASS)
tomlファイルに説明を追加するためのクラスの宣言を行うためのマクロ.
#define DESIGNLAB_TOML11_VARIABLE_ADD_DESCRIPTION(VARIABLE, TABLE, DESCRIPTION)
tomlファイルに変数とファイルの説明を追加するためのマクロ.
#define DESIGNLAB_TOML11_TABLE_ADD_DESCRIPTION(...)
tomlファイルにテーブルの説明を追加するためのマクロ. DESIGNLAB_TOML11_DESCRIPTION_CLASS内に必ず記述する必要がある.
#define DESIGNLAB_TOML11_VARIABLE_NO_DESCRIPTION(VARIABLE, TABLE)
ファイルの説明を追加したくない場合には,このマクロで変数を追加する.
#define DESIGNLAB_TOML11_FILE_ADD_DESCRIPTION_MULTI_LINE(DESCRIPTION_VEC)
tomlファイルにファイルの説明を追加するためのマクロ. DESIGNLAB_TOML11_DESCRIPTION_CLASS内に必ず記述する必要がある.