callbacks.c 705 B

12345678910111213141516171819202122232425
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <allegro5/allegro.h>
  4. #include "helpers.h"
  5. #include "callbacks.h"
  6. #include "_cgo_export.h"
  7. typedef bool (*al_create_custom_bitmap_upload)(ALLEGRO_BITMAP *bitmap, void *data);
  8. /* Wrapper for al_create_custom_bitmap. */
  9. ALLEGRO_BITMAP * go_create_custom_bitmap(int w, int h, void * context) {
  10. return al_create_custom_bitmap(w, h,
  11. (al_create_custom_bitmap_upload) go_create_custom_bitmap_callback, context);
  12. }
  13. /* This wraps the C api function that takes a callback, to take go_take_callback_callback
  14. as the callback */
  15. int go_take_callback(void * context) {
  16. return take_callback((function_pointer)go_take_callback_callback, context);
  17. }