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.


Topics - Maksat

Pages: [1]
1
General / Lags in recorded video
« on: August 13, 2020, 08:59:16 am »
Hello! In the recorded video (with Bandicam), lags occur at least once every 20 seconds, although everything worked smoothly while I was recording. I've have tried several screen recording programs. The result is same everywhere. In other games this does not happen, only in SFML programs. What could be the problem?

Recorded video of my game:

2
Hello! I'm trying to get transparent texture like this (made with Photoshop)

by combining it from separate textures on transparent RenderTexture

If draw them in default blend mode and RenderTexture cleared as transparent, they loose glowing effects like in first image below. The result I want to ahcieve is like on right image, but it was cleared as black and it's not transparent


I tried all blending modes and tried unsuccessfully to write custom ones. What can I do? I think I could solve it with shaders but I didn't try yet. There's more elegant way for sure.
Here is a minimal code
#include <SFML/Graphics.hpp>

using namespace sf;
int main()
{
        sf::RenderWindow window(sf::VideoMode(360, 200), "SFML works!", Style::Default);
        window.setFramerateLimit(60);

        sf::IntRect redNoteTextureBounds{ 0, 0, 184, 100 };
        sf::IntRect blueNoteTextureBounds{ 184, 0, 184, 100 }; 
        sf::IntRect longNotesTextureBounds{ 0, 100, 184, 100 };

        Texture t; t.loadFromFile("Texture.png");
        Sprite s1(t);
        s1.setTextureRect(blueNoteTextureBounds);

        RenderTexture rt;
        Sprite s2(t);
        rt.create(184, 175);
        rt.clear(Color::Transparent);

        s2.setTextureRect(blueNoteTextureBounds);
        s2.setPosition(0, 0);
        rt.draw(s2, RenderStates());
       
        s2.setPosition(0,80);
        rt.draw(s2, RenderStates());

        s2.setTextureRect(longNotesTextureBounds);
        s2.setPosition(0, 40);
        rt.draw(s2, RenderStates());

        rt.display();
        s2.setTexture(rt.getTexture(), true);  
        s2.setPosition(130, 0);

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                }

                window.clear();
                window.draw(s1);
                window.draw(s2);
                window.display();
        }

        return 0;
}
 

3
Hello! I've finally released my EasyPianoGame on Steam: https://store.steampowered.com/app/1126220/EasyPianoGame/

I knew a problem about crashing in fullscreen style for a long time. I could not solve it at that moment and just used
sf::VideoMode::getFullscreenModes();
sf::RenderWindow window (FSModes[0], "", sf::Style::None);
 
and forgot afbout it.

After launch, some players started complaining about resolution problems and I decided to add resolution change feature.
So what is going on: When I create fullscreen window like this
sf::RenderWindow window(sf::VideoMode::getFullscreenModes()[0], "", sf::Style::Fullscreen);
 
it crashes. Not necessarily every time but often enough. And also some times the program crashes when the window closes. It happens when I run program on Intel GPU. In AMD GPU it works fine, but super slow and heavily loads the CPU, this is another problem.

Here is example code:
#include <SFML/Graphics.hpp>

int main()
{
        auto FSModes = sf::VideoMode::getFullscreenModes();

        sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
        window.setFramerateLimit(60);

        sf::CircleShape shape(100.f);
        shape.setFillColor(sf::Color::Green);

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();

                        if (event.type == sf::Event::KeyPressed)
                                switch (event.key.code)
                                {
                                case sf::Keyboard::Escape:
                                        window.close();
                                        break;
                                case sf::Keyboard::Num1:
                                        window.create(FSModes[3], "", sf::Style::None);
                                        break;
                                case sf::Keyboard::Num2:
                                        window.create(FSModes[3], "", sf::Style::Default);
                                        break;
                                case sf::Keyboard::Num3:
                                        window.create(FSModes[3], "", sf::Style::Fullscreen);
                                        break;
                                case sf::Keyboard::Num4:
                                        window.create(FSModes[0], "", sf::Style::None);
                                        break;
                                case sf::Keyboard::Num5:
                                        window.create(FSModes[0], "", sf::Style::Fullscreen);
                                        break;
                                }

                        if (event.type == sf::Event::MouseButtonPressed)
                        {
                                auto pos = sf::Mouse::getPosition();
                                shape.setPosition(pos.x - shape.getRadius(), pos.y - shape.getRadius());
                        }
                }

                window.clear();
                window.draw(shape);
                window.display();
        }

        return 0;
}
 

Non full-screen window style switches work fine, but when you switch to full-screen style, with a probability of 50% it will crash. Debugger shows unhandled exception in ig7icd32.dll

Pages: [1]
anything