Skip to content

Commit

Permalink
Fix settings.ini & add a check to the window size when creating window
Browse files Browse the repository at this point in the history
  • Loading branch information
dfranx committed Jun 28, 2019
1 parent 02061b4 commit e82d54c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
8 changes: 7 additions & 1 deletion GUIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ namespace ed
font = fonts->AddFontDefault();
else font = fonts->AddFontFromFileTTF(m_cachedFont.c_str(), m_cachedFontSize);

fonts->AddFontFromFileTTF(edFont.first.c_str(), edFont.second);
ImFont* edFontPtr = fonts->AddFontFromFileTTF(edFont.first.c_str(), edFont.second);

if (font == nullptr || edFontPtr == nullptr) {
fonts->Clear();
font = fonts->AddFontDefault();
font = fonts->AddFontDefault();
}

ImGui::GetIO().FontDefault = font;
fonts->Build();
Expand Down
3 changes: 2 additions & 1 deletion SHADERed.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
Expand Down Expand Up @@ -110,6 +110,7 @@
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>E:\SHADERed\libs;E:\MoonLight\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down
5 changes: 5 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ int main()
fullscreen = preload.get();
maximized = preload.get();
preload.close();

if (wndWidth > GetSystemMetrics(SM_CXVIRTUALSCREEN))
wndWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
if (wndHeight > GetSystemMetrics(SM_CYVIRTUALSCREEN))
wndHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
}
else
DeleteFileA("workspace.dat"); // prevent from crashing
Expand Down
4 changes: 2 additions & 2 deletions settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ reopenshaders=1
openshadersdblclk=1
template=HLSL
customfont=0
font=E:\SHADERed\Debug\inconsolata.ttf
font=inconsolata.ttf
fontsize=16
[preview]
gizmo=1
Expand All @@ -18,7 +18,7 @@ statusbar=1
fpslimit=0
[editor]
smartpred=1
font=E:\SHADERed\inconsolata.ttf
font=inconsolata.ttf
fontsize=18
whitespace=0
highlightline=1
Expand Down

0 comments on commit e82d54c

Please sign in to comment.