00001
00002
00003
00004
00005
00006 #ifndef __geometry_h__
00007 #define __geometry_h__
00008
00009 #include "lin-city.h"
00010
00011 struct rect_struct
00012 {
00013 int x;
00014 int y;
00015 int w;
00016 int h;
00017 };
00018 typedef struct rect_struct Rect;
00019
00020 struct screen_geometry_struct
00021 {
00022 int border_x;
00023 int border_y;
00024 int client_w;
00025 int client_h;
00026
00027
00028 Rect client_win;
00029
00030
00031 Rect main_win;
00032
00033
00034 Rect pause_button;
00035 Rect slow_button;
00036 Rect med_button;
00037 Rect fast_button;
00038
00039
00040 Rect menu_button;
00041
00042
00043 Rect load_button;
00044 Rect save_button;
00045 Rect quit_button;
00046 Rect help_button;
00047
00048
00049 Rect results_button;
00050 Rect tover_button;
00051 Rect confine_button;
00052
00053
00054 Rect module_buttons;
00055
00056
00057 Rect pbar_area;
00058 Rect pbar_pop;
00059 Rect pbar_tech;
00060 Rect pbar_food;
00061 Rect pbar_jobs;
00062 Rect pbar_money;
00063 Rect pbar_coal;
00064 Rect pbar_goods;
00065 Rect pbar_ore;
00066 Rect pbar_steel;
00067
00068
00069 Rect sust;
00070
00071
00072 Rect select_message;
00073 Rect date;
00074 Rect time_for_year;
00075 Rect status_message_1;
00076 Rect status_message_2;
00077 Rect money;
00078
00079
00080 Rect mini_map;
00081 Rect mini_map_aux;
00082 Rect mini_map_area;
00083 #if defined (commentout)
00084 Rect ms_normal_button;
00085 Rect ms_pollution_button;
00086 Rect ms_fire_cover_button;
00087 Rect ms_ub40_button;
00088 Rect ms_coal_button;
00089 Rect ms_health_cover_button;
00090 Rect ms_cricket_cover_button;
00091 Rect ms_power_button;
00092 Rect ms_starve_button;
00093 Rect ms_ocost_button;
00094 #endif
00095
00096
00097 Rect monthgraph;
00098 Rect mappoint_stats;
00099
00100
00101 Rect market_cb;
00102 };
00103 typedef struct screen_geometry_struct Screen_Geometry;
00104
00105
00106
00107 void initialize_geometry (Screen_Geometry* scr);
00108 void resize_geometry (int new_width, int new_height);
00109 int mouse_in_rect (Rect* b, int x, int y);
00110 int pixel_to_mappoint(int px, int py, int *mpx, int *mpy);
00111 int pixel_to_winpoint(int px, int py, int *wpx, int *wpy);
00112 void adjust_main_origin (int new_origin_x, int new_origin_y, int refresh);
00113 void draw_pause (int active);
00114 void draw_slow (int active);
00115 void draw_med (int active);
00116 void draw_fast (int active);
00117 void draw_menu (void);
00118 void draw_load (void);
00119 void draw_save (void);
00120 void draw_quit (void);
00121 void draw_help (void);
00122 void draw_results (void);
00123 void draw_select_button_graphic (int button, char *graphic);
00124 void select_fast (void);
00125 void select_medium (void);
00126 void select_slow (void);
00127 void select_pause (void);
00128 void draw_ms_button (char* graphic);
00129 void draw_ms_text (char* txt);
00130 void draw_small_bezel (int x, int y, int w, int h, int colour);
00131 void draw_bezel (Rect r, short width, int color);
00132
00133
00134 #define CHAR_HEIGHT 8
00135 #define CHAR_WIDTH 8
00136
00137
00138 #define MAIN_WIN_W 432
00139 #define MAIN_WIN_X 56+8+1
00140 #define MAIN_WIN_Y 8
00141 #define MAIN_WIN_H 400
00142
00143
00144 #define SPEED_BUTTONS_X 0
00145 #define SPEED_BUTTONS_Y 416
00146 #define SPEED_BUTTONS_H 16
00147 #define SPEED_BUTTONS_W 32
00148 #define PAUSE_BUTTON_X SPEED_BUTTONS_X
00149 #define PAUSE_BUTTON_Y SPEED_BUTTONS_Y
00150 #define PAUSE_BUTTON_H 16
00151 #define PAUSE_BUTTON_W 32
00152 #define SLOW_BUTTON_X SPEED_BUTTONS_X
00153 #define SLOW_BUTTON_Y SPEED_BUTTONS_Y + SPEED_BUTTONS_H
00154 #define SLOW_BUTTON_H 16
00155 #define SLOW_BUTTON_W 32
00156 #define MED_BUTTON_X SPEED_BUTTONS_X
00157 #define MED_BUTTON_Y SPEED_BUTTONS_Y + 2 * SPEED_BUTTONS_H
00158 #define MED_BUTTON_H 16
00159 #define MED_BUTTON_W 32
00160 #define FAST_BUTTON_X SPEED_BUTTONS_X
00161 #define FAST_BUTTON_Y SPEED_BUTTONS_Y + 3 * SPEED_BUTTONS_H
00162 #define FAST_BUTTON_H 16
00163 #define FAST_BUTTON_W 32
00164
00165 #if defined (commentout)
00166 #define HELP_BUTTON_X 608
00167 #define HELP_BUTTON_Y 448
00168 #define HELP_BUTTON_W 32
00169 #define HELP_BUTTON_H 32
00170 #endif
00171 #define QUIT_BUTTON_X 608
00172 #define QUIT_BUTTON_Y 416
00173 #define QUIT_BUTTON_W 32
00174 #define QUIT_BUTTON_H 32
00175 #define LOAD_BUTTON_X 576
00176 #define LOAD_BUTTON_Y 416
00177 #define LOAD_BUTTON_W 32
00178 #define LOAD_BUTTON_H 32
00179 #define SAVE_BUTTON_X 576
00180 #define SAVE_BUTTON_Y 448
00181 #define SAVE_BUTTON_W 32
00182 #define SAVE_BUTTON_H 32
00183
00184
00185 #if defined (commentout)
00186 #define RESULTS_BUTTON_X 640 - 32
00187 #define RESULTS_BUTTON_Y 480 - 16
00188 #define RESULTS_BUTTON_W 32
00189 #define RESULTS_BUTTON_H 16
00190 #endif
00191 #define HELP_BUTTON_X 640 - 56
00192 #define HELP_BUTTON_Y 480 - 24
00193 #define HELP_BUTTON_W 56
00194 #define HELP_BUTTON_H 24
00195
00196 #define RESULTS_BUTTON_X 640 - 2*56
00197 #define RESULTS_BUTTON_Y 480 - 24
00198 #define RESULTS_BUTTON_W 56
00199 #define RESULTS_BUTTON_H 24
00200
00201
00202 #define MISC_BUTTONS_X 0
00203 #define MISC_BUTTONS_Y 400
00204 #define TOVER_BUTTON_X MISC_BUTTONS_X + 32
00205 #define TOVER_BUTTON_Y MISC_BUTTONS_Y
00206 #define TOVER_BUTTON_W 32
00207 #define TOVER_BUTTON_H 16
00208 #define CONFINE_BUTTON_X MISC_BUTTONS_X + 64
00209 #define CONFINE_BUTTON_Y MISC_BUTTONS_Y
00210 #define CONFINE_BUTTON_W 16
00211 #define CONFINE_BUTTON_H 16
00212
00213 #define MENU_BUTTON_X 0
00214 #define MENU_BUTTON_Y 0
00215 #define MENU_BUTTON_W 56
00216 #define MENU_BUTTON_H 24
00217
00218 #define SELECT_BUTTON_WIN_X 0
00219 #define SELECT_BUTTON_WIN_W 56
00220 #define SELECT_BUTTON_WIN_Y 24
00221 #define SELECT_BUTTON_WIN_H 392
00222 #define SELECT_BUTTON_WIDTH 16
00223 #define SELECT_BUTTON_DISTANCE 8
00224 #define SELECT_BUTTON_INTERVAL (SELECT_BUTTON_WIDTH + SELECT_BUTTON_DISTANCE)
00225
00226
00227
00228
00229 #define PBAR_W 56
00230 #define PBAR_H 16
00231
00232 #define PBAR_AREA_X (56+MAIN_WIN_W+16+2)
00233 #define PBAR_AREA_Y 0
00234 #define PBAR_AREA_H ((PBAR_H * 9) + 8 + 8)
00235 #define PBAR_AREA_W (640 - PBAR_AREA_X + 1)
00236
00237 #define PBAR_TEXT_W (PBAR_AREA_W - 8 - PBAR_W)
00238
00239
00240 #ifdef commentout
00241
00242 #define PBAR_POP_X (PBAR_AREA_X + 4)
00243 #define PBAR_POP_Y (PBAR_AREA_Y + 4)
00244 #define PBAR_TECH_X PBAR_POP_X
00245 #define PBAR_TECH_Y PBAR_POP_Y+(PBAR_H+1)
00246 #define PBAR_FOOD_X PBAR_POP_X
00247 #define PBAR_FOOD_Y PBAR_POP_Y+(PBAR_H+1)*2
00248 #define PBAR_JOBS_X PBAR_POP_X
00249 #define PBAR_JOBS_Y PBAR_POP_Y+(PBAR_H+1)*3
00250 #define PBAR_COAL_X PBAR_POP_X
00251 #define PBAR_COAL_Y PBAR_POP_Y+(PBAR_H+1)*4
00252 #define PBAR_GOODS_X PBAR_POP_X
00253 #define PBAR_GOODS_Y PBAR_POP_Y+(PBAR_H+1)*5
00254 #define PBAR_ORE_X PBAR_POP_X
00255 #define PBAR_ORE_Y PBAR_POP_Y+(PBAR_H+1)*6
00256 #define PBAR_STEEL_X PBAR_POP_X
00257 #define PBAR_STEEL_Y PBAR_POP_Y+(PBAR_H+1)*7
00258 #define PBAR_MONEY_X PBAR_POP_X
00259 #define PBAR_MONEY_Y PBAR_POP_Y+(PBAR_H+1)*8
00260 #endif
00261
00262 #define DATE_W 112
00263 #define MONEY_W 32 * CHAR_WIDTH
00264 #define TIME_FOR_YEAR_X 320
00265 #define TIME_FOR_YEAR_Y 470
00266 #define SELECT_BUTTON_MESSAGE_X MAIN_WIN_X
00267 #define SELECT_BUTTON_MESSAGE_Y 460
00268 #define STATUS_MESSAGE_1_X MAIN_WIN_X
00269 #define STATUS_MESSAGE_1_Y 440
00270 #define STATUS_MESSAGE_2_X MAIN_WIN_X
00271 #define STATUS_MESSAGE_2_Y 450
00272
00273 #define SUST_SCREEN_X 96
00274 #define SUST_SCREEN_Y 416
00275 #define SUST_SCREEN_W (60+8)
00276 #define SUST_SCREEN_H 20
00277
00278 #if defined (MAPPOINT_STATS_X)
00279 #undef MONTHGRAPH_X
00280 #undef MONTHGRAPH_Y
00281 #undef MAPPOINT_STATS_X
00282 #undef MAPPOINT_STATS_Y
00283 #undef MAPPOINT_STATS_W
00284 #endif
00285 #define MAPPOINT_STATS_X PBAR_AREA_X + 4
00286 #define MAPPOINT_STATS_Y PBAR_AREA_Y + PBAR_AREA_H + 4
00287 #define MAPPOINT_STATS_W PBAR_AREA_W - 8
00288 #define MAPPOINT_STATS_H (11*8)
00289
00290 #define MONTHGRAPH_X PBAR_AREA_X + 4
00291 #define MONTHGRAPH_Y MAPPOINT_STATS_Y + MAPPOINT_STATS_H + 8
00292
00293 #define MONTHGRAPH_W PBAR_AREA_W - 8
00294 #define MONTHGRAPH_H 64
00295
00296 #define MINI_MAP_AUX_X PBAR_AREA_X + 4
00297 #define MINI_MAP_AUX_Y MONTHGRAPH_Y + MONTHGRAPH_H + 8
00298 #define MINI_MAP_AUX_W PBAR_AREA_W - 8
00299 #define MINI_MAP_AUX_H 16
00300
00301 #define MINI_SCREEN_W WORLD_SIDE_LEN
00302 #define MINI_SCREEN_H WORLD_SIDE_LEN
00303 #define MINI_SCREEN_X MINI_MAP_AUX_X + ((MINI_MAP_AUX_W - MINI_SCREEN_W) / 2)
00304 #define MINI_SCREEN_Y MINI_MAP_AUX_Y + MINI_MAP_AUX_H + 2
00305
00306 #define MINI_MAP_AREA_X PBAR_AREA_X + 4
00307 #define MINI_MAP_AREA_Y MINI_MAP_AUX_Y
00308 #define MINI_MAP_AREA_W PBAR_AREA_W - 8
00309 #define MINI_MAP_AREA_H MINI_SCREEN_H + MINI_MAP_AUX_H + 2
00310
00311 #define MS_BUTTON_H 16
00312 #define MS_BUTTON_W 16
00313 #define MS_NORMAL_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W)
00314 #define MS_NORMAL_BUTTON_Y (MINI_SCREEN_Y)
00315 #define MS_POLLUTION_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W)
00316 #define MS_POLLUTION_BUTTON_Y (MINI_SCREEN_Y + 1*16)
00317 #define MS_FIRE_COVER_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W)
00318 #define MS_FIRE_COVER_BUTTON_Y (MINI_SCREEN_Y + 2*16)
00319 #define MS_UB40_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W)
00320 #define MS_UB40_BUTTON_Y (MINI_SCREEN_Y + 3*16)
00321 #define MS_HEALTH_COVER_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W)
00322 #define MS_HEALTH_COVER_BUTTON_Y (MINI_SCREEN_Y + 4*16)
00323 #define MS_COAL_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W)
00324 #define MS_COAL_BUTTON_Y (MINI_SCREEN_Y + 5*16)
00325 #define MS_CRICKET_COVER_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W + 1*16)
00326 #define MS_CRICKET_COVER_BUTTON_Y (MINI_SCREEN_Y + 1*16)
00327 #define MS_POWER_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W + 1*16)
00328 #define MS_POWER_BUTTON_Y (MINI_SCREEN_Y + 2*16)
00329 #define MS_STARVE_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W + 1*16)
00330 #define MS_STARVE_BUTTON_Y (MINI_SCREEN_Y + 3*16)
00331 #define MS_OCOST_BUTTON_X (MINI_SCREEN_X + MINI_SCREEN_W + 1*16)
00332 #define MS_OCOST_BUTTON_Y (MINI_SCREEN_Y + 4*16)
00333
00334 #define MARKET_CB_X (PBAR_AREA_X)
00335 #define MARKET_CB_Y (PBAR_AREA_Y)
00336
00337
00338
00339
00340 #endif