It's a matter of aesthetics. The code is also more readable, which can save you some time when debugging - that's what typedef was made for.In either case, I think that "typdefing a pointer to save a few keystrokes" is fundamentally wrong. Unless you have really good architectural reasons for doing that, you should find a better text editor that can automate those "too long to type" situations.
- Viewing Profile: Posts: Vodahmin
Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics
Community Stats
- Group Members
- Active Posts 30
- Profile Views 831
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Male
233
Good
User Tools
Contacts
Vodahmin hasn't added any contacts yet.
Latest Visitors
Posts I've Made
In Topic: Game Engine from scratch using C++ and python - Where do I start?
07 October 2012 - 05:41 AM
In Topic: Game Engine from scratch using C++ and python - Where do I start?
07 October 2012 - 02:21 AM
I think it's only a matter of getting used to it. There is no apparent reason for typedefing SDL_Surface* but if your pointer declaration looks like "shared_ptr<SDL_Surface>" or something longer, then it can be a bit frustrating to rewrite it every time, so why not just typedefing it to "SDL_Surface"? Then, as a matter of good practice, you can add a "p" before the pointer declaration (for example "pSurface"), so there is really little room for mistake.
Actually, typedef'ing pointers is common in game industry, smart pointers that is.
I would still argue against it: It's something that carries certain benefits, I'm sure, but it makes code more difficult to read, because now I have to look for what opaqueDataType actually represents.
If I just have SDL_Surface*, it's immediately clear.
In Topic: Organizing Assets
06 October 2012 - 12:01 PM
I think the more efficient approach would be to create a global package for all common assets (such as UI, background music, common texture/models etc.) and then unique packages for each level (such as cinematics and level-related actors, textures and sounds). The level-related packages could also contain AI scripts and level-related configs.
If you're planning to make your own memory-pool, you'll find this design to be quite straight-forward. After each level, you unload the entire package and load a new one, while still keeping all the common files in the memory.
If you're planning to make your own memory-pool, you'll find this design to be quite straight-forward. After each level, you unload the entire package and load a new one, while still keeping all the common files in the memory.
In Topic: Programming Tutorial
06 October 2012 - 11:36 AM
If you haven't decided on the languages yet. I'd also recommend Python and C# for the starters. If you're planning to take a university course in the near future, you may expect that they will teach you Java (hopefully - some schools start from C - which is a great language but not the easiest to master).
As for the complete guide for beginners, I'd highly recommend this book. I used it myself to learn Python and I must say, that the book is well organized and straight to the point.
As for the complete guide for beginners, I'd highly recommend this book. I used it myself to learn Python and I must say, that the book is well organized and straight to the point.
In Topic: Game Engine from scratch using C++ and python - Where do I start?
06 October 2012 - 01:00 AM
Actually, typedef'ing pointers is common in game industry, smart pointers that is.By the way: You should never, ever typedef a pointer. That's an unnecessary level of indirection, and it's something that has no place in your example, because you're not even using it anywhere.
- Home
- » Viewing Profile: Posts: Vodahmin

Find content