| 68 | } |
| 69 | |
| 70 | void UpdateTexture(SDL_Texture *texture, int frame) |
| 71 | { |
| 72 | SDL_Color *color; |
| 73 | Uint8 *src; |
| 74 | Uint32 *dst; |
| 75 | int row, col; |
| 76 | void *pixels; |
| 77 | int pitch; |
| 78 | |
| 79 | if (SDL_LockTexture(texture, NULL, &pixels, &pitch) < 0) { |
| 80 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock texture: %s\n", SDL_GetError()); |
| 81 | quit(5); |
| 82 | } |
| 83 | src = MooseFrames[frame]; |
| 84 | for (row = 0; row < MOOSEPIC_H; ++row) { |
| 85 | dst = (Uint32*)((Uint8*)pixels + row * pitch); |
| 86 | for (col = 0; col < MOOSEPIC_W; ++col) { |
| 87 | color = &MooseColors[*src++]; |
| 88 | *dst++ = (0xFF000000|(color->r<<16)|(color->g<<8)|color->b); |
| 89 | } |
| 90 | } |
| 91 | SDL_UnlockTexture(texture); |
| 92 | } |
| 93 | |
| 94 | void |
| 95 | loop() |
no test coverage detected