Add zoom in support to the small map

Heavily referenced from citimania
6f8e0c144b
This commit is contained in:
Jonathan G Rennison
2023-01-17 23:07:54 +00:00
parent aaf9fcebee
commit 4bc19fad60
2 changed files with 128 additions and 216 deletions

View File

@@ -102,14 +102,14 @@ protected:
int32 scroll_x; ///< Horizontal world coordinate of the base tile left of the top-left corner of the smallmap display.
int32 scroll_y; ///< Vertical world coordinate of the base tile left of the top-left corner of the smallmap display.
int32 subscroll; ///< Number of pixels (0..3) between the right end of the base tile and the pixel at the top-left corner of the smallmap display.
int zoom; ///< Zoom level. Bigger number means more zoom-out (further away).
int tile_zoom; ///< Tile zoom level. Bigger number means more zoom-out (further away).
int ui_zoom; ///< UI (pixel doubling) Zoom level. Bigger number means more zoom-in (closer).
int zoom = 1; ///< Zoom level. Bigger number means more zoom-out (further away).
GUITimer refresh; ///< Refresh timer.
LinkGraphOverlay *overlay;
static void BreakIndustryChainLink();
Point SmallmapRemapCoords(int x, int y) const;
/**
* Draws vertical part of map indicator
@@ -177,19 +177,17 @@ protected:
uint GetNumberRowsLegend(uint columns) const;
void SelectLegendItem(int click_pos, LegendAndColour *legend, int end_legend_item, int begin_legend_item = 0);
void SwitchMapType(SmallMapType map_type);
void SetNewScroll(int sx, int sy, int sub);
uint GetRefreshPeriod() const;
uint PausedAdjustRefreshTimeDelta(uint delta_ms) const;
void DrawMapIndicators() const;
void DrawSmallMapColumn(void *dst, uint xc, uint yc, int pitch, int reps, int start_pos, int end_pos, Blitter *blitter) const;
void DrawSmallMapColumn(void *dst, uint xc, uint yc, int pitch, int reps, int start_pos, int end_pos, int y, int end_y, Blitter *blitter) const;
void DrawVehicles(const DrawPixelInfo *dpi, Blitter *blitter) const;
void DrawTowns(const DrawPixelInfo *dpi) const;
void DrawSmallMap(DrawPixelInfo *dpi, bool draw_indicators = true) const;
Point RemapTile(int tile_x, int tile_y) const;
Point PixelToTile(int px, int py, int *sub, bool add_sub = true) const;
Point ComputeScroll(int tx, int ty, int x, int y, int *sub);
Point TileToPixel(int tx, int ty) const;
Point PixelToTile(int px, int py) const;
void SetZoomLevel(ZoomLevelChange change, const Point *zoom_pt);
void SetOverlayCargoMask();
void SetupWidgetData();