dgcor / DGEngine

An implementation of the Diablo 1 game engine
Other
252 stars 29 forks source link

setColor and getColor deprecated in SFML version 2.4.0 #6

Closed mewmew closed 8 years ago

mewmew commented 8 years ago

From http://www.sfml-dev.org/documentation/2.4.0/deprecated.php

Member sf::Text::getColor () const

There is now fill and outline colors instead of a single global color. Use getFillColor() or getOutlineColor() instead.

Member sf::Text::setColor (const Color &color)

There is now fill and outline colors instead of a single global color. Use setFillColor() or setOutlineColor() instead.

Warnings from compiling rev 40afab360a26f087b2b3e72b8c8f1794e5cb50c2.

In file included from /home/u/Desktop/DGEngine/src/StringText.cpp:1:0:
/home/u/Desktop/DGEngine/src/StringText.h: In member function ‘virtual void StringText::setColor(const sf::Color&)’:
/home/u/Desktop/DGEngine/src/StringText.h:43:69: warning: ‘void sf::Text::setColor(const sf::Color&)’ is deprecated [-Wdeprecated-declarations]
  virtual void setColor(const sf::Color& color) { text.setColor(color); }
                                                                     ^
In file included from /usr/include/SFML/Graphics.hpp:51:0,
                 from /home/u/Desktop/DGEngine/src/StringText.h:3,
                 from /home/u/Desktop/DGEngine/src/StringText.cpp:1:
/usr/include/SFML/Graphics/Text.hpp:177:26: note: declared here
     SFML_DEPRECATED void setColor(const Color& color);
                          ^~~~~~~~
In file included from /home/u/Desktop/DGEngine/src/StringText.cpp:1:0:
/home/u/Desktop/DGEngine/src/StringText.h: In member function ‘const sf::Color& StringText::getColor() const’:
/home/u/Desktop/DGEngine/src/StringText.h:49:59: warning: ‘const sf::Color& sf::Text::getColor() const’ is deprecated [-Wdeprecated-declarations]
  const sf::Color& getColor() const { return text.getColor(); }
                                                           ^
In file included from /usr/include/SFML/Graphics.hpp:51:0,
                 from /home/u/Desktop/DGEngine/src/StringText.h:3,
                 from /home/u/Desktop/DGEngine/src/StringText.cpp:1:
/usr/include/SFML/Graphics/Text.hpp:285:34: note: declared here
     SFML_DEPRECATED const Color& getColor() const;
                                  ^~~~~~~~

List of files using getColor and/or setColor:

ghost commented 8 years ago

This won't be changed in the near future, as these new APIs were just added to SFML 2.4 (released a few days ago) and most Linux distributions bundle older versions.

mewmew commented 8 years ago

This won't be changed in the near future, as these new APIs were just added to SFML 2.4 (released a few days ago) and most Linux distributions bundle older versions.

Ah, I see. Running Arch Linux, so always bleeding on the edge :) Would you like to close this issue or keep it open until it becomes relevant?

ghost commented 8 years ago

It doesn't matter to me. I'll probably only change it after many months from now. If i change it now it will break versions that use 2.33 or earlier and I don't want to add conditional code just yet (until I test that the behaviour is the same).

mewmew commented 8 years ago

It doesn't matter to me. I'll probably only change it after many months from now. If i change it now it will break versions that use 2.33 or earlier and I don't want to add conditional code just yet (until I test that the behaviour is the same).

Ok, makes sense. I'll close this issue for now as it is not relevent for the time being.

ghost commented 7 years ago

In the last commit (59f7c0c), the minimum SFML version got updated to 2.4.0, so you no longer get this warning.

mewmew commented 7 years ago

In the last commit (59f7c0c), the minimum SFML version got updated to 2.4.0, so you no longer get this warning.

These warnings are now gone, and replaced with a couple of new ones.

[ 90%] Building CXX object CMakeFiles/DGEngine.dir/src/sfeMovie/AudioStream.cpp.o
/home/u/Desktop/diablo/DGEngine/src/sfeMovie/AudioStream.cpp: In member function ‘bool sfe::AudioStream::decodePacket(AVPacket*, AVFrame*, bool&)’:
/home/u/Desktop/diablo/DGEngine/src/sfeMovie/AudioStream.cpp:304:94: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
         int decodedLength = avcodec_decode_audio4(m_codecCtx, outputFrame, &igotFrame, packet);
                                                                                              ^
In file included from /usr/include/libavformat/avformat.h:319:0,
                 from /home/u/Desktop/diablo/DGEngine/src/sfeMovie/AudioStream.cpp:27:
/usr/include/libavcodec/avcodec.h:4852:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^~~~~~~~~~~~~~~~~~~~~
[ 99%] Building CXX object CMakeFiles/DGEngine.dir/src/sfeMovie/VideoStream.cpp.o
/home/u/Desktop/diablo/DGEngine/src/sfeMovie/VideoStream.cpp: In member function ‘bool sfe::VideoStream::decodePacket(AVPacket*, AVFrame*, bool&, bool&)’:
/home/u/Desktop/diablo/DGEngine/src/sfeMovie/VideoStream.cpp:261:95: warning: ‘int avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
         int decodedLength = avcodec_decode_video2(m_codecCtx, outputFrame, &gotPicture, packet);
                                                                                               ^
In file included from /usr/include/libavformat/avformat.h:319:0,
                 from /home/u/Desktop/diablo/DGEngine/src/sfeMovie/VideoStream.cpp:27:
/usr/include/libavcodec/avcodec.h:4901:5: note: declared here
 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
     ^~~~~~~~~~~~~~~~~~~~~

Using SFML 2.4.2 and FFMPEG 1:3.3.2.

ghost commented 7 years ago

Yes, sfeMovie uses FFMpeg 2.8. These weren't as simple as the others (where you just used a different function - FFMpeg2/FFMpeg3), so I left them as they are as they still work. Changing these involves changing the surrounding code. Probably only when FFMpeg finally removes them will I update these.

Edit: FFMpeg3 warnings fixed in 38e2a3b