Vector Of SDL_Rect

I wrote this :

1
2
	//Sprite Storage
	std::vector< SDL_Rect > char_frame;


How can I push back new object of type SDL_Rect with all its variables set to 0 ?
memset(&sdl_rect_object, 0, sizeof(SDL_Rect));

char_frame.push_back(sdl_rect_object);

Might have to cast sdl_rect_object as a void * though.

Or you could:

sdl_rect_object.x = 0;
sdl_rect_object.y = 0;
sdl_rect_object.h = 0;
sdl_rect_object.w = 0;

char_frame.push_back(sdl_rect_object);
Last edited on
This also works
char_frame.push_back(SDL_Rect());
Topic archived. No new replies allowed.