1 #ifndef _UI_LAYOUT_H_ 2 #define _UI_LAYOUT_H_ 3 4 #include "Types.h" 5 6 ///////////////////////////////////////////////////////////// 7 // defines 8 ///////////////////////////////////////////////////////////// 9 10 #define NUM_INVENTORY_SLOTS (19) 11 12 /* Following defines allow us to not change the old code too much. 13 * It will help to preserve original Stracciatella codebase. */ 14 15 #define SCREEN_HEIGHT (g_ui.m_screenHeight) 16 #define SCREEN_WIDTH (g_ui.m_screenWidth) 17 #define INV_INTERFACE_START_Y (g_ui.get_INV_INTERFACE_START_Y()) 18 #define INTERFACE_START_Y (g_ui.get_INTERFACE_START_Y()) 19 #define gsVIEWPORT_START_X (g_ui.m_VIEWPORT_START_X) 20 #define gsVIEWPORT_START_Y (g_ui.m_VIEWPORT_START_Y) 21 #define gsVIEWPORT_WINDOW_START_Y (g_ui.m_VIEWPORT_WINDOW_START_Y) 22 #define gsVIEWPORT_END_X (g_ui.m_VIEWPORT_END_X) 23 #define gsVIEWPORT_END_Y (g_ui.m_VIEWPORT_END_Y) 24 #define gsVIEWPORT_WINDOW_END_Y (g_ui.m_VIEWPORT_WINDOW_END_Y) 25 #define STD_SCREEN_X (g_ui.m_stdScreenOffsetX) 26 #define STD_SCREEN_Y (g_ui.m_stdScreenOffsetY) 27 #define MAP_SCREEN_WIDTH (g_ui.m_mapScreenWidth) 28 #define MAP_SCREEN_HEIGHT (g_ui.m_mapScreenHeight) 29 30 #define SM_BODYINV_X (244) 31 #define SM_BODYINV_Y (INV_INTERFACE_START_Y + 6) 32 33 #define EDITOR_TASKBAR_HEIGHT (120) 34 #define EDITOR_TASKBAR_POS_Y (UINT16)(SCREEN_HEIGHT - EDITOR_TASKBAR_HEIGHT) 35 36 #define DEFAULT_EXTERN_PANEL_X_POS (STD_SCREEN_X + 320) 37 #define DEFAULT_EXTERN_PANEL_Y_POS (STD_SCREEN_Y + 40) 38 39 ///////////////////////////////////////////////////////////// 40 // type definitions 41 ///////////////////////////////////////////////////////////// 42 43 // USED TO SETUP REGION POSITIONS, ETC 44 struct INV_REGION_DESC 45 { 46 UINT16 uX; 47 UINT16 uY; 48 setINV_REGION_DESC49 void set(UINT16 x, UINT16 y) 50 { 51 uX = x; 52 uY = y; 53 } 54 }; 55 56 57 struct MoneyLoc 58 { 59 UINT16 x; 60 UINT16 y; 61 setMoneyLoc62 void set(UINT16 _x, UINT16 _y) 63 { 64 x = _x; 65 y = _y; 66 } 67 }; 68 69 70 /** User Interface layout definition. */ 71 struct UILayout 72 { 73 public: 74 UINT16 m_mapScreenWidth; 75 UINT16 m_mapScreenHeight; 76 UINT16 m_screenWidth; 77 UINT16 m_screenHeight; 78 INV_REGION_DESC m_invSlotPositionMap[NUM_INVENTORY_SLOTS]; /**< Map screen inventory slots positions */ 79 INV_REGION_DESC m_invSlotPositionTac[NUM_INVENTORY_SLOTS]; /**< Tactical screen Inventory slots positions */ 80 INV_REGION_DESC m_invCamoRegion; /**< Camo (body) region in the inventory. */ 81 82 SGPBox m_progress_bar_box; 83 MoneyLoc m_moneyButtonLoc; 84 MoneyLoc m_MoneyButtonLocMap; 85 86 /** Viewport coordiantes. 87 * Viewport is the area of the screen where tactical map is displayed. 88 * For 640x480 it is (320, 180) */ 89 UINT16 m_VIEWPORT_START_X; 90 UINT16 m_VIEWPORT_START_Y; 91 UINT16 m_VIEWPORT_WINDOW_START_Y; 92 93 UINT16 m_VIEWPORT_END_X; 94 UINT16 m_VIEWPORT_END_Y; 95 UINT16 m_tacticalMapCenterX; /**< Center of the tactical map (for 640x480 it is (320, 180)). */ 96 UINT16 m_tacticalMapCenterY; /**< Center of the tactical map (for 640x480 it is (320, 180)). */ 97 98 UINT16 m_VIEWPORT_WINDOW_END_Y; 99 100 SGPRect m_wordlClippingRect; 101 102 SGPPoint m_versionPosition; 103 SGPPoint m_contractPosition; 104 SGPPoint m_attributePosition; 105 SGPPoint m_trainPosition; 106 SGPPoint m_vehiclePosition; 107 SGPPoint m_repairPosition; 108 SGPPoint m_assignmentPosition ; 109 SGPPoint m_squadPosition ; 110 111 UINT16 m_stdScreenOffsetX; /** Offset of the standard (640x480) window */ 112 UINT16 m_stdScreenOffsetY; /** Offset of the standard (640x480) window */ 113 114 /** Constructor. 115 * @param screenWidth Screen width 116 * @param screenHeight Screen height */ 117 UILayout(UINT16 screenWidth, UINT16 screenHeight); 118 119 /** Set new screen size. 120 * This method should be called before most of the application initialization is done. */ 121 bool setScreenSize(UINT16 width, UINT16 height); 122 123 /** Check if the screen is bigger than original 640x480. */ 124 bool isBigScreen(); 125 126 UINT16 currentHeight(); 127 UINT16 get_CLOCK_X(); 128 UINT16 get_CLOCK_Y(); 129 UINT16 get_INTERFACE_START_Y(); 130 UINT16 get_INV_INTERFACE_START_Y(); 131 UINT16 get_RADAR_WINDOW_X(); 132 UINT16 get_RADAR_WINDOW_TM_Y(); 133 134 /** Get X position of tactical textbox. */ 135 UINT16 getTacticalTextBoxX(); 136 137 /** Get Y position of tactical textbox. */ 138 UINT16 getTacticalTextBoxY(); 139 140 protected: 141 /** Recalculate UI elements' positions after changing screen size. */ 142 void recalculatePositions(); 143 }; 144 145 ///////////////////////////////////////////////////////////// 146 // external declarations 147 ///////////////////////////////////////////////////////////// 148 149 extern UILayout g_ui; 150 151 ///////////////////////////////////////////////////////////// 152 // 153 ///////////////////////////////////////////////////////////// 154 155 #endif 156