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

Pages: [1]
SFML projects / Re: SFML Maths & Iterators utility
« on: April 22, 2021, 06:06:06 pm »

For simplification, I removed most of the template lookup for a simpler function overload. It is more redondant, but the compilation time may be less long and it's also simpler. I rewrited the code so the iterators utilities are done for the moment (and they are not that useful).

Github link: https://github.com/Eren121/SFML-Math

The functions are for simple use. For most complex use, I recommand GLM.

SFML website / Re: Multiplication Operator in Handling time Tutorial
« on: August 21, 2020, 07:30:02 pm »
Looking at the documentation, the operator* for sf::Time has two overload: one taking float and the other taking Int64. While your argument 2 is convertible to Int64 without any problem (either it's 32 or 64 bits), it's also convertible to float which result in a ambiguity to which method call (even if it's the same expected behaviour, there is two definitions).

You could either try to replace 2 by 2.f to explicitly use the float version or by 2L to use explicitly the long version (which are probably the same). You need probably the 2L version if you're expecting only integers value.

SFML development / Re: SFML Move Semantics
« on: August 20, 2020, 01:47:30 am »
I guess everybody including SFML Devs has holidays ^^

SFML development / Re: SFML Move Semantics
« on: August 01, 2020, 11:43:49 pm »
I can be biaised by what I need, but I suggest to first add move semantic for simple classes, that is which do not need custom logic.

Which method to use may be important for consistency, but maybe there should be no more than few tens of classes that supports move semantics, so rewriting style from one method to another may take not long.

Most of the work is to identify which classes need custom move logic (I think mostly Handles/Resources), and which ones don't. In this case, it should be possible to make a prototype to follow about the style and conventions, edge-cases classes could be modified after.

SFML development / Re: SFML Move Semantics
« on: June 22, 2020, 02:18:39 pm »
IMHO, the use of new C++ features, and more generally SFML codes changes are of two kinds:

- internal SFML code modifications that do not affect the library users (auto, decltype)
- modifications that affect user code (move semantics, destructuration... No or almost others?)

Of course, it's not that simple but some modifications can be 50/50 or more like in favor of one thing.

With any of the new C++ features, for me, the most important is move semantic and others are generally relevant to internal SFML code. The idea behind that is that internal modification is not critical but external changes or new features are, when the user code should change or, better, when new things are possible that were not possible previously. Use of auto inside of a method doesn't charge more for the user code, but move semantic is way more useful for the user, that can write code that he couldn't do earlier, and it's also only C++11 (so stable feature and no C++14, C++17 or +) so for me, it's the most important feature to implement. In addition, the code modifications needed are probably relatively small, and standard methods can probably be used. The small codes changes should however be tested because move semantics is (litteraly lol) a memory-critical feature :)

Another argument to implement move semantics: many new C++ features take advantage of move semantics. Of course, with this sort of argument, it's the snake biting its tail, but it should be noticed that even if SFML doesn't use C++11, probably like 90% of users do, and try to implement pre-C++11 code in an environment that probably use all that. So it's critical. And at least the others new features would maybe need to implement move semantics.

So for me: litteraly now ^^ (next release, that is SFML 2.x)

SFML projects / SFML Maths & Iterators utility
« on: October 28, 2019, 01:20:36 am »
[Update] Github link: https://github.com/Eren121/SFML-Math
Previous download link https://www.dropbox.com/s/tp0w90qd1mj0ul1/SFMLMath.zip?dl=0

Hello all!
To debug and avoid repeated stuff, Ii coded a tiny header only lib in C++11.
It add basic math stuff and printable Vectors and Color of the form (X, Y [, Z] ) or (R, G, B, A) to debug better :)

And Vectors/Colors are now... iterables!

Sample :

#include <SFML/Math.h>
#include <iostream>
#include <vector>

using namespace std;

int main()
    sf::Vector3f myVec3(1, 1, 0);
    sf::Vector2f myVec2(1, 1);

    cout << myVec2 << endl;
    cout << length(myVec2) << ", " << length(myVec3) << endl;
    cout << length2(myVec2) << endl;
    cout << distance({1, 2}, myVec2) << endl;
    cout << dot(myVec3, {0, 0, 1}) << endl;

    for(float & f : myVec2) {
        f += 1;

    cout << myVec2 << endl;

    return 0;

Output :

Code: [Select]
(1, 1)
1.41421, 1.41421
(2, 2)

If you have any suggestion ^^

Pages: [1]