Hi!
I've was trying to find a solution for this problem all around but still couldn't find it. Tried a bunch of stuff but they all result in the same window with opaque colors(Might be because I'm still a noob
).
So what I want to do it have a borderless window without any title bar and stuff and have the window itself also be semi-transparent or may be have a repeating semi-transparent image. Something similar to rainmeter skins.. I have my base code below. Let me know if you want to clear something out. Thanks!
#include "stdafx.h"
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "", sf::Style::None);
sf::Vector2i grabbedOffset;
sf::Texture texture;
if (!texture.loadFromFile("BlackBG.png", sf::IntRect(10, 10, 32, 32)))
{
std::cout << "count not load image" << std::endl;
}
sf::Sprite sprite;
sprite.setTexture(texture);
bool grabbedWindow = false;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
else if (event.type == sf::Event::KeyPressed)
{
if (event.key.code == sf::Keyboard::Escape)
window.close();
}
else if (event.type == sf::Event::MouseButtonPressed)
{
if (event.mouseButton.button == sf::Mouse::Left)
grabbedOffset = window.getPosition() - sf::Mouse::getPosition();
}
}
sprite.setColor(sf::Color(255, 255, 255, 128)); // half transparent
window.clear(sf::Color(0, 200, 0, 10));
grabbedWindow = sf::Mouse::isButtonPressed(sf::Mouse::Left);
if (grabbedWindow)
window.setPosition(sf::Mouse::getPosition() + grabbedOffset);
window.display();
}
}