Jump to content

  • Log In with Google      Sign In   
  • Create Account

BitMaster

Member Since 08 Aug 2000
Online Last Active Today, 02:48 AM

#5170686 Understanding Qt At a Deeper Level

Posted by BitMaster on 31 July 2014 - 02:51 PM

In general I would advise not to actively use 'signals' or 'slots'. Since they are macros there is a risk for that to collide with third party libraries and to avoid problems here you can switch these macros off by configuring Qt accordingly. Instead, you should use 'Q_SIGNALS' and 'Q_SLOTS' which, while still macros, are not of such a risk of namespace collisions.

 

Also, for the purpose of understanding Qt at a deeper level I would forget about designing using .ui files. They don't allow you to do anything you could not also do by hand but they hide a lot of the details. That's good when you need to get something done quickly, it's bad when you really want to understand what is happening. Try building a few UIs yourself. Create layouts, add child widgets to them and research which signal/slot connections you need to get something done. That will be slow going at first but it will force you to do a lot of research in the documentation. Liberally read that, things linked there, as well as the introduction of Qt concepts.




#5170139 Setting up GLFW in Code::Blocks

Posted by BitMaster on 29 July 2014 - 12:30 PM

You need to link to OpenGL. The exact name will depend on your compiler but trying to add opengl32 will probably not be a bad idea. If you are already doing that, remember that the sequence of linked libraries is important for gcc.




#5169758 Make file unreadable by an external program

Posted by BitMaster on 28 July 2014 - 08:23 AM

I find it highly unlikely that Terraria encrypts its files. According to 30 seconds of Googling, it just appears to be a custom format, most likely to make loading and streaming easier. That's not encryption and any user with a bit of technical background can get access to the data even if the specification is not public for easier modding.

If you want to prevent casual opening/modifications of your resources give them a non-standard extension (like .myimage instead of .png). That should prevent opening them by simple double-click in Windows. Of course even a user with a minimum of technical understanding can still just drag the file into Gimp.
Alternatively just store multiple files inside some archive format. I would advise against encryption. It will most likely cause you more problems getting it right than a skilled user to grab the decryption keys from your own executable.


#5168856 This singleton keeps crashing.

Posted by BitMaster on 24 July 2014 - 06:32 AM

<stdint.h> is part of the C standard library, not the C++ standard library. While most compilers allow you to include their C includes from C++, they are not required to do so (nor do they even have to have C includes somewhere to be standard compliant).


#5166234 (Super) Smart Pointer

Posted by BitMaster on 11 July 2014 - 10:13 AM

shared_ptr doesn't seem to work because that is reference counted.


Or of course simply a weak_ptr.


#5165554 STL Map and SDL2 Texture segfault

Posted by BitMaster on 08 July 2014 - 09:12 AM

If something crashes deep inside the C++ standard library (although a lot of people call it carelessly the 'STL', it is not) you should walk up the stack trace and see what you are doing. Bugs in the standard library happen, but are not common at all. In practically all cases, the error is with you.

You posted a bit limited code (and no one knows how it looks now anyway), so here are two hints:
- if you add pointers to any local objects, you very likely should not do that
- if you add objects to the map, you need to make sure they respect the Rule of Three


#5165483 raw binary to obj conversion

Posted by BitMaster on 08 July 2014 - 02:19 AM

Have you evaluated GNU's Binary File Descriptor library referenced in the Wikipedia article?


#5165466 STL Map and SDL2 Texture segfault

Posted by BitMaster on 08 July 2014 - 12:27 AM

Run it through a debugger and observe the lines it is crashing on and check the state of everything when that happens. If you don't know how your debugger works yet, now is a perfect time to learn. A simple, reliably to reproduce crash is the textbook example for it.

That said, have you dealt with what rip-off said in post #4?


#5165342 STL Map and SDL2 Texture segfault

Posted by BitMaster on 07 July 2014 - 02:08 PM

In general I found the C++11 Wikipedia article to be a helpful overview, combined with cppreference.com for more details.




#5165039 STL Map and SDL2 Texture segfault

Posted by BitMaster on 06 July 2014 - 07:55 AM

textureLibrary[filename.c_str()] = newTexture;


That does not look healthy at all. Whatever filename.c_str() returns is only guaranteed to live during that statement. The map should be of type std::map<std::string, whatever> and then you should not call std::string::c_str() here.


#5163772 sse-alignment troubles

Posted by BitMaster on 30 June 2014 - 01:17 AM

Don't get me wrong I'm not defending/offending him, I just try to exchange useful information with all of you.
I think that if you put a downvote on someones post, you MUST tell him why he is wrong, at the end of the date we are programmers we use facts.

In an ideal world, yes. In practice, you need to check fir's history. The surprising thing is not he is getting downvoted without further comment, the surprising thing is there are people left who are actually willing to engage with him in something resembling a constructive way. Whatever else he is, he is very good at burning bridges for absolutely no reason at all.


#5162967 Legal stuff when using free art / models in an own game

Posted by BitMaster on 26 June 2014 - 02:48 AM

No, you did not find out how it was resolved. The key part is "did not disclose terms of the settlement". For all you know NCSoft needed to pay millions of dollars to "proceed unhindered".


#5162720 TILED/LUA - Integration with C

Posted by BitMaster on 25 June 2014 - 12:41 AM

That appears to be a simple Lua table definition.


#5162716 Is this multiplication formula in linear algebra true?

Posted by BitMaster on 25 June 2014 - 12:12 AM

But that is not possible since xT=!=x. What I find strange though (for example, dot product of x and xT is defined, thus their subtraction is defined, but thus subtraction of x and xT can never be a zero vector)

First, you cannot have a dot product of \(x\) and \(x^T\) (unless \(x \in \mathbb R\)). The dot product is for two column vectors \(u, v\) is commonly defined as \(dot(u, v) := u^T \cdot v\). Trying \(dot(x^T, x)\) would once again be impossible because you would have to multiply an element of \(\mathbb R^{n \times 1}\) with and element of \(\mathbb R^{n \times 1}\) which is not defined for \(n \neq 1\).
 

To every vector (matrix) exists addition neutral vector (matrix) Z
To every vector (matrix) exists multiplication neutral vector (matrix) I such that V*I=V
To every vector (matrix) exists multiplication inverse vector J (matrix) such that V*J=I

You are thinking of the ring axioms but that applies only to square matrices. You cannot even multiply general vectors together like that (as already said above), so talking about multiplicative neutral and multiplicative inverse elements for vectors does not make any sense.
In some fields (like GLSL) it can be convenient to define a component-wise vector multiplication. However, that is something completely orthogonal to standard linear algebra. The presence of this extra operator does not change anything about the theory of matrices nor does it negate associativity of matrix multiplication.

I can only reinforce Álvaro's suggestion to "go learn some math", ideally under supervision. You apparently heard of several concepts but you are lacking the attention to detail and strictness required in the field.

Álvaro: I often smell troll on these forums but with him I'm more inclined to believe he actually believes what he is saying.


#5162630 Is this multiplication formula in linear algebra true?

Posted by BitMaster on 24 June 2014 - 02:16 PM

Well, that was my argument to him in the original thread, but as he says now

I would cite now "but then you would have to test a row and column vector for equality, which just does not work.". I am comparing vectors of the same majoring (dimensions).

which has me a bit at a loss for words.






PARTNERS