Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance - Mise à jour mensuelle Lundi 6 Février entre 7h00 et 9h00
Open sidebar
Gauthier Quesnel
irritator
Commits
31dec45d
Commit
31dec45d
authored
Mar 09, 2021
by
Gauthier Quesnel
Browse files
gui: add application class to move static variables
parent
e35da6e7
Pipeline
#27843
passed with stage
in 1 minute and 40 seconds
Changes
7
Pipelines
3
Expand all
Hide whitespace changes
Inline
Side-by-side
app/gui/dialog-file.cpp
View file @
31dec45d
...
...
@@ -120,31 +120,39 @@ get_executable_directory()
}
#endif
path
_manager
::
path
_manager
(
window_logger
&
logger
)
application
::
settings
_manager
::
settings
_manager
(
)
noexcept
{
if
(
auto
home
=
get_home_directory
();
home
)
{
home_dir
=
home
.
value
();
home_dir
/=
"irritator"
;
}
else
{
logger
.
log
(
3
,
"Fail to retrieve home directory. Use current directory instead"
);
home_dir
=
std
::
filesystem
::
current_path
();
}
try
{
if
(
auto
home
=
get_home_directory
();
home
)
{
home_dir
=
home
.
value
();
home_dir
/=
"irritator"
;
}
else
{
log_w
.
log
(
3
,
"Fail to retrieve home directory. Use current directory instead"
);
home_dir
=
std
::
filesystem
::
current_path
();
}
if
(
auto
install
=
get_executable_directory
();
install
)
{
install
_dir
=
install
.
value
();
}
else
{
logger
.
log
(
3
,
"Fail to retrieve executable directory. Use current directory "
"instead"
);
install
_dir
=
std
::
filesystem
::
current_path
();
}
if
(
auto
install
=
get_executable_directory
();
install
)
{
executable
_dir
=
install
.
value
();
}
else
{
log_w
.
log
(
3
,
"Fail to retrieve executable directory. Use current directory "
"instead"
);
executable
_dir
=
std
::
filesystem
::
current_path
();
}
logger
.
log
(
5
,
"home: %s
\n
install: %s
\n
"
,
home_dir
.
u8string
().
c_str
(),
install_dir
.
u8string
().
c_str
());
log_w
.
log
(
5
,
"home: %s
\n
install: %s
\n
"
,
home_dir
.
u8string
().
c_str
(),
executable_dir
.
u8string
().
c_str
());
// TODO Fill the libraries vectors with users and systems directory.
}
catch
(
const
std
::
exception
&
/*e*/
)
{
log_w
.
log
(
2
,
"Fail to initialize application"
);
}
}
struct
file_dialog
...
...
app/gui/gui.hpp
View file @
31dec45d
...
...
@@ -11,13 +11,13 @@
namespace
irt
{
void
node_editor
_initialize
();
application
_initialize
();
bool
node_editor
_show
();
application
_show
();
void
node_editor
_shutdown
();
application
_shutdown
();
/* Move into internal API */
...
...
app/gui/main-unix.cpp
View file @
31dec45d
...
...
@@ -120,7 +120,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
ImGui_ImplGlfw_InitForOpenGL
(
window
,
true
);
ImGui_ImplOpenGL3_Init
(
glsl_version
);
imnodes
::
Initialize
();
irt
::
node_editor
_initialize
();
irt
::
application
_initialize
();
// Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can
...
...
@@ -169,7 +169,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
ImGui_ImplGlfw_NewFrame
();
ImGui
::
NewFrame
();
if
(
!
irt
::
node_editor
_show
())
if
(
!
irt
::
application
_show
())
glfwSetWindowShouldClose
(
window
,
GLFW_TRUE
);
// Rendering
...
...
@@ -189,7 +189,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
// Cleanup
irt
::
node_editor
_shutdown
();
irt
::
application
_shutdown
();
imnodes
::
Shutdown
();
ImGui_ImplOpenGL3_Shutdown
();
...
...
app/gui/main-windows.cpp
View file @
31dec45d
...
...
@@ -97,7 +97,7 @@ int main(int, char**)
g_pd3dSrvDescHeap
->
GetGPUDescriptorHandleForHeapStart
());
imnodes
::
Initialize
();
irt
::
node_editor
_initialize
();
irt
::
application
_initialize
();
// Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
...
...
@@ -141,7 +141,7 @@ int main(int, char**)
ImGui_ImplWin32_NewFrame
();
ImGui
::
NewFrame
();
if
(
!
irt
::
node_editor
_show
())
if
(
!
irt
::
application
_show
())
::
PostMessage
(
hwnd
,
WM_CLOSE
,
0
,
0
);
// Rendering
...
...
@@ -180,7 +180,7 @@ int main(int, char**)
frameCtxt
->
FenceValue
=
fenceValue
;
}
irt
::
node_editor
_shutdown
();
irt
::
application
_shutdown
();
imnodes
::
Shutdown
();
...
...
app/gui/node-editor.cpp
View file @
31dec45d
This diff is collapsed.
Click to expand it.
app/gui/node-editor.hpp
View file @
31dec45d
...
...
@@ -214,16 +214,7 @@ struct window_logger
void
show
(
bool
*
is_show
);
};
struct
path_manager
{
path_manager
(
window_logger
&
log
);
std
::
filesystem
::
path
home_dir
;
std
::
filesystem
::
path
install_dir
;
std
::
vector
<
std
::
filesystem
::
path
>
libraries
;
};
static
inline
window_logger
log_w
;
struct
plot_output
{
...
...
@@ -363,6 +354,36 @@ struct editor
bool
show_load_file_dialog
=
false
;
bool
show_save_file_dialog
=
false
;
bool
show_select_directory_dialog
=
false
;
bool
show_settings
=
false
;
struct
settings_manager
{
int
kernel_model_cache
=
1024
;
int
kernel_message_cache
=
32768
;
int
gui_node_cache
=
1024
;
ImVec4
gui_model_color
{
.27
f
,
.27
f
,
.54
f
,
1.
f
};
ImVec4
gui_model_transition_color
{
.27
f
,
.54
f
,
.54
f
,
1.
f
};
ImVec4
gui_cluster_color
{
.27
f
,
.54
f
,
.27
f
,
1.
f
};
ImU32
gui_hovered_model_color
;
ImU32
gui_selected_model_color
;
ImU32
gui_hovered_model_transition_color
;
ImU32
gui_selected_model_transition_color
;
ImU32
gui_hovered_cluster_color
;
ImU32
gui_selected_cluster_color
;
int
automatic_layout_iteration_limit
=
200
;
float
automatic_layout_x_distance
=
350.
f
;
float
automatic_layout_y_distance
=
350.
f
;
float
grid_layout_x_distance
=
250.
f
;
float
grid_layout_y_distance
=
250.
f
;
bool
show_dynamics_inputs_in_editor
=
false
;
void
compute_colors
()
noexcept
;
void
show
(
bool
*
is_open
);
}
settings
;
status
initialize
(
u32
id
)
noexcept
;
void
clear
()
noexcept
;
...
...
@@ -444,11 +465,38 @@ struct editor
bool
show_editor
()
noexcept
;
};
editor
*
make_combo_editor_name
(
editor_id
&
current
)
noexcept
;
void
show_simulation_box
(
editor
&
ed
,
window_logger
&
log_w
,
bool
*
show_simulation
);
show_simulation_box
(
editor
&
ed
,
bool
*
show_simulation
);
struct
application
{
data_array
<
editor
,
editor_id
>
editors
;
struct
settings_manager
{
settings_manager
()
noexcept
;
std
::
filesystem
::
path
home_dir
;
std
::
filesystem
::
path
executable_dir
;
std
::
vector
<
std
::
string
>
libraries_dir
;
void
show
(
bool
*
is_open
);
}
settings
;
bool
show_log
=
true
;
bool
show_simulation
=
true
;
bool
show_demo
=
false
;
bool
show_plot
=
true
;
bool
show_settings
=
false
;
editor
*
alloc_editor
();
void
free_editor
(
editor
&
ed
);
};
static
inline
application
app
;
editor
*
make_combo_editor_name
(
application
&
app
,
editor_id
&
current
)
noexcept
;
}
// namespace irt
...
...
app/gui/simulation-editor.cpp
View file @
31dec45d
...
...
@@ -431,7 +431,7 @@ show_simulation_run_debug(window_logger& log_w, editor& ed)
}
void
show_simulation_box
(
editor
&
ed
,
window_logger
&
log_w
,
bool
*
show_simulation
)
show_simulation_box
(
editor
&
ed
,
bool
*
show_simulation
)
{
ImGui
::
SetNextWindowPos
(
ImVec2
(
50
,
50
),
ImGuiCond_FirstUseEver
);
ImGui
::
SetNextWindowSize
(
ImVec2
(
250
,
350
),
ImGuiCond_Once
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment