Jump to content

  • Log In with Google      Sign In   
  • Create Account

Dave Hunt

Member Since 30 Dec 2002
Offline Last Active Today, 11:59 AM

#5262965 LibGDX - Rotating sprites from their corners.

Posted by Dave Hunt on 20 November 2015 - 09:35 PM

The origin is relative to the sprite's upper-left corner. So, if you want rotations around the upper-left corner, the origin should be 0,0. If you want rotations around the sprite's center, you would use width/2,height/2 (or use setOriginCenter). Note that the origin is also used as an offset to the sprite's position. Essentially, the origin is subtracted from the position when drawing.

#5258160 Does calling ~myclass() (destructor) deletes the object?

Posted by Dave Hunt on 20 October 2015 - 12:13 PM


You should never call the destructor directly. Always use delete.


That's not true enough to say never do this, always do that. There are exceptions, though those exceptions are rare.


Some examples are using placement new (for e.g. low-level memory management, or perhaps to represent a memory-mapped I/O device), or with C++11's generalized unions (members with ctors/dtors are newly allowed -- you must deconstruct the active member before switching to another).


It would be fair enough, however, to say its almost certainly the wrong thing to do unless you know for certain its exactly the right thing to do. 


Yes, it was an over-generalization. I should have been more specific.

#5257952 Does calling ~myclass() (destructor) deletes the object?

Posted by Dave Hunt on 19 October 2015 - 01:38 PM

You should never call the destructor directly. Always use delete.

#5257040 App Store Review Guideline 11.9

Posted by Dave Hunt on 13 October 2015 - 07:58 AM

You can sell items for a limited time. That paragraph refers to core content such as game levels. For example, you can't sell the game with 10 levels and have any of them expire after a limited time.

#5252968 The application requested an operation that depends on an SDK component that...

Posted by Dave Hunt on 18 September 2015 - 06:53 PM

Interesting, as the DeviceCreationFlags.Debug flag works fine for me on Windows 10...


That would probably be because you have the SDK installed.

#5250160 What is latest version of DXSDK

Posted by Dave Hunt on 01 September 2015 - 01:27 PM

For further info, see Where is the DirectX SDK?

#5249647 [Java] Server is only receiving one movement packet

Posted by Dave Hunt on 29 August 2015 - 11:11 PM

Unless the client opens a new connection every tick (a very bad idea) you're going to sit in that while loop until the client exits. You may need to rethink your design.

#5249264 How is this python statement suppose to be friendly? (3.4 ver)

Posted by Dave Hunt on 27 August 2015 - 09:03 PM

The '^' means "begins-with". The square brackets form a "closure" that means "any of". The '*' means zero or more occurrences of the previous pattern. So, all together, it means "match anything that begins with any character in the brackets followed by any number of occurrences of what's in the brackets".


It's called a "regular expression". Put that term in google and you will learn more than you ever want to know.

#5248115 RPG, Engines and Frustration

Posted by Dave Hunt on 21 August 2015 - 01:56 PM

Tetris wasn't made by one guy.

Actually, it was.

#5244693 Clone functions

Posted by Dave Hunt on 05 August 2015 - 11:33 AM

Yes it's part of a factory but for the property system the clone function is also used when undo command need to store a copy to redo the command.

This is where all start about the question, sometime only a simple instance is needed and sometimes a full copy.

To be coherent all clone function should do the same thing full or just instance.

But sometimes, the full copy is not needed.


If all you need is a new, empty/default instance, then use the constructor or factory. If you need a copy, then use Clone (or a copy constructor).


Calling a method that does nothing but create a default instance "Clone" is very misleading.

#5244520 Including headers from Windows 10 SDK

Posted by Dave Hunt on 04 August 2015 - 11:30 AM

Sometimes installers don't do everything their supposed to do. It's best to check and make sure.


You say "IntelliSense doesn't detect that." Does it compile?


edit - ninja'd

#5244500 Including headers from Windows 10 SDK

Posted by Dave Hunt on 04 August 2015 - 09:10 AM

Check your project options and make sure that the Windows 10 SDK directories are listed in the include/lib paths.

#5240682 Help with C# XNA/Monogame

Posted by Dave Hunt on 15 July 2015 - 10:28 PM

Instead of ElapsedGameTime, use TotalGameTime. TotalGameTime is the time since the game started rather than the frame elapsed time.

#5240511 Help me to clear up my confusion about OpenGL

Posted by Dave Hunt on 15 July 2015 - 10:06 AM

I would love to learn graphics programming but I do not want it to be DirectX

Why is this? I don't ask to open up a flame war, but out of interest in your reasoning. If your goal is as broad as learning rendering, shaders and meshes, it would be unwise to eliminate a well-documented technology with plenty of available tutorials and samples without serious consideration.

#5240109 "Mode7" perspective projection "arch"

Posted by Dave Hunt on 13 July 2015 - 01:07 PM

Have you looked at the various "Map Projections"? - https://en.wikipedia.org/wiki/Map_projection


It looks like one of the equal-area projections might be what you're looking for.