Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - chadushkind

Pages: [1]
1
Window / Re: Own window design from .png with shadows
« on: March 07, 2016, 07:55:30 pm »
Works perfect! Thank you very much. But can you explain about BLENDFUNCTION, DC, BITMAPS, etc. or give a good article about it all? And why UpdateLayeredWindow need to call not in cycle?

2
Window / Re: Own window design from .png with shadows
« on: March 05, 2016, 01:14:44 pm »
As I already said...

I'm not sure, but are you trying to create a partially transparent window? That is unfortunately not supported directly through SFML.

Ok, it's called partially transparent window. If SFML don't support it, can I do create this through winapi's "Layered Windows"? Somebody know good articles?

3
Window / Re: Own window design from .png with shadows
« on: March 05, 2016, 12:03:01 pm »
Yes, I did. With window filled by color shadows is like on image. But I don't need to have background color. :-(

4
Window / Re: Own window design from .png with shadows
« on: March 05, 2016, 11:05:00 am »
Window.clear(sf::Color::Transparent);
I think this color is the problem. If you changes it to White or Black the sprite's transparency will probably work.

No, it's only fill the window by specific color.

5
Window / Re: Own window design from .png with shadows
« on: March 04, 2016, 11:16:36 pm »
#include <SFML/Graphics.hpp>
#include <Windows.h>

int CALLBACK WinMain(
        _In_ HINSTANCE hInstance,
        _In_ HINSTANCE hPrevInstance,
        _In_ LPSTR     lpCmdLine,
        _In_ int       nCmdShow
        )
{
        // window
        sf::RenderWindow Window(sf::VideoMode(300, 400), "Window", sf::Style::None);

        sf::Vector2i mousePos;  // mouse coordinates relatively of window

        bool grabbedWindow = false;
        sf::Vector2i grabbedOffset;                                                                            
        sf::IntRect TaskBar(10, 24, (int)Window.getSize().x-10, 25);    // pseudo title bar

        // get image
        sf::Image imgBackground;
        imgBackground.loadFromFile("/path/to/image");

        // background image
        sf::Texture txBackground;
        sf::Sprite sprBackground;
        txBackground.loadFromImage(imgBackground);
        sprBackground.setTexture(txBackground);

        sf::Event Event;
        while(Window.isOpen())
        {
                mousePos = sf::Mouse::getPosition(Window);

                // events
                while(Window.pollEvent(Event))
                {
                        // closing
                        if(Event.type == sf::Event::Closed || (Event.type == sf::Event::KeyPressed && Event.key.code == sf::Keyboard::Escape))
                                Window.close();

                        // LMB
                        else if(Event.type == sf::Event::MouseButtonPressed && Event.mouseButton.button == sf::Mouse::Left)
                        {
                                // title bar contains mouse
                                if(TaskBar.contains(mousePos))
                                {
                                        grabbedOffset = Window.getPosition() - sf::Mouse::getPosition();
                                        grabbedWindow = true;
                                }
                        }
                        // LMB
                        else if(Event.type == sf::Event::MouseButtonReleased && Event.mouseButton.button == sf::Mouse::Left)
                        {
                                if(TaskBar.contains(mousePos))
                                        grabbedWindow = false;
                        }

                }
               
                if(grabbedWindow)
                        Window.setPosition(sf::Mouse::getPosition() + grabbedOffset);

                Window.clear(sf::Color::Transparent);
                Window.draw(sprBackground);
                Window.display();
        }
}

/path/to/image - whatever .png image with outer shadows and without background color. I posted an example up in this thread.

6
Window / Re: Own window design from .png with shadows
« on: March 04, 2016, 10:45:46 pm »
Viewer Program shows image with shadows. All is fine. I also tried saving .png as "Export for Web -> PNG 24 bit"(photoshop) menu option, but it too didn't work.

7
Window / Re: Own window design from .png with shadows
« on: March 04, 2016, 09:42:14 pm »
For example.

What I want:


What I got:

8
Window / Own window design from .png with shadows
« on: March 04, 2016, 07:13:28 pm »
Hello guys.

1) I have a .psd design and some layers of it uses blending mode with shadows.
2) I create a .png of background image which takes layers with shadow.
3) I create a window that has "sf::Style::None" style.

And as result I taking the window where shadows of background image replaced by black pixels.

What i do in my code:
1) Create window with "sf::Style::None".
2) Load background-image to sf::Image, load image to sf::Texture, and create sf::Sprite from this texture.

Also it all looks like very bold border around image.

Thanks for answers.

9
Graphics / Re: White rectangle
« on: February 19, 2014, 03:29:14 pm »
Have you searched before posting? This problem has appeared dozens of times in the past. It always has to do with textures that are invalidated.

There are several mistakes in your code: You don't check for errors when loading, you return a copy (instead of reference) in GetTexture(), and you needlessly allocate a dynamic texture, where you could directly load the texture inside the map. The destructor is also unnecessary, STL containers clean up properly on their own.

Thank you very much. I used the search before, I understood the problem, but I did not understand the decision. I did not consider the option of using references. Thank you again!

10
Graphics / White rectangle
« on: February 19, 2014, 02:43:37 pm »

when i run the application, I get a white square. Why? And how to fix it? Thnx.

Pages: [1]
anything