SFML community forums
Help => Window => Topic started by: Domingo Diego on June 25, 2009, 06:38:50 am
-
Hello
I think I might be doing this wrong as nobody has had this problem so far.
(Or maybe it's just not possible)
I'm trying to set the window's background color to be 0% Opaque.
However, when the window runs it runs at 100% Opacity regardless of what number I put in the 4th argument of the sf::Color's constructor.
Here's the code:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow App(sf::VideoMode(800, 600), "Test", sf::Style::None);
App.SetFramerateLimit(600);
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
}
App.Clear(sf::Color(0,0,0,0));
App.Display();
}
return 0;
}
That creates a 800 x 600 frameless window that is, unfortunatly, black and completely opaque.
Am I doing this wrong? Is it not possible? (I did search, I couldn't find anyone asking this question...)
Edit:
I am using SFML 1.5
-
You can't set the window's opacity like this. The fact that the OpenGL back buffer is transparent won't tell Windows to make the window transparent as well ;)
Setting the window opacity would requires a new function, and is very OS-specific. It's not even supported by every OS.
-
Ah, I see.
Yeah, I worked up an ugly Windows API call to make the window transparent only to figure out I really didn't want it transparent after all.
I'll mark the post as [SOLVED] because you can set the window's transparency, but it's OS-Specific and it's sort of useless.
The solution is out there though if a person really wants a semi-transparent window that only works on Windows (There may be a Mac way, but that's still OS specific).
Thanks for the help!
Btw: Nice library