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 May 13, 2024
1 parent bc39ab3 commit 2ecf93c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/advanced_inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,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 @@ -1770,9 +1771,8 @@ void advanced_inventory::action_examine( advanced_inv_listitem *sitem,
item_info_data data( it.tname(), it.type_name(), vThisItem, vDummy );
data.handle_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(), 0 );
info_window.execute();
}
if( ret == KEY_NPAGE || ret == KEY_DOWN ) {
spane.scroll_by( +1 );
Expand Down
11 changes: 6 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 @@ -1834,11 +1835,11 @@ 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 );
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
10 changes: 5 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 @@ -3464,11 +3465,10 @@ 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();
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 2ecf93c

Please sign in to comment.