MCPcopy Create free account
hub / github.com/DFHack/dfhack / getMapViewport

Function getMapViewport

plugins/rendermax/renderer_light.cpp:66–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66rect2d getMapViewport()
67{
68 const int AREA_MAP_WIDTH = 23;
69 const int MENU_WIDTH = 30;
70 if(!gps || !df::viewscreen_dwarfmodest::_identity.is_instance(DFHack::Gui::getCurViewscreen()))
71 {
72 if(gps && df::viewscreen_dungeonmodest::_identity.is_instance(DFHack::Gui::getCurViewscreen()))
73 {
74 return mkrect_wh(0,0,gps->dimx,gps->dimy);
75 }
76 else
77 return mkrect_wh(0,0,0,0);
78
79 }
80 int w=gps->dimx;
81 int h=gps->dimy;
82 int view_height=h-2;
83 int area_x2 = w-AREA_MAP_WIDTH-2;
84 int menu_x2=w-MENU_WIDTH-2;
85 int menu_x1=area_x2-MENU_WIDTH-1;
86 int view_rb=w-1;
87
88 int area_pos=(*df::global::ui_menu_width)[1];
89 int menu_pos=(*df::global::ui_menu_width)[0];
90 if(area_pos<3)
91 {
92 view_rb=area_x2;
93 }
94 if (menu_pos<area_pos || df::global::plotinfo->main.mode!=0)
95 {
96 if (menu_pos >= area_pos)
97 menu_pos = area_pos-1;
98 int menu_x = menu_x2;
99 if(menu_pos < 2) menu_x = menu_x1;
100 view_rb = menu_x;
101 }
102 return mkrect_wh(1,1,view_rb,view_height+1);
103}
104lightingEngineViewscreen::lightingEngineViewscreen(renderer_light* target):lightingEngine(target),threading(this),doDebug(false)
105{
106 reinit();

Callers 6

calculateMethod · 0.85
updateWindowMethod · 0.85
fixAdvModeMethod · 0.85
doSunMethod · 0.85
doOcupancyAndLightsMethod · 0.85
signalDoneOcclusionMethod · 0.85

Calls 2

mkrect_whFunction · 0.85
is_instanceMethod · 0.80

Tested by

no test coverage detected