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

Pages: [1]
1
General discussions / Re: A wish for the upcoming 2.4.3 release
« on: October 05, 2017, 08:59:06 pm »
Quote
As a Windows XP user
Can you describe the reasons why you're stuck on such an old system?

My choice is one part irrational (personal preference and nostalgia) and one part rational (old hardware works better with old software).

2
General discussions / A wish for the upcoming 2.4.3 release
« on: October 05, 2017, 08:40:18 pm »
Hello, I am currently using old software (Windows XP, Visual Studio 2008 and 2010).

I wish that the next few SFML 2.4.x releases will continue to support legacy systems. I do understand that there is a natural urge to abandon unsupported operating systems and start using improved standards such as C++11. Of course I am in favor of such progress for SFML 3, however I also want backward compatibility to be maintained for a few more years, in the form of SFML 2.4.x releases.

As a Windows XP user I am already abandoned by the developers of MSYS2, Cygwin and nuwen MinGW, for no good technical reason and it is displeasing. So please consider keeping the 2.4.x releases backward compatible and written in C++98. Kind regards.

3
General discussions / Re: Windows XP supported by SFML 2.4.2?
« on: August 01, 2017, 07:50:31 pm »
As for your own code, it seems like you're using some static function call or similar (global variable) to store/construct an sf::Clock object. Since the sf::Clock object will get constructed in global scope, but since the mutex inside the sf::Clock is also in a global scope and because initialization order in a global scope is undefined, it just so happens that the sf::Clock gets initialized before the mutex gets initialized, causing a crash.
So you can fix this by not having an sf::Clock constructed in the global scope.
Note that this bug affected the unmodified SFML demos as well, not just my test projects. That said, well done finding the location of the bug. This is the first time I see the "static initialization order fiasco" in a real project.

Additionally you could try and see if this change fixes the issue for you.
We'd actually be really glad if you could test this, since we rarely develop things on XP. ;)

Confirming that the above patch fixes the problem on1:

  • Windows XP SP3, Visual Studio 2010 SP1
  • Windows XP Mode (Windows 7 SP1), Visual Studio 2010 SP1
  • Windows XP Mode (Windows 7 SP1), Visual Studio 2017
  • Windows XP SP3, Visual Studio 2017

1 I will edit this post to include test results for Windows XP Mode and VS2017.

Also, I too am glad that you didn't drop support for Windows XP yet, and hoping that you won't do soon. I consider the 32-bit world to be a sweet spot that shouldn't be thrown in the trash yet.

4
General discussions / Re: VS 2017 Static & Dynamic problems with 2.4.2
« on: August 01, 2017, 05:11:29 pm »
Did you remember to define SFML_STATIC macro in case you're using the static SFML libraries?

Code: [Select]
Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions -> <add SFML_STATIC; here>

As for using CMake, you must be sure to start it from within the VS2017 command prompt, otherwise it won't find the VS2017 tools.

Code: [Select]
Start -> All Programs -> Visual Studio 2017 -> Visual Studio Tools -> Developer Command Prompt for VS 2017
(Hopefully you have allowed CMake to add itself to the PATH at installation.)

5
General discussions / Re: Windows XP supported by SFML 2.4.2?
« on: August 01, 2017, 12:57:10 pm »
Does the following short piece of code also crash?

No, it does not crash.

6
General discussions / Re: Windows XP supported by SFML 2.4.2?
« on: July 31, 2017, 06:45:59 pm »
Let me know (in this thread) when a bug-fix becomes available for testing, or if I need to provide more information. Thanks.

7
General discussions / Re: Windows XP supported by SFML 2.4.2?
« on: July 30, 2017, 04:51:37 pm »
Code: [Select]
ntdll.dll!_RtlEnterCriticalSection@4()  + 0xb bytes
> window-d.exe!sf::priv::MutexImpl::lock()  Line 52 + 0xc bytes C++
  window-d.exe!sf::Mutex::lock()  Line 57 C++
  window-d.exe!sf::Lock::Lock(sf::Mutex & mutex)  Line 39 C++
  window-d.exe!sf::priv::ClockImpl::getCurrentTime()  Line 74 C++
  window-d.exe!sf::Clock::Clock()  Line 42 + 0x17 bytes C++
  window-d.exe!`anonymous namespace'::ConnectionCache::ConnectionCache()  Line 43 + 0x1f bytes C++
  window-d.exe!`vector constructor iterator'(void * __t, unsigned int __s, int __n, void * (void *)* __f)  + 0x17 bytes C++
  window-d.exe!`anonymous namespace'::`dynamic initializer for 'connectionCache''()  Line 49 + 0x16 bytes C++
  msvcr100d.dll!__initterm()  + 0x1c bytes
  window-d.exe!__tmainCRTStartup()  Line 473 + 0xf bytes C
  window-d.exe!mainCRTStartup()  Line 371 C
  kernel32.dll!_BaseProcessStart@4()  + 0x23 bytes

8
General discussions / Re: Windows XP supported by SFML 2.4.2?
« on: July 30, 2017, 04:18:52 pm »
You're running Windows XP with SP3 natively on some PC, correct?
Do you build on XP as well or on your non-XP machine.

Yes, and yes. Building shared and static libraries without the SFML_USE_STATIC_STD_LIBS flag.

Note that if the .DLL's are used, everything runs fine. The crash only occurs for static linking of SFML2.

Can you provide the complete call stack?

Yes, let me know what exactly to copy-paste for you.

Code: [Select]
ntdll.dll!7c90100b()
  [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
> window-d.exe!sf::priv::MutexImpl::lock()  Line 52 + 0xc bytes C++

9
General discussions / Windows XP supported by SFML 2.4.2?
« on: July 30, 2017, 08:22:10 am »
Hello, are the SFML devs still willing to look into XP specific bugs?

If yes, I believe I found a problem affecting Windows XP when SFML is linked statically. The resulting application1 crashes before creating the window and the debugger breaks at:

src/SFML/System/Win32/MutexImpl.cpp:52

It seems that the EnterCriticalSection() function may be the problem.

This issue affects both Windows XP SP3 and Windows XP Mode, regardless of whether Visual Studio 2010 SP1 (v100) or Visual Studio 2017 (v141_xp) were used to build the application and SFML.

1 resulting application = any SFML application, including any of its demos

10
Thank you for your help. I have only minor questions now, because things seem to work fine.

My code currently works by drawing the sprite with a combined states (so the sprite entity itself is not transformed) and then it draws the sprite's local bounding box as transformed by the car's matrix.

Questions:
  • How should I handle wanting to center the sprite?
  • In sf::Drawable::draw() is it often that states.transform isn't the identity matrix?

Expanding on question 1, I'm currently doing setOrigin() in the car constructor and it works fine, but is it the right approach?

11
The correct approach would be to build the car's local bounding rect (which should be the same as the sprite's one, if it's the only entity it contains), and then transform it by the car's transform (car.getTransform()).

I do not understand what I need to do. The car has a sf::Sprite and a sf::Texture, as data.
  • Do you mean that there should also be a sf::FloatRect to hold the bounding box data?
  • Or a rectangle entity from which to extract the bounding box? If yes, why is it wrong to use the sprite directly for this?
  • Or do you want me to take the local bounding box of the sprite and then transform it? But that doesn't make sense to me.

Simplified example code would probably be easier for me to understand at this point.

12
Your suggestion doesn't work in my case: the bounding box will be drawn in the (default?) upper left corner of the screen and will not be affected by the sprite's rotation.

Do I need to directly .rotate() and .move() the sprite when the Car is? That would be a problem.

EDIT: the problem was apparently solved by setting the position and rotation of the sprite and not combining the state transforms.

// inside a Car::update function
sprite.setPosition(getPosition());
sprite.setRotation(getRotation());

Let me know if this approach is wrong, thanks.

13
General / How to correctly use sf::Transformable and sf::Drawable?
« on: July 27, 2017, 05:26:04 pm »
Hello, I do not understand how to correctly use the sf::Transformable and sf::Drawable classes. My Car class inherits from them, and it overrides the draw() function. The car has a sf::Sprite member data.

The problem is that the sprite's global bounding box is not axis-aligned; when the car is rotated, so too is the sprite's bounding box.

The questions I have are:
  • What member data should a class that inherits from sf::Transformable and sf::Drawable contain? Sprites, rectangles, etc.?
  • Is my Car class supposed to implement the getLocalBounds() and getGlobalBounds() member functions?

Following the tutorial steps I now have the equivalent of this simplified code:

//
// Car.hpp
//
class Car : public sf::Transformable, public sf::Drawable
{
private:

    sf::Texture     texture;
    sf::Sprite      sprite;

public:

    Car()
    {
        // load texture, and
        // load sprite using texture
    }

private:

    void draw(sf::RenderTarget &target, sf::RenderStates states) const override
    {
        states.transform.combine(getTransform());
        target.draw(sprite, states);

        // and draw sprite.getGlobalBounds() rectangle
    }
};

//
// main.cpp
//
int main()
{
    // typical window code from tutorials

    Car car;

    car.rotate(45);

    // typical event and looping code from tutorials
    {
        render_window.draw(car); // <-- BUG: the bounding box is at 45 degrees!
    }
}
 

14
General discussions / Re: Fully static linkage using VS2017 and SFML2
« on: July 20, 2017, 07:12:57 pm »
You can recompile SFML yourself with the proper CMake option (see the tutorial). Takes no longer than posting on this forum ;)

Yes; my post was a suggestion, not a help request.

I believe that people who want to statically link SFML probably also want to statically link the VC runtime library. If this is true, doing so should be supported in future releases of the official binaries.

Thank you for your time.

15
General discussions / Fully static linkage using VS2017 and SFML2
« on: July 20, 2017, 06:25:35 pm »
Software versions:
  • Visual Studio 2017 Community Edition
  • SFML 2.4.2, official 32-bit binaries for Visual Studio 2015

Intent:
  • Creating a simple SFML test program that has no .DLL dependencies.

Problem:

  • Cannot link1 with SFML if choosing a non-DLL Runtime Library option in:
    Project -> MyProj Properties -> C/C++ -> Code Generation -> Runtime Library
  • Otherwise, resulting executable cannot run due to dependencies on:
    • MSVCP140.dll
    • VCRUNTIME140.dll
    • API-MS-WIN-CRT-*.dll

Suggestion:
Please release the upcoming binaries of SFML for VS2017 such that if static linkage is desired (SFML_STATIC) then the program will not depend on developer .DLLs.

1 Error message listing:
Code: [Select]
sfml-graphics-s.lib(RenderStates.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(Transformable.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(Font.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(RenderWindow.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(Color.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(Text.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(Transform.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(Image.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(View.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(Shader.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(GLExtensions.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(VertexArray.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-graphics-s.lib(Glsl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(Window.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(VideoMode.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(Context.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(GlContext.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(WindowImpl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(VideoModeImpl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(WglContext.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(JoystickManager.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(SensorManager.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(WglExtensions.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(Joystick.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-window-s.lib(JoystickImpl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-system-s.lib(String.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-system-s.lib(Err.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
sfml-system-s.lib(ThreadLocal.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
MSVCRT.lib(_chandler4gs_.obj) : error LNK2001: unresolved external symbol __except_handler4_common

Pages: [1]
anything