Skip to content

Conversation

@Sunnyl75
Copy link

This PR adds support for an optional background image on the map canvas.

Features:

  • Background image loads via the existing texture/modding system
  • User can toggle background image visibility from the Preferences > Graphics tab
  • Image is drawn beneath the map using a new render layer above the canvas

Technical Notes:

  • Image is named background-image.png
  • Respects modding fallback: first loads from modding directory if available
  • Does not rely on depth testing

Additional Info:

  • Adds showBackgroundImage setting to config
  • Adds backgroundImageCheckBox to the UI

Considerations/Limitations:

-Stretches the image between pre-defined room co-ordinates in order to match the background map I cropped.
-These are arbitrary for my uses with the map I made, but could be given an 'official' range if you think it's useful generally.
-The image I supplied isn't necessary - could be a transparent background-image.png in Pixmaps. Then it only loads if in modding folder and toggled.

Tested on macOS with both default and custom background images.

Let me know if any adjustments are needed!

@codecov
Copy link

codecov bot commented May 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.05%. Comparing base (c59476e) to head (a4c60ba).
Report is 60 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #380      +/-   ##
==========================================
- Coverage   68.77%   67.05%   -1.73%     
==========================================
  Files          84       85       +1     
  Lines        4029     4107      +78     
  Branches      249      249              
==========================================
- Hits         2771     2754      -17     
- Misses       1258     1353      +95     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nschimme nschimme force-pushed the master branch 2 times, most recently from 3e39f0d to a659e00 Compare May 16, 2025 19:13
@Sunnyl75 Sunnyl75 force-pushed the background-overlay-layer branch from a4c60ba to 0658d19 Compare May 18, 2025 01:50
@nschimme nschimme force-pushed the master branch 3 times, most recently from e446b42 to 0f05563 Compare May 30, 2025 14:40
Sunnyl75 added 7 commits June 2, 2025 12:03
- Removed manual QImage loading and texture setup for background image in MapCanvas::initializeGL().
- Background image is now loaded via loadTexture() in initTextures(), using the same fallback mechanism as other modding assets.
- Renamed 'background.png' to 'background-image.png' for consistency and alignment with naming in mmapper2.qrc.
- Manually assigned OpenGL texture ID to backgroundImage in initTextures().
- Registered the texture with OpenGL via setTextureLookup(), as done for other manual textures.
- Resolves assertion failure in getId() when background image was enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant