Skip to content

Improve: Allow users to set map background alpha #7958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

Harrison-Teeg
Copy link
Contributor

@Harrison-Teeg Harrison-Teeg commented Jul 17, 2025

Brief overview of PR changes/additions

Enable users to set alpha values for the mapper's background (e.g. 0 for a fully transparent map background).

Motivation for adding to Mudlet

This unlocks some really neat GUI options as I personally love having a map overlay on top of the main console.

Other info (issues closed, discussion etc)

Currently needs further testing with 3D maps etc. But making available ASAP for people to play with.

Pardon the light mode!
https://github.com/user-attachments/assets/0c501008-974b-41bd-b1be-ecba288f4c71

To make background transparent as in the video set the alpha to 0 in: Preferences > Mapper colors > Background color

@Harrison-Teeg Harrison-Teeg changed the title Enhancement: Allow users to set map background alpha Improve: Allow users to set map background alpha Jul 17, 2025
@SlySven
Copy link
Member

SlySven commented Jul 17, 2025

Caution: does this work when the 3D map is activated - given that that is a QOpenGL widget the behaviour may not be what you expect!

I would also note that setting the map background colour currently does not set it for the 3D map - it should do and I've previously prototyped code that did do it - IIRC you just need to find the place(s) where glClearColor(0.0, 0.0, 0.0, 1.0); is done and convert that to glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF()); where color is the QColor that has been set for the map background. I see that is being done in three places but one of them is for the error message - and you might want to change that case to something else like a nice tasteful yellow text on a red background for both the 2D and 3D maps... 😀

@Harrison-Teeg
Copy link
Contributor Author

Caution: does this work when the 3D map is activated - given that that is a QOpenGL widget the behaviour may not be what you expect!

No this currently only effects the 2D map. Unsurprisingly, as Preferences > Mapper Colors > Background color has no influence on the background of the 3D map before this PR anyway.

I am investigating the 3D map for the potential of tying everything together, but I would argue that even failing that, this PR would be fine in the sense that it adds the functionality to the 2D map without impacting the 3D map.

@Harrison-Teeg
Copy link
Contributor Author

Harrison-Teeg commented Jul 17, 2025

I would also note that setting the map background colour currently does not set it for the 3D map - it should do and I've previously prototyped code that did do it - IIRC you just need to find the place(s) where glClearColor(0.0, 0.0, 0.0, 1.0); is done and convert that to glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF()); where color is the QColor that has been set for the map background. I see that is being done in three places but one of them is for the error message - and you might want to change that case to something else like a nice tasteful yellow text on a red background for both the 2D and 3D maps... 😀

I'm experimenting with this for the 3D map. So far I have the 3D map background color properly setting but am not getting transparency working. Will continue poking it.

image

@SlySven
Copy link
Member

SlySven commented Jul 18, 2025

... but am not getting transparency working....

Yeah that is the exact sort of weirdness you might get - it is down to the way the OpenGL image is (blitted?) onto the other widgets - and it may also have OS dependent behaviour:

image

This might be fouling things for you as well:
image

image

@Harrison-Teeg
Copy link
Contributor Author

Harrison-Teeg commented Jul 18, 2025

I've fixed the 3D map background to work with colors as well as alpha values. This works at least for Win11. I haven't tested on other OSes yet and as you've mentioned SlySven, these things can get tricky depending on OS.

It's also possible that setting this flag (setAttribute(Qt::WA_AlwaysStackOnTop);) will create issues. I'll try to test it more, but I'm going to be quite busy for the next two weeks so it'll be a while before I can pick this up again.

Screen.Recording.2025-07-17.182928.mp4

I would appreciate some testing! <3

Edit: Tested works with Fedora / Wayland

@vadi2
Copy link
Member

vadi2 commented Jul 22, 2025

/create links

2 similar comments
@miedward
Copy link
Contributor

/create links

@miedward
Copy link
Contributor

/create links

Copy link
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in my testing!

@ZookaOnGit
Copy link
Collaborator

works great!

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.

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy