Skip to content

Instantly share code, notes, and snippets.

@Mikepicker
Created November 17, 2017 19:51
Show Gist options
  • Save Mikepicker/f4b7040d0a4d4911df0cb89f7bcf55d0 to your computer and use it in GitHub Desktop.
Save Mikepicker/f4b7040d0a4d4911df0cb89f7bcf55d0 to your computer and use it in GitHub Desktop.
void render() {
// Render survivor
SDL_Rect srcSurv = { .x = (survivor.frameX / survivor.animSpeed) * survivor.w, .y = survivor.frameY * survivor.h, .w = survivor.w, .h = survivor.h };
SDL_Rect dstSurv = { .x = (int)survivor.x, .y = (int)survivor.y, .w = survivor.w, .h = survivor.h };
SDL_RendererFlip flip = survivor.scaleX == 1 ? SDL_FLIP_NONE : SDL_FLIP_HORIZONTAL;
SDL_RenderCopyEx(gRenderer, survivor.texture, &srcSurv, &dstSurv, 0, NULL, flip);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment