Skip to content

Commit

Permalink
enable imgui iteminfo on examine in inventory selector, aim and craft…
Browse files Browse the repository at this point in the history
…ing menu
  • Loading branch information
mqrause committed Aug 28, 2024
1 parent 196f7ec commit 9fce736
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
7 changes: 4 additions & 3 deletions src/advanced_inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include "translations.h"
#include "type_id.h"
#include "ui.h"
#include "ui_iteminfo.h"
#include "ui_manager.h"
#include "uistate.h"
#include "units.h"
Expand Down Expand Up @@ -1792,10 +1793,10 @@ void advanced_inventory::action_examine( advanced_inv_listitem *sitem,

item_info_data data( it.tname(), it.type_name(), vThisItem, vDummy );
data.handle_scrolling = true;
data.arrow_scrolling = true;

ret = draw_item_info( [&]() -> catacurses::window {
return catacurses::newwin( 0, info_width(), point( info_startx(), 0 ) );
}, data ).get_first_input();
iteminfo_window info_window( data, point( info_startx(), 0 ), info_width(), TERMY );
info_window.execute();
}
if( ret == KEY_NPAGE || ret == KEY_DOWN ) {
spane.scroll_by( +1 );
Expand Down
12 changes: 7 additions & 5 deletions src/crafting_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "translations.h"
#include "type_id.h"
#include "ui.h"
#include "ui_iteminfo.h"
#include "ui_manager.h"
#include "uistate.h"

Expand Down Expand Up @@ -1865,11 +1866,12 @@ std::pair<Character *, const recipe *> select_crafter_and_crafting_recipe( int &
item_info_data data = result_info.get_result_data( current[line], 1, line_item_info_popup,
w_iteminfo );
data.handle_scrolling = true;
draw_item_info( []() -> catacurses::window {
const int width = std::min( TERMX, FULL_SCREEN_WIDTH );
const int height = std::min( TERMY, FULL_SCREEN_HEIGHT );
return catacurses::newwin( height, width, point( ( TERMX - width ) / 2, ( TERMY - height ) / 2 ) );
}, data );
data.arrow_scrolling = true;
const int info_width = std::min( TERMX, FULL_SCREEN_WIDTH );
const int info_height = std::min( TERMY, FULL_SCREEN_HEIGHT );
iteminfo_window info_window( data, point( ( TERMX - info_width ) / 2, ( TERMY - info_height ) / 2 ),
info_width, info_height );
info_window.execute();
} else if( action == "FILTER" ) {
int max_example_length = 0;
for( const auto &prefix : prefixes ) {
Expand Down
11 changes: 6 additions & 5 deletions src/inventory_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "translations.h"
#include "type_id.h"
#include "uistate.h"
#include "ui_iteminfo.h"
#include "ui_manager.h"
#include "units.h"
#include "units_utility.h"
Expand Down Expand Up @@ -3476,11 +3477,11 @@ void inventory_selector::action_examine( const item_location &sitem )

item_info_data data( sitem->tname(), sitem->type_name(), vThisItem, vDummy );
data.handle_scrolling = true;
draw_item_info( [&]() -> catacurses::window {
int maxwidth = std::max( FULL_SCREEN_WIDTH, TERMX );
int width = std::min( 80, maxwidth );
return catacurses::newwin( 0, width, point( maxwidth / 2 - width / 2, 0 ) ); },
data ).get_first_input();
data.arrow_scrolling = true;
int maxwidth = std::max( FULL_SCREEN_WIDTH, TERMX );
int width = std::min( 80, maxwidth );
iteminfo_window info_window( data, point( maxwidth / 2 - width / 2, -1 ), width, 0 );
info_window.execute();
}

void inventory_selector::highlight()
Expand Down

0 comments on commit 9fce736

Please sign in to comment.