Advertisement Jump to content
Sign in to follow this  

Few engine questions

This topic is 4909 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 . 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
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!