\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}{//\ \ OpenShaderDesigner,\ an\ open\ source\ software\ utility\ to\ create\ materials\ and\ shaders.}} \DoxyCodeLine{00003\ \textcolor{comment}{//\ \ Copyright\ (C)\ 2024\ \ Medusa\ Slockbower}} \DoxyCodeLine{00004\ \textcolor{comment}{//}} \DoxyCodeLine{00005\ \textcolor{comment}{//\ \ This\ program\ is\ free\ software:\ you\ can\ redistribute\ it\ and/or\ modify}} \DoxyCodeLine{00006\ \textcolor{comment}{//\ \ it\ under\ the\ terms\ of\ the\ GNU\ General\ Public\ License\ as\ published\ by}} \DoxyCodeLine{00007\ \textcolor{comment}{//\ \ the\ Free\ Software\ Foundation,\ either\ version\ 3\ of\ the\ License,\ or}} \DoxyCodeLine{00008\ \textcolor{comment}{//\ \ (at\ your\ option)\ any\ later\ version.}} \DoxyCodeLine{00009\ \textcolor{comment}{//}} \DoxyCodeLine{00010\ \textcolor{comment}{//\ \ This\ program\ is\ distributed\ in\ the\ hope\ that\ it\ will\ be\ useful,}} \DoxyCodeLine{00011\ \textcolor{comment}{//\ \ but\ WITHOUT\ ANY\ WARRANTY;\ without\ even\ the\ implied\ warranty\ of}} \DoxyCodeLine{00012\ \textcolor{comment}{//\ \ MERCHANTABILITY\ or\ FITNESS\ FOR\ A\ PARTICULAR\ PURPOSE.\ \ See\ the}} \DoxyCodeLine{00013\ \textcolor{comment}{//\ \ GNU\ General\ Public\ License\ for\ more\ details.}} \DoxyCodeLine{00014\ \textcolor{comment}{//}} \DoxyCodeLine{00015\ \textcolor{comment}{//\ \ You\ should\ have\ received\ a\ copy\ of\ the\ GNU\ General\ Public\ License}} \DoxyCodeLine{00016\ \textcolor{comment}{//\ \ along\ with\ this\ program.\ \ If\ not,\ see\ .}} \DoxyCodeLine{00017\ \textcolor{comment}{//\ =====================================================================================================================}} \DoxyCodeLine{00018\ } \DoxyCodeLine{00019\ \textcolor{preprocessor}{\#ifndef\ EDITORSYSTEM\_H}} \DoxyCodeLine{00020\ \textcolor{preprocessor}{\#define\ EDITORSYSTEM\_H}} \DoxyCodeLine{00021\ } \DoxyCodeLine{00022\ \textcolor{preprocessor}{\#include\ }} \DoxyCodeLine{00023\ \textcolor{preprocessor}{\#include\ }} \DoxyCodeLine{00024\ \textcolor{preprocessor}{\#include\ }} \DoxyCodeLine{00025\ } \DoxyCodeLine{00026\ \textcolor{preprocessor}{\#include\ }} \DoxyCodeLine{00027\ \textcolor{preprocessor}{\#include\ }} \DoxyCodeLine{00028\ } \DoxyCodeLine{00029\ \textcolor{preprocessor}{\#define\ MAX\_EDITORS\ 256}} \DoxyCodeLine{00030\ } \DoxyCodeLine{00031\ \textcolor{keyword}{namespace\ }OpenShaderDesigner} \DoxyCodeLine{00032\ \{} \DoxyCodeLine{00033\ } \DoxyCodeLine{00034\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_open_shader_designer_1_1_editor_system}{EditorSystem}}} \DoxyCodeLine{00035\ \{} \DoxyCodeLine{00036\ \textcolor{keyword}{public}:} \DoxyCodeLine{00037\ \ \ \ \ \textcolor{keyword}{using\ }WindowID\ =\ uint64\_t;} \DoxyCodeLine{00038\ } \DoxyCodeLine{00039\ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>} \DoxyCodeLine{00040\ \ \ \ \ \textcolor{keyword}{static}\ WindowID\ ID()\ \{\ \textcolor{keywordflow}{return}\ open\_cpp\_utils::unique\_id();\ \}} \DoxyCodeLine{00041\ } \DoxyCodeLine{00042\ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>} \DoxyCodeLine{00043\ \ \ \ \ \textcolor{keyword}{static}\ T*\ Open()\ \{\ T*\ window;\ (window\ =\ Get())-\/>Open();\ \textcolor{keywordflow}{return}\ window;\ \}} \DoxyCodeLine{00044\ } \DoxyCodeLine{00045\ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>} \DoxyCodeLine{00046\ \ \ \ \ \textcolor{keyword}{static}\ T*\ Close()\ \{\ T*\ window;\ (window\ =\ Get())-\/>Close();\ \textcolor{keywordflow}{return}\ window;\ \}} \DoxyCodeLine{00047\ } \DoxyCodeLine{00048\ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>} \DoxyCodeLine{00049\ \ \ \ \ \textcolor{keyword}{static}\ T*\ Get()} \DoxyCodeLine{00050\ \ \ \ \ \{} \DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ T*\ window\ =\ \textcolor{keyword}{reinterpret\_cast<}T*\textcolor{keyword}{>}(Windows\_[ID()]);} \DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(window\ ==\ \textcolor{keyword}{nullptr})\ Windows\_[ID()]\ =\ window\ =\ \textcolor{keyword}{new}\ T();} \DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ window;} \DoxyCodeLine{00054\ \ \ \ \ \}} \DoxyCodeLine{00055\ } \DoxyCodeLine{00056\ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>} \DoxyCodeLine{00057\ \ \ \ \ \textcolor{keyword}{static}\ T*\ SetMainMenuBar()\ \{\ \textcolor{keyword}{delete}\ MainMenuBar\_;\ T*\ bar\ =\ \textcolor{keyword}{new}\ T();\ MainMenuBar\_\ =\ bar;\ \textcolor{keywordflow}{return}\ bar;\ \}} \DoxyCodeLine{00058\ } \DoxyCodeLine{00059\ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>} \DoxyCodeLine{00060\ \ \ \ \ \textcolor{keyword}{static}\ T*\ GetMainMenuBar()\ \{\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T*\textcolor{keyword}{>}(MainMenuBar\_);\ \}} \DoxyCodeLine{00061\ } \DoxyCodeLine{00062\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ Initialize();} \DoxyCodeLine{00063\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ Draw();} \DoxyCodeLine{00064\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ Shutdown();} \DoxyCodeLine{00065\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ HandleEvents(SDL\_Event*\ event);} \DoxyCodeLine{00066\ } \DoxyCodeLine{00067\ \textcolor{keyword}{private}:} \DoxyCodeLine{00068\ \ \ \ \ \textcolor{keyword}{inline}\ \textcolor{keyword}{static}\ \mbox{\hyperlink{class_open_shader_designer_1_1_editor_window}{EditorWindow}}*\ Windows\_[MAX\_EDITORS]\ \{\ \textcolor{keyword}{nullptr}\ \};} \DoxyCodeLine{00069\ \ \ \ \ \textcolor{keyword}{inline}\ \textcolor{keyword}{static}\ \mbox{\hyperlink{class_open_shader_designer_1_1_main_menu_bar}{MainMenuBar}}*\ \ MainMenuBar\_\ =\ \textcolor{keyword}{nullptr};} \DoxyCodeLine{00070\ \};} \DoxyCodeLine{00071\ } \DoxyCodeLine{00072\ \}} \DoxyCodeLine{00073\ } \DoxyCodeLine{00074\ } \DoxyCodeLine{00075\ } \DoxyCodeLine{00076\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//EDITORSYSTEM\_H}} \end{DoxyCode}