Skip to content

Commit

Permalink
Add optional moddable demo section to sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
wapcaplet committed Oct 10, 2020
1 parent e70259b commit 863b9dd
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/panels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include "vpart_position.h"
#include "weather.h"
#include "weather_type.h"
#include "widget.h"

static const trait_id trait_NOPAIN( "NOPAIN" );
static const trait_id trait_SELFAWARE( "SELFAWARE" );
Expand Down Expand Up @@ -1832,6 +1833,38 @@ static void draw_overmap_wide( avatar &u, const catacurses::window &w )
wnoutrefresh( w );
}

// Moddable sidebar
static void draw_mod_sidebar_narrow( avatar &u, const catacurses::window &w )
{
werase( w );
widget focus = widget_id( "focus_num" ).obj();
mvwprintz( w, point( 0, 0 ), c_light_gray, _( focus.show( u ) ) );
mvwprintz( w, point( 0, 1 ), c_light_gray, _( "More TODO" ) );
wnoutrefresh( w );
}

static void draw_mod_sidebar_wide( avatar &u, const catacurses::window &w )
{
werase( w );

widget bodyparts_top = widget_id( "bodyparts_top_layout" ).obj();
widget bodyparts_bottom = widget_id( "bodyparts_bottom_layout" ).obj();
widget stamina_focus = widget_id( "stamina_focus_layout" ).obj();
widget sound_speed_move = widget_id( "sound_speed_move_layout" ).obj();
widget stats = widget_id( "stats_layout" ).obj();

draw_rectangle( w, c_light_gray, point_zero, point( 43, 9 ) );
mvwprintz( w, point( 3, 0 ), c_light_gray, _( "Data Driven Sidebar Demo" ) );

mvwprintz( w, point( 1, 1 ), c_light_gray, _( bodyparts_top.layout( u, 42 ) ) );
mvwprintz( w, point( 1, 2 ), c_light_gray, _( bodyparts_bottom.layout( u, 42 ) ) );
mvwprintz( w, point( 1, 3 ), c_light_gray, _( stamina_focus.layout( u, 42 ) ) );
mvwprintz( w, point( 1, 4 ), c_light_gray, _( sound_speed_move.layout( u, 42 ) ) );
mvwprintz( w, point( 1, 5 ), c_light_gray, _( stats.layout( u, 42 ) ) );

wnoutrefresh( w );
}

static void draw_veh_compact( const avatar &u, const catacurses::window &w )
{
werase( w );
Expand Down Expand Up @@ -2093,6 +2126,8 @@ static std::vector<window_panel> initialize_default_classic_panels()
20, 44, false ) );
ret.emplace_back( window_panel( draw_messages_classic, "Log", to_translation( "Log" ),
-2, 44, true ) );
ret.emplace_back( window_panel( draw_mod_sidebar_wide, "Moddable", to_translation( "Moddable" ),
10, 44, false ) );
#if defined(TILES)
ret.emplace_back( window_panel( draw_mminimap, "Map", to_translation( "Map" ),
-1, 44, true, default_render, true ) );
Expand Down Expand Up @@ -2130,6 +2165,8 @@ static std::vector<window_panel> initialize_default_compact_panels()
8, 32, true ) );
ret.emplace_back( window_panel( draw_overmap_narrow, "Overmap", to_translation( "Overmap" ),
14, 32, false ) );
ret.emplace_back( window_panel( draw_mod_sidebar_narrow, "Moddable", to_translation( "Moddable" ),
10, 32, false ) );
#if defined(TILES)
ret.emplace_back( window_panel( draw_mminimap, "Map", to_translation( "Map" ),
-1, 32, true, default_render, true ) );
Expand Down Expand Up @@ -2176,6 +2213,8 @@ static std::vector<window_panel> initialize_default_label_narrow_panels()
8, 32, true ) );
ret.emplace_back( window_panel( draw_overmap_narrow, "Overmap", to_translation( "Overmap" ),
14, 32, false ) );
ret.emplace_back( window_panel( draw_mod_sidebar_narrow, "Moddable", to_translation( "Moddable" ),
10, 32, false ) );
#if defined(TILES)
ret.emplace_back( window_panel( draw_mminimap, "Map", to_translation( "Map" ),
-1, 32, true, default_render, true ) );
Expand Down Expand Up @@ -2226,6 +2265,8 @@ static std::vector<window_panel> initialize_default_label_panels()
8, 44, true ) );
ret.emplace_back( window_panel( draw_overmap_wide, "Overmap", to_translation( "Overmap" ),
20, 44, false ) );
ret.emplace_back( window_panel( draw_mod_sidebar_wide, "Moddable", to_translation( "Moddable" ),
10, 44, false ) );
#if defined(TILES)
ret.emplace_back( window_panel( draw_mminimap, "Map", to_translation( "Map" ),
-1, 44, true, default_render, true ) );
Expand Down

0 comments on commit 863b9dd

Please sign in to comment.