Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

199 Neutral

About sphen_lee

  • Rank
  1. sphen_lee

    [Java] Cannot find symbol.

    Your GuiCore2 class should implement Runnable - Thread's constructor takes an instance of Runnable as its first argument. Runnable declares the "public void run" method which you have already implemented.
  2. sphen_lee

    Game Engine - How does it work?

    Quote:Original post by FaiMK yes; personally i feel that i need to make the "engine" first. idk why, but thats what my mind is set on, and making one will give me a feeling of acomplishment in general game development No it won't - unless you write a game using your engine you won't have achieved anything. As everyone has been saying, you need to write a game first. When you write your second game you can reuse bits from the first game (refactor) and eventually these bits will become an engine.
  3. sphen_lee

    How to store game information?

    Have you considered using a package file such as zip? This means you can put everything in a single huge file, but still treat it internally as lots of small files.
  4. The destructor for Mystic deletes m_pLevel, but so does the destructor Combatant, this causes a double delete. Since Mystic inherits Combatant the compiler automatically knows to call Combatant's destructor after calling Mystic's destructor. I think the reason using new fixed this is that you never deleted the object so it was never destructed. There may be other problems, but this was the most obvious one. Several general hints too (please don't take offence, i'm trying to help you write better code): * Use std::string. It's a lot simpler than using char* and a lot safer. * I'm not sure if you added those comments just for posting here, but they really are unnecessary. It is obvious from the method name GetName what the method will do. You only need a comment if what the method does is not obvious. * Also consider using std::vector instead of your array of Effects
  5. sphen_lee

    [resolved] return values of a function

    You may want to do some research into the "rule of three". Understanding this rule will help explain what is happening in your code. The C++ FAQ Lite is also a good source of information.
  6. It sounds as if you are using the Win32 GUI system where an & tells Windows that the next letter should be used as a hot key (hence the underline). Using && suppresses this and gives you a normal &.
  7. sphen_lee

    [SDL] Creating a child window...

    The simple answer is no. SDL does not provide a GUI system. You can however create a window by placing the content of the window into a surface, and then blitting it to the screen (with some kind of border), which is what net-ninja was saying. It would be easier to just use a GUI toolkit that integrates with SDL (I know of GuiChan, but google will find more).
  8. sphen_lee

    Version control and modules

    If you are concerned about the ease of merging, perhaps you should try a version control system like Mercurial, Bazzar or Monotone that can automatically keep track of merges. This way you don't need to worry about branching the entire project. Personally I use Mercurial and find it very powerful.
  9. sphen_lee

    std namespace not found.

    These are the C versions of the standard library, you should use the Cpp versions instead like this: #include <cstdio> #include <tchar.h> // not sure if there is a Cpp version of this header #include <cstdlib> #include <cstring>
  10. sphen_lee

    [java] SwingUtilities.invokeLater

    The Swing Library is not thread safe, which means that only one thread may create or modify swing objects. This is the AWT Event thread. Whenever Swing calls a listener method, it is executed on the AWT Event thread, so you may modify Swing objects here. InvokeLater causes Swing to run a given runnable when it can on the AWT Event thread. You should use invokeLater any time you want to modify a Swing object outside of a listener method.
  11. sphen_lee

    is this right?

    It depends on what you mean by 'right'. The syntax is right, and c_str does return char*, however what do you want to do with charStr?
  12. sphen_lee

    Operator Overloading

    No, these are typecast operators. Since the return value of a typecast must be the type you are casting to, there is no need to specify the return type separately. "Interface& operator*()" is called for "*anObject", while "operator Interface&()" is called for "(Interface&)anObject". You can also do this with primitives: "operator int()", will be called for "(int)anObject".
  13. I user mercurial for personal projects, I switched from SVN when I found myself doing large changes all in a single commit just to avoid merging. Mercurial make merging so much easier. At work we use aegis. Although it enforces code reviews and regression testing, as a revision control system it is very lacking. I don't recommend aegis for any project.
  14. Quote:Thus "this" becomes invalid. Not just its value, but the expression itself, the whole concept. I disagree... The standard doesn't say that. Whether 'this' is invalid or not is undefined. I know that I'm splitting hairs over the difference between 'undefined' and 'invalid', but when referring to standards it's very important to know the difference. However I agree that you shouldn't do anything involving 'this' after you delete it, as it is undefined behaviour (but not invalid :P ).
  15. Quote:Original post by janta Imagine for instance an implementation of C++ which, whenever an object of N bytes is instanciated, allocates N+4 bytes of memory, and stores the address of the object in the extra 4 bytes, to be used as the value of 'this' in all member function of that object. struct Foo { void funct() { delete this; assert(this != 0); } }; While that code is going to be ok because on most implementations of c++ 'this' is nothing but a stack variable which will live until the function returns, if the implementation is such as what I described, then 'assert(this != 0)' is dereferencing a freed pointer and results in undefined behaviour. But if 'this' were stored in the memory pointed to by 'this' how would the compiler access it? 'this' cannot be be stored in allocated memory, because you would then need a pointer to be able to find 'this'. After you delete 'this' it cannot go out of scope, because it must remain in scope for the duration of the method call, just like any other parameter, however its value is now an invalid pointer. Only dereferencing it (or actions that are equivalent: accessing a member variable, calling a virtual function to name a few) are undefined.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!