Skip to content

Commit

Permalink
Merge pull request #4 from db48x/ImguifyHelpMenu
Browse files Browse the repository at this point in the history
Make the help window full screen and resize it when the game resizes
  • Loading branch information
Procyonae authored Dec 15, 2024
2 parents 5eec260 + db4cae5 commit 86a1399
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
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

0 comments on commit 86a1399

Please sign in to comment.