Jump to content

Dave Hunt

Member Since 30 Dec 2002
Offline Last Active Feb 07 2017 07:35 PM

#5271784 Vertex Dynamic Memory (malloc and free)

Posted by Dave Hunt on 18 January 2016 - 09:28 PM

I was referring to the "..." in the fread call as well.


However, in your struct you declared cName as an array of 32 characters, then you likely attempted to set cName[32] to '\0'. Valid indices are 0-31. 32 is right out. It worked in your malloc version because you malloced 33 characters.

#5266322 Having a problem to get values from different methods which contain different...

Posted by Dave Hunt on 14 December 2015 - 01:11 PM

You're going to have to show more of your actual code. Also, when reporting error messages, replacing parts with "blabla" doesn't help us help you. Those "blabla" bits are important.

#5266208 Unity Vs Unreal

Posted by Dave Hunt on 14 December 2015 - 12:00 AM

If you use Unreal, Epic Games takes 25% of your revenue, after Steam or Apple,

That changed some time ago. It's now 5% of your gross revenue.

#5266175 [Help] How to create a game like original gangstaz

Posted by Dave Hunt on 13 December 2015 - 07:24 PM

Welcome, Peke.


Your English is fine. Your question, however, is far too vague.


You'll need to be a lot more specific for us to give you any meaningful help. Just asking how to create a game like [fill in game here], could result in answers like:


1. Write the code.

2. Create the art and audio assets.

3. Done.


What specifically do you need help with? What language(s) are you comfortable with? What kind of programming have you already done?


Help us to help you.

#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