\doxysection{Editor\+System.\+h}
\hypertarget{_editor_system_8h_source}{}\label{_editor_system_8h_source}\index{Include/Editor/EditorSystem.h@{Include/Editor/EditorSystem.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00002\ \textcolor{comment}{//\ Copyright\ 2024\ Medusa\ Slockbower}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ Licensed\ under\ the\ Apache\ License,\ Version\ 2.0\ (the\ "{}License"{});}}
\DoxyCodeLine{00004\ \textcolor{comment}{//\ you\ may\ not\ use\ this\ file\ except\ in\ compliance\ with\ the\ License.}}
\DoxyCodeLine{00005\ \textcolor{comment}{//\ You\ may\ obtain\ a\ copy\ of\ the\ License\ at}}
\DoxyCodeLine{00006\ \textcolor{comment}{//}}
\DoxyCodeLine{00007\ \textcolor{comment}{//\ \ http://www.apache.org/licenses/LICENSE-\/2.0}}
\DoxyCodeLine{00008\ \textcolor{comment}{//}}
\DoxyCodeLine{00009\ \textcolor{comment}{//\ Unless\ required\ by\ applicable\ law\ or\ agreed\ to\ in\ writing,\ software}}
\DoxyCodeLine{00010\ \textcolor{comment}{//\ distributed\ under\ the\ License\ is\ distributed\ on\ an\ "{}AS\ IS"{}\ BASIS,}}
\DoxyCodeLine{00011\ \textcolor{comment}{//\ WITHOUT\ WARRANTIES\ OR\ CONDITIONS\ OF\ ANY\ KIND,\ either\ express\ or\ implied.}}
\DoxyCodeLine{00012\ \textcolor{comment}{//\ See\ the\ License\ for\ the\ specific\ language\ governing\ permissions\ and}}
\DoxyCodeLine{00013\ \textcolor{comment}{//\ limitations\ under\ the\ License.}}
\DoxyCodeLine{00014\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#ifndef\ EDITORSYSTEM\_H}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#define\ EDITORSYSTEM\_H}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ <SDL\_events.h>}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#include\ <open-\/cpp-\/utils/unique\_id.h>}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#include\ <unordered\_map>}}
\DoxyCodeLine{00022\ }
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#include\ <Editor/EditorWindow.h>}}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#define\ MAX\_EDITORS\ 256}}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{keyword}{namespace\ }OpenShaderDesigner}
\DoxyCodeLine{00028\ \{}
\DoxyCodeLine{00029\ \ \ \ \ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_open_shader_designer_1_1_editor_system}{EditorSystem}}}
\DoxyCodeLine{00030\ \ \ \ \ \{}
\DoxyCodeLine{00031\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00032\ \ \ \ \ \ \ \ \ \textcolor{keyword}{using\ }WindowID\ =\ uint64\_t;}
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00035\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static}\ WindowID\ ID()\ \{\ \textcolor{keywordflow}{return}\ open\_cpp\_utils::unique\_id<WindowID,\ T>();\ \}}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00038\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static}\ T*\ Open()\ \{\ T*\ window;\ (window\ =\ Get<T>())-\/>Open();\ \textcolor{keywordflow}{return}\ window;\ \}}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00041\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static}\ T*\ Close()\ \{\ T*\ window;\ (window\ =\ Get<T>())-\/>Close();\ \textcolor{keywordflow}{return}\ window;\ \}}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static}\ T*\ Get()}
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00046\ \ \ \ \ \ \ \ \ \ \ \ \ T*\ window\ =\ \textcolor{keyword}{reinterpret\_cast<}T*\textcolor{keyword}{>}(Windows[ID<T>()]);}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(window\ ==\ \textcolor{keyword}{nullptr})\ Windows[ID<T>()]\ =\ window\ =\ \textcolor{keyword}{new}\ T();}
\DoxyCodeLine{00048\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ window;}
\DoxyCodeLine{00049\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ Initialize();}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ Draw();}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ Shutdown();}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ HandleEvents(SDL\_Event*\ event);}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00056\ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ \textcolor{keyword}{inline}\ \textcolor{keyword}{static}\ \mbox{\hyperlink{class_open_shader_designer_1_1_editor_window}{EditorWindow}}*\ Windows[MAX\_EDITORS]\ \{\ \textcolor{keyword}{nullptr}\ \};}
\DoxyCodeLine{00058\ \ \ \ \ \};}
\DoxyCodeLine{00059\ \}}
\DoxyCodeLine{00060\ }
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//EDITORSYSTEM\_H}}

\end{DoxyCode}
