Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDL] ^ replace Courier font with Julia Mono Regular #458

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AppCUI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ${FREETYPE_LIBRARIES})
# Add font used by SDL
include(CMakeRC)

set(FONT_NAME Courier.ttf)
set(FONT_NAME JuliaMono-Regular.ttf)
set(FONT_PATH resources/${FONT_NAME})
target_compile_definitions(${PROJECT_NAME} PRIVATE FONT_PATH="${FONT_PATH}")
cmrc_add_resource_library(font ${FONT_PATH})
Expand Down
Binary file removed AppCUI/resources/Courier.ttf
Binary file not shown.
Binary file added AppCUI/resources/JuliaMono-Regular.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion AppCUI/src/Dialogs/WindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class InternalWindowManager : public Controls::Window
ItemHandle focusedItem{ InvalidItemHandle };

public:
InternalWindowManager() : Controls::Window("Window manager", "d:c,w:72,h:20", WindowFlags::None)
InternalWindowManager() : Controls::Window("Window manager", "d:c,w:72,h:20", WindowFlags::Sizeable)
{
}
bool Create();
Expand Down
16 changes: 6 additions & 10 deletions AppCUI/src/Terminal/SDLTerminal/SDLTerminalScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ bool SDLTerminal::InitScreen(const InitializationData& initData)
// Default size is half the screen
SDL_DisplayMode DM;
CHECK(SDL_GetCurrentDisplayMode(0, &DM) == 0, false, "Failed getting SDL current display mode: %s", SDL_GetError());
size_t pixelWidth = DM.w / 2;
size_t pixelHeight = DM.h / 2;
size_t pixelWidth = DM.w;
size_t pixelHeight = DM.h;

Uint32 windowFlags = 0;
if ((initData.Flags & InitializationFlags::FixedSize) == InitializationFlags::None)
Expand All @@ -137,23 +137,17 @@ bool SDLTerminal::InitScreen(const InitializationData& initData)
if ((initData.Flags & InitializationFlags::Maximized) != InitializationFlags::None)
{
windowFlags |= SDL_WindowFlags::SDL_WINDOW_MAXIMIZED;
pixelWidth = DM.w;
pixelHeight = DM.h;
}
else if ((initData.Flags & InitializationFlags::Fullscreen) != InitializationFlags::None)
{
windowFlags |= SDL_WindowFlags::SDL_WINDOW_FULLSCREEN;
pixelWidth = DM.w;
pixelHeight = DM.h;
}
else if ((initData.Width != 0) && (initData.Height != 0))
{
pixelWidth = charWidth * initData.Width;
pixelHeight = charWidth * initData.Height;
}

const auto cp = std::filesystem::current_path();

window = SDL_CreateWindow(
"AppCUI",
SDL_WINDOWPOS_CENTERED,
Expand All @@ -172,15 +166,17 @@ bool SDLTerminal::InitScreen(const InitializationData& initData)
const size_t heightInChars = pixelHeight / charHeight;
CHECK(screenCanvas.Create(widthInChars, heightInChars),
false,
"Fail to create an internal canvas of %d x %d size",
"Failed to create an internal canvas of %d x %d size",
widthInChars,
heightInChars);
CHECK(originalScreenCanvas.Create(widthInChars, heightInChars),
false,
"Fail to create the original screen canvas of %d x %d size",
"Failed to create the original screen canvas of %d x %d size",
widthInChars,
heightInChars);

autoRedraw = (initData.Flags & InitializationFlags::EnableFPSMode) != InitializationFlags::None;

return true;
}

Expand Down
Loading