These are chat archives for mosra/magnum

6th
Jul 2019
trashuj
@trashuj
Jul 06 09:26
:s
hey what's the best way to display a square around my 2d elements? 4 lines?
to "highlight" them
Vladimír Vondruš
@mosra
Jul 06 09:37
.... yes, I guess
if it would be a square textured sprite you could shrink the texture coordinates a bit (and enlarge the sprite) and then use border color which unfortunately isn't available anywhere else than on desktop to draw a ........... yes, lines are the easiest probably :D
trashuj
@trashuj
Jul 06 09:58
thanks :)
Vladimír Vondruš
@mosra
Jul 06 10:31
Guillaume Jacquemin
@williamjcm
Jul 06 11:42
I haven't been able to test it yet (refactoring is still in progress, and I want to get it done ASAP). :/
Found a typo in the docs, BTW: "UTF-8 console otuput encoding" (emphasis mine)
Guillaume Jacquemin
@williamjcm
Jul 06 12:01
Anyway, I seem to have found an issue with Interconnect. Calling a signal that takes a const Base& when Base has a deleted copy assignment/constructor results in a build error.
auto EvtDebugFrame::spriteChangeCallback(const Pose& pose) -> Signal {
    return emit(&EvtDebugFrame::spriteChangeCallback, pose);
}
../../src/DebugFrame/EvtDebugFrame.cpp: In member function 'Corrade::Interconnect::Emitter::Signal EvtDebugFrame::spriteChangeCallback(const Pose&)':
../../src/DebugFrame/EvtDebugFrame.cpp:16:59: error: use of deleted function 'Pose::Pose(const Pose&)'
   16 |     return emit(&EvtDebugFrame::spriteChangeCallback, pose);
      |                                                           ^
In file included from ../../src/DebugFrame/EvtDebugFrame.h:7,
                 from ../../src/DebugFrame/EvtDebugFrame.cpp:1:
../../src/DebugFrame/../Pose/Pose.h:71:5: note: declared here
   71 |     Pose(const Pose&) = delete;
      |     ^~~~
In file included from ../../src/DebugFrame/EvtDebugFrame.h:5,
                 from ../../src/DebugFrame/EvtDebugFrame.cpp:1:
../../corrade/src/Corrade/Interconnect/Emitter.h:581:144: note:   initializing argument 2 of 'Corrade::Interconnect::Emitter::Signal Corrade::Interconnect::Emitter::emit(Corrade::Interconnect::Emitter::Signal (Emitter::*)(Args ...), typename std::common_type<Args>::type ...) [with Emitter = EvtDebugFrame; Args = {const Pose&}]'
  581 | template<class Emitter_, class ...Args> Emitter::Signal Emitter::emit(Signal(Emitter_::*signal)(Args...), typename std::common_type<Args>::type... args) {
      |                                                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Vladimír Vondruš
@mosra
Jul 06 13:07
@williamjcm thanks for the typo! ... the Interconnect bug, is that a regression (happening since the rework I did a week ago) or not related to that?
Guillaume Jacquemin
@williamjcm
Jul 06 13:16
Let me check.
Well, I started the refactor yesterday, so I have no way to check if it's a regression.
I used "stringly-typed" code before the refactor.
I'm currently using Corrade from this commit, if it's any help: mosra/corrade@372c9df
Guillaume Jacquemin
@williamjcm
Jul 06 13:25

According to someone on Discord, it's an issue with std::common_type:

std::common_type is broken basically
they'll need to use a custom common_type like trait that doesn't do the silly thing of applying std::decay on the result

Vladimír Vondruš
@mosra
Jul 06 14:54
ah
i use it just to avoid conflicting template deductions so i could replace that with anything else
@williamjcm can you try this?
diff --git a/src/Corrade/Interconnect/Emitter.h b/src/Corrade/Interconnect/Emitter.h
index ca663edc..29d80f64 100644
--- a/src/Corrade/Interconnect/Emitter.h
+++ b/src/Corrade/Interconnect/Emitter.h
@@ -42,6 +42,13 @@ namespace Corrade { namespace Interconnect {

 namespace Implementation {

+/* Previously I used std::common_type<T>::type, but that decays inside so
+   references are lost. OTOH std::type_identity is only C++20, so making my own
+   thing here. */
+template<class T> struct Identity {
+    typedef T Type;
+};
+
 struct SignalDataHash {
     std::size_t operator()(const SignalData& data) const {
         std::size_t hash = 0;
@@ -460,7 +467,7 @@ class CORRADE_INTERCONNECT_EXPORT Emitter {
          * See @ref Interconnect-Emitter-signals "class documentation" for more
          * information about implementing signals.
          */
-        template<class Emitter, class ...Args> Signal emit(Signal(Emitter::*signal)(Args...), typename std::common_type<Args>::type... args);
+        template<class Emitter, class ...Args> Signal emit(Signal(Emitter::*signal)(Args...), typename Implementation::Identity<Args>::Type... args);

     private:
         /* https://bugzilla.gnome.org/show_bug.cgi?id=776986. Also the class
@@ -578,7 +585,7 @@ for more information about connections.
 CORRADE_INTERCONNECT_EXPORT bool disconnect(Emitter& emitter, const Connection& connection);

 #ifndef DOXYGEN_GENERATING_OUTPUT
-template<class Emitter_, class ...Args> Emitter::Signal Emitter::emit(Signal(Emitter_::*signal)(Args...), typename std::common_type<Args>::type... args) {
+template<class Emitter_, class ...Args> Emitter::Signal Emitter::emit(Signal(Emitter_::*signal)(Args...), typename Implementation::Identity<Args>::Type... args) {
     _connectionsChanged = false;
     ++_lastHandledSignal;
     auto range = _connections.equal_range(
Guillaume Jacquemin
@williamjcm
Jul 06 15:13
I'll try that ASAP.
Guillaume Jacquemin
@williamjcm
Jul 06 15:23
Thanks, it worked!
(The slot that processes the Pose didn't, though. I blame my untested implementation.)
Guillaume Jacquemin
@williamjcm
Jul 06 16:26
(And it wasn't the implementation. I didn't update how my texture loader searches for files.)
Vladimír Vondruš
@mosra
Jul 06 16:28
argh ok i guess i'll need to create a repro case
Vladimír Vondruš
@mosra
Jul 06 16:34
ummm here it worked
then I probably misunderstood what you said :D
Guillaume Jacquemin
@williamjcm
Jul 06 16:34
Maybe.
Vladimír Vondruš
@mosra
Jul 06 16:35
to be clear: it works for you, right? :D
Guillaume Jacquemin
@williamjcm
Jul 06 16:35
Yeah. It works now.
Vladimír Vondruš
@mosra
Jul 06 17:09

https://ci.appveyor.com/project/mosra/magnum-plugins/build/next-877/job/4lnv33wl970tjwxu

The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".

RIGHT CLICK YOU SAY

Guillaume Jacquemin
@williamjcm
Jul 06 17:10
Wow.
Vladimír Vondruš
@mosra
Jul 06 17:11
is it just me or is somebody actually enjoying developing anything on windows? i hate this shit
Guillaume Jacquemin
@williamjcm
Jul 06 17:11
Well, when you start using the same tools as on Linux, it starts getting tolerable.
Vladimír Vondruš
@mosra
Jul 06 17:11
i remember there was some powershell magic that threw a regexp search&replace on that damn vs solution xml and made it work
Vladimír Vondruš
@mosra
Jul 06 17:18
aaaaaaaaaaargh
i'm going to give up on that