Jump to content

  • Log In with Google      Sign In   
  • Create Account


Holland

Member Since 27 Jan 2008
Offline Last Active Jun 14 2012 12:07 AM

Posts I've Made

In Topic: Singleton pattern abuse

13 June 2012 - 08:49 PM

I use singletons in my game. Not many, but I use them. DebugLogger is a singleton class I have. Every method is protected against multiple threads, and it CAN slow down my performance. Haven't seen it yet, but I know the chance is there. This is only available in debug and debug/release builds of the game. In release, it's not active and doesn't do anything.

It's scenarios like this (and I honestly can't think of another scenario) that are okay to be a singleton. EVERYTHING will need to log something, and you don't want to pass around a pointer/reference to the logger to everything.

Now, what I do with things I know I only need 1 of, but I don't want to make a singleton?

They get held on to by some other object. My RenderSystem class (hands loading and storing textures, animations, models, etc.) is what holds on to the Renderer class. Renderer is something I should only have 1 of...
[source lang="cpp"]public abstract class AllocateOne{ private static int mAllocations = 0; public AllocateOne() { if (++mAllocations > 1) { // assert, exception, log, something to let you know... } } public ~AllocateOne() { --mAllocations; }}[/source]
I use something like this, and inherit whatever class from it. And, again, I'd only do something like this in debug or debug/release....the final build of your game shouldn't need this type of protection because it should just work. Posted Image

In Topic: Objective C book

21 July 2011 - 06:20 PM

Awesome...thanks. I've also heard of others referring to this book so it seems to have a reputation of sorts.


Looking for recommendations on books (physical, actual books...not web sites please) that are based around Objective C programming for the already experience C/C++/C# programmer. All of the books I've found on Amazon are for people who have never programmed before. I have programmed for a number of years, in the gaming industry. I just want a nice book to use as reference and to get me started with Objective C goodness.

Any suggestions?

Thanks!


You are going to need a bit more then a reference. Objective-C is a few worlds apart from the other languages you know because it revolves around Apples Cocoa framework which is what actually makes objective-c useful. I would recommend the Hillegass book from this link. http://www.amazon.co...d/dp/0321503619. This is not what I would consider a noob book it is organized in such a way that you can skip or just quick review certain earlier sections. For instance you can skip or skim the first section on pure C and move right to the objective C portion and then right into the Cocoa portion. This is the best book on the market by far and Objective-C/Cocoa are so wacked that this book will make sense of it.


In Topic: book for experience programmer getting into stackless python

28 February 2011 - 07:09 PM

I doubt you'll find one. The principles and concepts of stackless are fairly simple, and the rest is really just getting a handle on python. Of which there are several free e-books if I recall correctly. Other than that, reading the newsgroup/discussion groups for stackless and following the examples is the best way to get a handle on it.


Hmm..I guess I'll just grab a couple books on Python in general then. Like I said before, I'm pretty old school when it comes to reference material. I'd prefer actual books over ebooks or online resources.

Thanks!

In Topic: book for experience programmer getting into stackless python

16 February 2011 - 12:00 AM

Thanks blewisjr. I know stackless is just a subset of Python. I don't need a book specifically about stackless python, but a good book for advanced programmers that covers stackless to some extent would be great.

In Topic: Game Dev for Android

23 June 2010 - 06:31 AM

http://lmgtfy.com/?q=free+textures

PARTNERS