# Game Engine from scratch using C++ and python - Where do I start?

This topic is 1931 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

To end my misfortunate and bad example code of a game engine, I'll go back and edit to better suit a problem.

As for type defining an SDL_Surface *, I always do it because it's easier and faster to write out LOAD SDL_LoadBMP("image.bmp") than it is to write SDL_Surface* LOAD = SDL_LoadBMP("image.bmp").

I would hope others see the time-saving benefits of using a typedef at times, aside from other use.

Now I'll go and fix what I poorly wrote out.

Your comparison is flawed. It should be:

 SDL_Surface* image = ... // vs LOAD image = ... 

It's a virtually inconsequential difference, in terms of length. But even if it wasn't, SDL_Surface* is far more descriptive, and should therefore be preferred.

Anyway, I wouldn't recommend changing your previous posts; they're supposed to serve as examples of what others are not supposed to do, so just leave them as they are. If you want to show some more code for us to review, make a new post/thread, and we can take it from there.

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"?

I would ask if a shared_ptr is truly necessary? Maybe that part of the system could be written in a higher-level language (one that comes with a GC).

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.

##### Share on other sites

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.

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.

##### Share on other sites
It's like using in C++.

After a while, when using the STD library in C++, beginners will probably learn this:

cout << "Hello world!" instead of std::cout << "Hello world!" .

It is less typing.

##### Share on other sites
Ugh. The amount of time spent typing in a program is less than 1% of a product's cost. Don't risk the incredible added cost of debugging or patching code errors caused by useless typedef garbage that saved you a few seconds.