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!

Some design issues.

  • You cannot reply to this topic
1 reply to this topic

#1 Azzazelus   Members   -  Reputation: 253


Posted Today, 04:14 AM

Hello. I'm trying to make a game in DirectX 11 and I managed to implement a interface system with text and gui. It works fine just that when I take things further and try to make a window, a console system or everything more complicated I make other classes that use the first gui classes that use another classes and functions and so on. I made a resource manager that handles raw data and creates DirectX resources and returns a pointer. I made a Effect class that has all the shaders. The gui uses pointer to resources manager and effect manager and internally creates resources and draws and the gui uses the pointers to font system to draw text and move it accordingly to its position and so on.

So if I want to create a more complicate system of any kind I have to pass pointers like crazy. Pass resource manager/font system/guy system/effects pointer to the Console class, the console class passes those pointers to gui system, the gui system those pointers to text system to create resources/draw etc.

Except the render part where I should optimize later by making a render manager is this a good practice ? I dont mind this system but I dont want to end up later when my project is bigger that I have to change everything.


LE: Also there are global variables that don't change for every object for example the Orthographic Matrix that I should pass to all objects. How can I access those variables without sending them all the time from function to function. If there are too many variables to send I just "pack" them in other classes and pass the pointer in the same way ?



Edited by Azzazelus, Today, 05:51 AM.


#2 ankhd   Members   -  Reputation: 1764


Posted Today, 08:34 PM



You are on the right path, see I first did my first game like passinging classes but then changed it to a static manager class, but that sux worse then passing in pointer to constructors.

It ends up being a bunch of Manager::Callsome thing hiding in the classes, the only half good thing is that you no't pass data to constructors, but in say 1 year later you forget about

what was in the clases you create and what sneaky static classes lurk in your code base. So now Ive done a full circle and now pass all params for any depent classes as param to constructors ends up the best way to go.