Category : 2d-games

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

I have created a function which generates a 1D array of perlin noise. I would now like to turn that into 2D noise. How would I do this? Here is the code: #include <stdlib.h> #include <stdint.h> #include "linearinterpolation.hpp" namespace noise{ float* perlin_noise(float* seeds, uint32_t numOfSeeds, float bias){ float* ret = new float[numOfSeeds+1]; uint8_t numOfLayers = ..

Read more