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

make the help window full screen and resize it when the game resizes #4

Merged
merged 2 commits into from
Dec 15, 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
8 changes: 3 additions & 5 deletions src/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,8 @@ void help_window::draw_category_selection()
format_title( _( "Help" ) );
// Split the categories in half
if( ImGui::BeginTable( "Category Options", 2, ImGuiTableFlags_None ) ) {
ImGui::TableSetupColumn( "Left Column", ImGuiTableColumnFlags_WidthStretch,
static_cast<float>( window_width / 2.0f ) );
ImGui::TableSetupColumn( "Right Column", ImGuiTableColumnFlags_WidthStretch,
static_cast<float>( window_width / 2.0f ) );
ImGui::TableSetupColumn( "Left Column", ImGuiTableColumnFlags_WidthStretch, 1.0f );
ImGui::TableSetupColumn( "Right Column", ImGuiTableColumnFlags_WidthStretch, 1.0f );
int half_size = static_cast<float>( data.help_categories.size() / 2.0f ) + 1;
auto half_it = data.help_categories.begin();
std::advance( half_it, half_size );
Expand Down Expand Up @@ -347,7 +345,7 @@ void help_window::parse_keybind_tags()

cataimgui::bounds help_window::get_bounds()
{
return bounds;
return {0, 0, 1.0, 1.0};
}

void help_window::show()
Expand Down
13 changes: 0 additions & 13 deletions src/help.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,6 @@ class help_window : public cataimgui::window
void draw_controls() override;
cataimgui::bounds get_bounds() override;
private:
// Fullscreen
float window_width = static_cast<float>( str_width_to_pixels( TERMX ) );
float window_height = static_cast<float>( str_width_to_pixels( TERMY ) );
float wrap_width = window_width * 0.95f;
cataimgui::bounds bounds{ 0.f, 0.f, static_cast<float>( str_width_to_pixels( TERMX ) ), static_cast<float>( str_height_to_pixels( TERMY ) ) };
const bool screen_reader = get_option<bool>( "SCREEN_READER_MODE" );

// 66 is optimal characters per line for reading?
//float window_width = static_cast<float>( wrap_width ) * 2.025f;
//float window_height = static_cast<float>( str_width_to_pixels( TERMY ) ) * 0.8f;
//float wrap_width = std::min( window_width * 0.95f, static_cast<float>( str_width_to_pixels( 66 ) ) );
//cataimgui::bounds bounds{ 0.f, 0.f, window_width, window_height };

help &data = get_help();
input_context ctxt;
std::map<int, input_event> hotkeys;
Expand Down
Loading