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 - ThatOneGuyThatDoesStuff

Pages: [1] 2
Window / Re: Mouse cursor reverting to default when leaving the window
« on: January 16, 2022, 12:43:09 pm »
I haven't played around with custom cursors myself, but looking at the sfml source the sf::Cursor class destroys the allocated system specific cursor when it goes out of scope.
To me, the code looks like sf::Cursor should exist for the lifetime of the program, not be a temporary in PrepareMouseCursor(). So perhaps it's holding a residual image while in the window, when it leaves the window then returns the cursor you set no longer exists.

Try moving the sf::Cursor out of the function and maybe put it where the renderWindow is, so it has a similar lifetime.

(Technically: Win32 DestroyCursor() is called when sf::Cursor destructs)

Eh, this worked. Thanks for the assist man.

Window / Re: Mouse cursor reverting to default when leaving the window
« on: January 15, 2022, 09:52:23 pm »
Are you setting it through sf::Cursor?

I am.

void ChangeGameState::PrepareMouseCursor(){
    sf::Image cursorImage;
    sf::Cursor cursor;
    cursor.loadFromPixels(cursorImage.getPixelsPtr(), sf::Vector2u(CURSOR_SIZE, CURSOR_SIZE), sf::Vector2u(0, 0));

I set the mouse cursor to a custom one. But when the mouse cursor leaves the games window, it reverts back to Windows 7 default cursor, and doesn't go back. Is this just something I need to watch for in the code? Do I need to reset the cursor each time the cursor leaves the window and returns?

I load and set the mouse cursor which works as expected. But as soon as it leaves the bounds of the created window, the cursor changes back to the normal Windows 7 cursor and doesn't change back to the custom cursor if it returns into the window. Any idea why? Thanks.

Graphics / Re: Scale offset
« on: June 26, 2021, 01:49:16 pm »
Scaling as any other transformation happens around/from the origin.
If your origin is set to the middle of the sprite, it will expand equally in all direction.
If your origin is set to the top left corner (default), then it will scale in the bottom right direction.

You sir, are an officer and a gentleman and a credit to your old mum and dad.

Graphics / Scale offset
« on: June 22, 2021, 09:50:57 pm »
Whenever I have tried to scale a sprite, it offsets down slightly. It doesn't move left or right, but it's position is lower that it should be (greater y value). I have no idea why. Would appreciate an explanation as to what I'm doing wrong.


Graphics / Re: Just cannot get sf::Text to draw without crash
« on: September 17, 2020, 09:45:33 pm »
Go to the Intel's website and find the latest driver for your integrated graphics chip and install that.

I'll try that, but like I said, I also tried it on my new windows 10 PC and get the exact same issue, so I have my doubts it will work. If it does though, you have my eternal gratitude.

Graphics / Re: Just cannot get sf::Text to draw without crash
« on: September 05, 2020, 10:33:31 pm »
All I can suggest is go back to basics. Check your environment. Make sure you don't have more than one or an old version of sfml installed. Check your headers match the installation of the library and haven't been copied from a different installation. Ensure that debug libraries are linked to the debug builds and release libraries are linked to the release build. If all else fails try a different compiler, like clang or msvc. At least that way you should be able to eliminate some possibilities.

I have done all of the above except try a different compiler. I'll try that. But, like I said in the original post, I installed SFML on my laptop AND my desktop. It seems unlikely that I made the same setup mistake twice, spaced quite far apart.

Did you try running any of the SFML examples? If I had to guess they will crash too because this is looking like another case of buggy Intel OpenGL driver.

Yeah, they crash

Graphics / Re: Just cannot get sf::Text to draw without crash
« on: September 01, 2020, 10:41:35 pm »
Doesn't look like anyone has any solutions. Does anyone know a workaround? Maybe some third party software to make text draw to an sfml window? Or is there a way to strong arm it through SFML's code?

Graphics / Re: Just cannot get sf::Text to draw without crash
« on: August 29, 2020, 11:28:56 pm »
Do you know what causes the error? (Such as invalid pointer, etc)

I really don't. No information is given.

Graphics / Re: Just cannot get sf::Text to draw without crash
« on: August 29, 2020, 10:45:11 pm »
@fallahn, thanks for the suggestion, but the problem remains alive and well and unchanged if I do that. Don't suppose you have another suggestion :'(

@Hapax, I moved the text creation to after the font, still same problem. Getting really frustrated. It's such a stupid problem, but quite unsolveable.

Graphics / Re: Just cannot get sf::Text to draw without crash
« on: August 25, 2020, 11:17:13 pm »
It doesn't fail. I checked that before, I still get the same issue. The font loads fine (at least according, .loadFromFile will execute with a check in place.

To be sure I changed it to:
    if (!font.loadFromFile("cour.ttf")){
        std::cout << "Error: font did not load";

No error is thrown.

Graphics / Just cannot get sf::Text to draw without crash
« on: August 23, 2020, 10:28:10 pm »
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <ioStream>

int main()
    sf::Text testText;
    sf::Font font;
    testText.setString("Hello World");
    testText.setPosition(200, 200);
    // Create the main window
    sf::RenderWindow renderWindow(sf::VideoMode(WIDTH, HEIGHT), "SFML window");

        // Start the game loop
    while (renderWindow.isOpen())
        // Process events
        sf::Event event;
        while (renderWindow.pollEvent(event))
            // Close window : exit
            if (event.type == sf::Event::Closed)

        // Clear screen

        // Draw sprites

        // Update the window

    return EXIT_SUCCESS;

No matter what I do, I cannot get an sf::Text object to draw without the app instantly crashing. Been plagued by this problem for months. I've asked reddit, stack overflow and even here. I'm hoping for better results, because I have no idea what else to do to make it work. I have reinstalled both code::blocks and sfml. I installed sfml and Code::Blocks on a different pc, same problem. I have tried different fonts, same problem. All other SFML features function exactly as they should.

I'm using Code::Blocks v17.12 and SFML v2.5.1

If I comment out
, it will run (though not draw obviously). If I comment out
it will run without a crash.

If I run debugger I get the info that the problem file is C:\Windows\SysWOW64\ig4icd32.dll. I've tried looking that up, but get nothing related to my problem.

Any help is appreciated. Also, if anyone knows a work around, I would appreciate it.

Graphics / Re: Drawing text immediately crashes
« on: July 09, 2020, 11:01:53 pm »
To be 100% sure, there are two options:
- download the matching compiler, with the link given on the download page of SFML, and use it to compile your project
- recompile SFML with the compiler that you currently use for your project

So, I left this issue alone since I wasn't getting anywhere. I kinda need it to work now though, so I've been trying to figure out the problem again. I reinstalled all compiler/libraries from scratch to be sure there is no issue there. I ran the debugger then and now got this from the call stack:
Any ideas?

Thanks for the help, btw

Graphics / texture.loadfromfile causes crash?
« on: July 07, 2020, 10:42:58 pm »
2 Textures, no different than all the others I have loaded, cause the program to crash immediately. They are private variables inside a class, and I loadFromFile() in the constructor, but trying to load from anywhere else, even in main{}, causes a crash.. I have done this with plenty other classes and textures, but these two in particular are just causing a crash. By changing them to global variables, they load fine.

Any idea why this might be happening?

Pages: [1] 2