Does virtual function works slower than regular function in C++? Let's see. Some test code: Results: Apparently the answer is yes, it works slower. When user marks function as virtual, C++ compiler adds pointer to virtual table (array of function pointers to resolve inheritance hierarchy and polymorphic behaviours). Some processing

Read More

Collision Detection for 2d game: Spatial Grid. Cocos2dx

Hello there, At the beginning, we should say, that full collision detection implementation consists of two parts: broad-space and narrow-space detections. Broad-space: detection of objects in space which could potentially collide. So we don't need to calculate each x each collisions, which is very inefficient. Narrow-phase: determine where exactly our