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

Author Topic: Thor 2.0 released!  (Read 368591 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Thor 2.0
« Reply #105 on: June 16, 2012, 08:26:05 pm »
Quote
with VS and warning level 4, there is this annoying "assignment operator couldn't be generated". I'll probably deactivate it throughout the whole project (and maybe leave a macro for the people who still need this warning).
This means that your class is not copyable, so you could just make it explicit (inherit from sf::NonCopyable, or do it directly).
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #106 on: June 16, 2012, 08:39:16 pm »
This means that your class is not copyable, so you could just make it explicit (inherit from sf::NonCopyable, or do it directly).
Not assignable, to be exact. The warning occurs mainly at places where I use reference members. For example, my aurora::CopiedPtr can handle copyable, non-assignable classes, so making them noncopyable can be a limitation. But yes, in some cases it would work.

Actually, I could just use a pointer instead of a reference, but then I lose expressiveness and safety, since pointers can be changed and initialized with NULL. I don't really like the fact of doing that only for a useless compiler warning telling me what I already know... :P

By the way, I slightly changed the colors of my website, I hope it appears less aggressive now.
« Last Edit: June 16, 2012, 09:10:35 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Thor 2.0
« Reply #107 on: June 16, 2012, 09:50:37 pm »
Quote
I don't really like the fact of doing that only for a useless compiler warning telling me what I already know...
It's not useless, it warns you about something that is supposed to be done automatically but which cannot. Therefore the behaviour may not be what you expect, and an explicit handling of assignment might be required.

The clean solution to this warning is to explicitely write the behaviour that you want: either an assignment of the reference's value (if not rebinding the reference is what you want), changing it to a pointer (if you want to rebind the reference) or disabling the assignment operator (if none is correct).
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11007
    • View Profile
    • development blog
    • Email
Re: Thor 2.0
« Reply #108 on: June 23, 2012, 10:48:14 am »
With the newst commit I run into the cmake-error (even with the newest 2.8.8 CMake version):

Since I know you understand German, I post the original German output rather as trying to translate it first.
Quote
12>  CMake Error at cmake_install.cmake:57 (FILE):
12>    file Internal CMake error when trying to open file:
12>    D:/Programming/Libraries/Thor/install_manifest.txt for writing.
12> 
12> 
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: Der Befehl "setlocal
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmEnd
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmErrorLevel
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: exit /b %1
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmDone
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" wurde mit dem Code 1 beendet.

Also the feature request for the animation class described here sounds interesting.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #109 on: June 23, 2012, 12:44:08 pm »
It's not useless, it warns you about something that is supposed to be done automatically but which cannot. Therefore the behaviour may not be what you expect, and an explicit handling of assignment might be required.
There is no unexpected behavior. In case the operator= is used, a compile error occurs.

But yes, it's probably the simplest if I just use pointers, although I don't completely like this approach.


With the newst commit I run into the cmake-error (even with the newest 2.8.8 CMake version)
It doesn't sound like a Thor problem. Are you sure you have the rights to write into the mentioned file? Are there error messages preceding the ones you posted (like compile/link errors)?

I just built Thor with CMake for VS 2010 and installed it without problems... What VS version do you use?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11007
    • View Profile
    • development blog
    • Email
Re: Thor 2.0
« Reply #110 on: June 23, 2012, 12:53:48 pm »
It doesn't sound like a Thor problem. Are you sure you have the rights to write into the mentioned file? Are there error messages preceding the ones you posted (like compile/link errors)?

I just built Thor with CMake for VS 2010 and installed it without problems... What VS version do you use?

Nevermind...
It seems like there were some bad temporary files. Just cloned the repository again and rebuild from scratch without problems. Even the compile/linker errors mentioned previously are now gone.

Thanks a lot for your constant work on this awesome library! ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Silvah

  • Guest
Re: Thor 2.0
« Reply #111 on: June 24, 2012, 04:39:58 pm »
I was pretty bored, so I wrote a PKGBUILD for the git version of Thor and uploaded it to AUR. Now all Arch Linux users should be able to install the package globally the proper way, with all its files managed by pacman.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #112 on: June 24, 2012, 05:11:11 pm »
Wow, thanks a lot! I included the link on the Thor download site.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

aNewHobby

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • Live 4 Ever Or Die Trying
Re: Thor 2.0
« Reply #113 on: June 28, 2012, 11:38:03 am »
REQUESTS

I used thor for my last project an thought it was great.. I  pretty much only used the animation class though. Anyway.. from that experience.. I would like to suggest 2 things.

1) aniamtion.getFrameNumber(); ---- It would be cool to be able to test witch frame the animation is on at any give refresh for the window. This could be used for a lot of stuff.. say syncing audio ques for example.

2) When adding a animation you use a std::string as the identity key. Would be great if this could be over loaded to also be able to use simple int. Unless I am misunderstanding things (witch is very possible) it was kind of a pain to build animation assignment code as you couldn't use incrementing loops or anything to call the new animations with out using code to add ints to strings and stuff. While a string name is fine for manually calling .. I think using ints, maybe enums for readability would be a better way to go.

Thanks for all your work on this project.. I'll have to have a closer look at what else is in thor.
Twitter: @Jyinkies
My Own Little Spot on the Net: - Live4everOrDieTrying.info (Blog)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #114 on: June 28, 2012, 07:50:26 pm »
1) aniamtion.getFrameNumber(); ---- It would be cool to be able to test witch frame the animation is on at any give refresh for the window. This could be used for a lot of stuff.. say syncing audio ques for example.
As already mentioned in the other thread, I plan to improve the module to implement such functionality more easily. What this implies concretely -- I don't know yet.

2) When adding a animation you use a std::string as the identity key. Would be great if this could be over loaded to also be able to use simple int.
Are you using Thor 1.1? Because the Thor 2.0 Git version allows you to use any type as identifier (thor::Animator is a class template).
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

aNewHobby

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • Live 4 Ever Or Die Trying
Re: Thor 2.0
« Reply #115 on: June 29, 2012, 04:08:07 am »
1) aniamtion.getFrameNumber(); ---- It would be cool to be able to test witch frame the animation is on at any give refresh for the window. This could be used for a lot of stuff.. say syncing audio ques for example.
As already mentioned in the other thread, I plan to improve the module to implement such functionality more easily. What this implies concretely -- I don't know yet.

Awesome!

2) When adding a animation you use a std::string as the identity key. Would be great if this could be over loaded to also be able to use simple int.
Are you using Thor 1.1? Because the Thor 2.0 Git version allows you to use any type as identifier (thor::Animator is a class template).

Ahh sweet.. yeah I was just going off the demo example, and it used strings.. cool that it can use ints.. I'll prob switch to that for my next one.
Twitter: @Jyinkies
My Own Little Spot on the Net: - Live4everOrDieTrying.info (Blog)

Tresky

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: Thor 2.0
« Reply #116 on: July 09, 2012, 05:43:22 am »
I'm new to Thor and I love what I see so far. I'm trying to wrap my head around the resource manager though. I think I'm beginning to understand how it works, but I have a question.

Would you think it would be better to make a ResourceSystem class with one ResourceCache inside of it to load ALL of the resources throughout the program? Or... Would it be better to have every thing that needs a resource have a ResourceCache and load it's own resources?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #117 on: July 09, 2012, 10:53:09 am »
You have to reflect why you need a resource cache. The main purpose is to delegate lifetime managment and checks for already loaded resources. Having a separate cache everywhere you need resources doesn't make much sense, you could as well load the resources directly.

This doesn't imply that one centralized thor::MultiResourceCache is always the best solution, but it's probably a good one in many cases. If you like a more modular design (e.g. sound and graphics completely uncoupled), specialized thor::ResourceCache<R> instances are more appropriate.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Tresky

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: Thor 2.0
« Reply #118 on: July 09, 2012, 06:57:09 pm »
Oh okay, that makes sense.
Thanks! Have you considered opening a forum for Thor? It would make finding questions that have already been asked sooooo much easier.

EDIT: I have a question about the thor::Action system. I put a thor::ActionMap in a class and I can't get it to work as a pointer.
class MyClass
{
public:
    MyClass(sf::RenderWindow* window) {
        map = new thor::ActionMap<UserActions>(*window); // This work with no error
        map[Action1] = thor::Action(sf::Keyboard::A); // This gives me an error with the operator=.
        // Unmatched types. Is there a workaround?
    }

private:
    thor::ActionMap<UserActions>* map;
};
« Last Edit: July 09, 2012, 07:25:56 pm by Tresky »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #119 on: July 09, 2012, 07:48:08 pm »
Another case where manual memory management is absolutely unnecessary and misleading ;)
Don't use raw new and delete, there are hardly any justified use cases.

Just use automatic objects instead of pointers. And work with the constructor initializer list, it should always be preferred for member initialization. Additionally, your constructor should probably be explicit.
class MyClass
{
public:
    explicit MyClass(sf::RenderWindow* window)
    : map(*window)
    {
        map[Action1] = thor::Action(sf::Keyboard::A);
    }

private:
    thor::ActionMap<UserActions> map;
};

An own forum for Thor is currently out of question, but maybe this will change one day :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything