Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 19 Jul 2011
Offline Last Active Today, 01:28 PM

Posts I've Made

In Topic: Alternatives to global variables / passing down references through deep "...

14 April 2015 - 05:27 AM

I usually have some soft of "core" object which contains the following:


struct Core
  Audio audio; // Handles the sounds
  Shader shader; // Handles the shaders
  Environment environment; // Handles external stuff like paths / filesystem
  Keyboard keyboard; // handles keyboard input etc...
  // Etc..


Then when I add a new node to the scene, I pass a pointer to Core to it but then when I add a new node to that node, the add() function sets the core pointer within the new node to that of the parent node. So in effect, every single object in the game has a pointer to Core. So then I can do this...


void PlayerNode::onUpdate()
  // ...
  if(health <= 0)
  // ...

In Topic: Should i use sdl or some higher level framework?

09 February 2015 - 10:01 AM

but I think I will use some low level tech. I have no deadlines, no long term projects, it's just for fun.

This is a good plan. Don't know if you are looking at working for a company but at work it is more likely we hire a C/C++/SDL developer than someone who has made a Unity game. I am quite sure that most large software houses or studios are similar.

In Topic: Web Games

07 January 2015 - 10:00 AM

I recommend looking into Emscripten. It is basically a C/C++ compiler that outputs to JavaScript using HTML5 canvas or WebGL. It also wraps OpenGL and SDL making your code ultra portable.
We have already used it commercially for our web games at work and it has proven to be a very good solution

In Topic: Best language for mobile apps

24 November 2014 - 03:36 PM

I also recommed C++ because Java, and C# (and to some extent Obj-C) are largely the same once you know them (and if you choose to not take advantage of any of C++'s most powerful features). C++ however is although a second class supported language on most mobile platforms, it is still a "supported" language so you can generally port your game to any platform with maximum code reuse.


Unfortunately since C++ is not a first class supported language for most mobile platforms, the API documentation is often terrible.

In Topic: Why do I need to define methods twice?

31 October 2014 - 02:00 PM

Half a minute is a pretty terrible compile time, honestly. It's damn good for large C++ projects, yes, but that C++ programmers have settled for half a minute being fast is really sad.


Compared to waiting for slow ass Unity to do an iOS or Android build, yeah half a minute is lightning fast! When done correctly, the C++ build system should be incremental so in reality is much faster than 30 seconds during a typical code / test / debug cycle.


As to the OP, a typical C++ header is where you declare the class and functions and the .cpp unit is where you define the implementation. Dont think of this as declaring the functions twice. Instead think of it as separating out the architecture from the implementation. It has worked well like this in the past and will continue to do so well past our lifespans smile.png