Skip to content

Commit 93bb744

Browse files
committed
[FIX] : hide the console on Release mode (show it in Debug mode)
1 parent fceba7e commit 93bb744

4 files changed

Lines changed: 7 additions & 42 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ if (USE_SHARED_LIBS)
179179
endif()
180180

181181
set_target_properties(${PROJECT} PROPERTIES OUTPUT_NAME "${PROJECT}_${CMAKE_SYSTEM_NAME}_${ARCH}")
182+
set_target_properties(${PROJECT} PROPERTIES WIN32_EXECUTABLE TRUE)
183+
184+
if(MSVC)
185+
set_target_properties(${PROJECT} PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup")
186+
set_target_properties(${PROJECT} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
187+
endif()
182188

183189
set(CMAKE_CXX_EXTENSIONS OFF)
184190
set(CMAKE_CXX_STANDARD_REQUIRED ON)

src/backend/MainBackend.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ void MainBackend::run(const std::string& vAppPath) {
7272

7373
// todo : to refactor ! i dont like that
7474
bool MainBackend::init(const std::string& vAppPath) {
75-
#ifdef _DEBUG
76-
SetConsoleVisibility(true);
77-
#else
78-
SetConsoleVisibility(false);
79-
#endif
8075
if (m_InitWindow() && m_InitImGui()) {
8176
m_InitPlugins(vAppPath);
8277
m_InitModels();
@@ -199,37 +194,6 @@ int MainBackend::GetMouseButton(int vButton) {
199194
return glfwGetMouseButton(m_MainWindowPtr, vButton);
200195
}
201196

202-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
203-
//// CONSOLE ///////////////////////////////////////////////////////////////////////////////////////////////
204-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
205-
206-
void MainBackend::SetConsoleVisibility(const bool vFlag) {
207-
m_ConsoleVisiblity = vFlag;
208-
209-
if (m_ConsoleVisiblity) {
210-
// on cache la console
211-
// on l'affichera au besoin comme blender fait
212-
#ifdef WIN32
213-
ShowWindow(GetConsoleWindow(), SW_SHOW);
214-
#endif
215-
} else {
216-
// on cache la console
217-
// on l'affichera au besoin comme blender fait
218-
#ifdef WIN32
219-
ShowWindow(GetConsoleWindow(), SW_HIDE);
220-
#endif
221-
}
222-
}
223-
224-
void MainBackend::SwitchConsoleVisibility() {
225-
m_ConsoleVisiblity = !m_ConsoleVisiblity;
226-
SetConsoleVisibility(m_ConsoleVisiblity);
227-
}
228-
229-
bool MainBackend::GetConsoleVisibility() {
230-
return m_ConsoleVisiblity;
231-
}
232-
233197
////////////////////////////////////////////////////////////////////////////////////////////////////////////
234198
//// RENDER ////////////////////////////////////////////////////////////////////////////////////////////////
235199
////////////////////////////////////////////////////////////////////////////////////////////////////////////

src/backend/MainBackend.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class MainBackend : public ez::xml::Config {
3131
ez::math::fvec2 m_LastNormalizedMousePos;
3232
ez::math::fvec2 m_NormalizedMousePos;
3333

34-
bool m_ConsoleVisiblity = false;
3534
uint32_t m_CurrentFrame = 0U;
3635

3736
bool m_NeedToCloseApp = false; // when app closing app is required
@@ -82,10 +81,6 @@ class MainBackend : public ez::xml::Config {
8281
ez::xml::Nodes getXmlNodes(const std::string& vUserDatas = "") final;
8382
bool setFromXmlNodes(const ez::xml::Node& vNode, const ez::xml::Node& vParent, const std::string& vUserDatas) final;
8483

85-
void SetConsoleVisibility(const bool vFlag);
86-
void SwitchConsoleVisibility();
87-
bool GetConsoleVisibility();
88-
8984
private:
9085
void m_RenderOffScreen();
9186

src/settings/DebugSettings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DebugSettings : public Ltg::ISettings {
3838
bool m_SignatureHelpEnabled = true; // tooltip opened on `(` in the code editor
3939
bool m_HoverEvalEnabled = true; // value-on-hover tooltip when paused
4040
bool m_ErrorMarkersEnabled = true; // red underlines + tooltips for last-run script errors
41-
bool m_AutoBreakpointOnError = false; // opt-in: pause at the error line + auto-set a breakpoint there
41+
bool m_AutoBreakpointOnError = true; // opt-in: pause at the error line + auto-set a breakpoint there
4242

4343
public:
4444
bool isProjectScriptRecompileEnabled() const;

0 commit comments

Comments
 (0)