squish.c 745 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "vc.c"
  2. #include "./assets/tsodinPog.c"
  3. #define WIDTH 960
  4. #define HEIGHT 720
  5. float sinf(float);
  6. static uint32_t dst[WIDTH*HEIGHT];
  7. static float global_time = 0;
  8. #define SRC_SCALE 3
  9. Olivec_Canvas vc_render(float dt)
  10. {
  11. global_time += dt;
  12. float t = sinf(10*global_time);
  13. Olivec_Canvas dst_canvas = olivec_canvas(dst, WIDTH, HEIGHT, WIDTH);
  14. olivec_fill(dst_canvas, 0xFF181818);
  15. int factor = 100;
  16. int w = tsodinPog_width*SRC_SCALE - t*factor;
  17. int h = tsodinPog_height*SRC_SCALE + t*factor;
  18. olivec_sprite_copy_bilinear(
  19. dst_canvas,
  20. WIDTH/2 - w/2, HEIGHT - h, w, h,
  21. olivec_canvas(tsodinPog_pixels, tsodinPog_width, tsodinPog_height, tsodinPog_width));
  22. return dst_canvas;
  23. }