Jump to content
  • Advertisement
Sign in to follow this  
zlatko_bre_1985

Few engine questions

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi i have yesterday encapsulated all my classes (camera,timer,XfileLoader,gameStateManager,Keyboard,Mouse..) within Z_Engine class. The way i implemented them is i created those classes as private members of Z_Engine class and use ClassCreate and ClassGet methods for manipulation. 1) Is this good method for encapsulation ? Within Z_Engine i have created a state manager something like article Managing Game States in C++ from http://tonyandpaige.com/ . This state manager encapsulate states so every state is selfcontained. So main loop looks like StateManager calling top state functions HandleEvents(),Update(),Draw(). To states can handle a events sent by keyboard and mouse I created a eventHandler , dispatchers classes.The way i implemented a event handling to states is: a)Keyboard class sends events to event dispatcher eventDispatcher->EventAdd(EVENT_KEYBOARD,EVENT_KEYDOWN,i,isShiftPressed); b)EventAdd do the following KeyboardEvents.push_back(new Event(type,arg1,arg2)); c)In main game loop there is EventsSend() which sends all recived events to the registered handlers d)GameState has registered event handler which only do ->EventArray.push_back(*e); f)When GameStateManager calls current state HandleEvents then i process a EventArray for needed events 2)Is there any better solution to eventHandling so i can send events to the event handler without so much copiing around? 3)What is the performance cost of using classes created with new keyword

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!