@@ -14,6 +14,7 @@ Editor::Editor() {
1414 this ->m_bScale = false ;
1515 this ->m_guizmoOp = ImGuizmo::OPERATION::TRANSLATE;
1616 this ->m_console = nullptr ;
17+ this ->m_bPlaying = false ;
1718}
1819
1920void Editor::Init (UINT nWidth, UINT nHeight) {
@@ -121,6 +122,9 @@ void Editor::Init(UINT nWidth, UINT nHeight) {
121122
122123 this ->m_nWidth = nWidth;
123124 this ->m_nHeight = nHeight;
125+
126+ ThrowIfFailed (CoInitializeEx (NULL , COINIT_APARTMENTTHREADED |
127+ COINIT_DISABLE_OLE1DDE));
124128}
125129
126130void Editor::Update () {
@@ -129,6 +133,30 @@ void Editor::Update() {
129133 if (ImGui::MenuItem (" Create" )) {
130134 }
131135 if (ImGui::MenuItem (" Open" , " Ctrl+O" )) {
136+ IFileOpenDialog* pFileOpen;
137+
138+ ThrowIfFailed (CoCreateInstance (CLSID_FileOpenDialog, NULL , CLSCTX_ALL,
139+ IID_IFileOpenDialog, reinterpret_cast <void **>(&pFileOpen)));
140+
141+ COMDLG_FILTERSPEC fileTypes[] =
142+ {
143+ { L" Exeon Project (*.exproj)" , L" *.exproj" }
144+ };
145+ ThrowIfFailed (pFileOpen->SetFileTypes (1 , fileTypes));
146+ ThrowIfFailed (pFileOpen->SetFileTypeIndex (1 ));
147+
148+
149+ if (SUCCEEDED (pFileOpen->Show (nullptr ))) {
150+ IShellItem* pItem;
151+ if (SUCCEEDED (pFileOpen->GetResult (&pItem))) {
152+ PWSTR pszPath;
153+ if (SUCCEEDED (pItem->GetDisplayName (SIGDN_FILESYSPATH, &pszPath))) {
154+ // TODO: Make it open the project
155+ }
156+
157+ }
158+ }
159+ CoUninitialize ();
132160 }
133161 if (ImGui::MenuItem (" Save" , " Ctrl+S" )) {
134162 }
@@ -144,11 +172,22 @@ void Editor::Update() {
144172 }
145173 float windowWidth = ImGui::GetWindowSize ().x ;
146174
147- const char * playIcon = ICON_FA_PLAY;
148- float textWidth = ImGui::CalcTextSize (playIcon).x ;
149175
150- ImGui::SetCursorPosX ((windowWidth - textWidth) * 0 .5f );
151- ImGui::Button (playIcon, ImVec2{25 .f , 25 .f });
176+ if (!this ->m_bPlaying ) {
177+ const char * playIcon = ICON_FA_PLAY;
178+ float textWidth = ImGui::CalcTextSize (playIcon).x ;
179+ ImGui::SetCursorPosX ((windowWidth - textWidth) * 0 .5f );
180+ if (ImGui::Button (playIcon, ImVec2{25 .f , 25 .f })) {
181+ this ->m_bPlaying = !this ->m_bPlaying ;
182+ }
183+ } else {
184+ const char * playIcon = ICON_FA_PAUSE;
185+ float textWidth = ImGui::CalcTextSize (playIcon).x ;
186+ ImGui::SetCursorPosX ((windowWidth - textWidth) * 0 .5f );
187+ if (ImGui::Button (playIcon, ImVec2{25 .f , 25 .f })) {
188+ this ->m_bPlaying = !this ->m_bPlaying ;
189+ }
190+ }
152191 ImGui::EndMainMenuBar ();
153192
154193 if (this ->m_sceneMgr ) {
0 commit comments