Skip to content

Instantly share code, notes, and snippets.

@kdridi
Created November 25, 2016 22:33
Show Gist options
  • Save kdridi/ca5da84a8d66b34f322cda9bb0cb0a57 to your computer and use it in GitHub Desktop.
Save kdridi/ca5da84a8d66b34f322cda9bb0cb0a57 to your computer and use it in GitHub Desktop.
#define BYTES_PER_PIXEL 4
typedef struct s_my_framebuffer
{
unsigned int width;
unsigned int height;
sfUint8 pixels[1];
} t_my_framebuffer;
t_my_framebuffer* my_framebuffer_create(unsigned int width, unsigned int height)
{
t_my_framebuffer* b;
int bytePerPixels;
b = (t_my_framebuffer*) malloc(sizeof(t_my_framebuffer) + (width * height * BYTES_PER_PIXEL - 1) * sizeof(sfUint8));
if (b != NULL)
{
b->width = width;
b->height = height;
}
return b;
}
void my_framebuffer_create(t_my_framebuffer* b)
{
free(b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment