Category : 2d-games

I’m building a 2D platformer game, and every entity in my game inherits from class Entity. I have a std::vector<std::unique_ptr<Entity>> entities to dynamically allocate these entities. I want to also polymorphically check for collision from the driver code: for(int i = 0; i < entities.size();i++){ for(int j = 0; j < entities.size();j++) entities[i]->checkCollision(*j); } The ..

Read more

I am looking for a function that draws a filled circle using SDL2 without using a renderer at all. I currently have this: void Circle(int center_x, int center_y, int radius, SDL_Color color) { eraseOldCircle(); uint32_t *pixels = (uint32_t *) windowSurface->pixels; SDL_PixelFormat *windowFormat = windowSurface->format; SDL_LockSurface(windowSurface); // Lock surface for direct pixel access capability int radiussqrd ..

Read more