#include "dclient/widgets.h" #include "dclient/widgets/inventory.h" #include "dclient/widgets/map.h" #include "dclient/widgets/query.h" #include "dclient/widgets/stats.h" #include #include // distance between boxes static int const DX = 4; static int const DY = 2; // stats height static int const SH = 10; using ndk::app; void widgets::repack () { map->move (DX, DY, ndk::absolute); map->resize (app ().width () / 2 - DX * 2, app ().height () / 3 * 2); info.move (map->right_x () + DX, DY, ndk::absolute); info.resize (app ().width () - map->width () - DX * 3, map->height () - SH - DY); stats->move (info.x (), info.bottom_y () + DY, ndk::absolute); stats->resize (info.width (), SH); input.move (map->x (), map->bottom_y () + 1, ndk::absolute); input.resize (map->width () + DY + info.width () + DY); inventory->move (map->x (), input.bottom_y () + 1, ndk::absolute); inventory->resize (app ().width () / 2 - DX * 2, app ().height () - map->height () - DY * 3); container->move (stats->x (), inventory->y (), ndk::absolute); container->resize (inventory->width (), inventory->height ()); query->move ( (app ().width () - query->width ()) / 2 , (app ().height () - query->height ()) / 2 , ndk::absolute ); query_input.resize (query->width () - 2); query_input.move (query->x () + 1, query->bottom_y () - 2, ndk::absolute); } void widgets::resize () { repack (); info.visualize (); } widgets::widgets () : map (new map_widget) , stats (new stats_widget) , inventory (new inventory_widget) , container (new inventory_widget) , query (new query_widget) , query_input ("", query.get ()) { query->resize (10, 5); repack (); map->visualize (); info.visualize (); stats->visualize (); inventory->visualize (); container->visualize (); map->focus (); //invmenu.focus (); } widgets::~widgets () { }