-
Notifications
You must be signed in to change notification settings - Fork 2
/
upy_wrap.cpp
48 lines (36 loc) · 2.2 KB
/
upy_wrap.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* Copyright (C) 2020 Sean D'Epagnier <seandepagnier@gmail.com>
*
* This Program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*/
#include "ugfx.h"
extern "C" {
void *ugfx_surface_from_surface_c(void *s) { return (void*)new surface((surface*)s); }
void *ugfx_surface_from_data_c(int w, int h, int internal_bypp, const char *data32) { return (void*)new surface(w, h, internal_bypp, data32); }
void *ugfx_surface_from_file_c(const char* filename, int bypp) { return (void*)new surface(filename, bypp); }
//void ugfx_surface_c_free(void *s) { delete (surface*)s; }
void ugfx_surface_c_load(void *s, const char* filename, int bypp)
{
surface *surf = (surface*)s;
surf->load(filename, bypp);
}
void ugfx_surface_c_info(void *s, int *width, int *height, int *bypp, char **data) {
surface *surf = (surface*)s;
*width = surf->width;
*height = surf->height;
*bypp = surf->bypp;
*data = surf->p;
}
//void ugfx_surface_c_file_info(void *dest, const char *filename, int *width, int *height) { ((surface*)dest)->file_info(filename, width, height); }
//void ugfx_surface_c_blit_file(void *dest, const char *filename, int xoff, int yoff) { ((surface*)dest)->blit(filename, xoff, yoff); }
void ugfx_surface_c_blit(void *dest, void *src, int xoff, int yoff, int flip) { ((surface*)dest)->blit((surface*)src, xoff, yoff, flip); }
void ugfx_surface_c_line(void *dest, int x1, int y1, int x2, int y2, unsigned int c) { ((surface*)dest)->line(x1, y1, x2, y2, c); }
void ugfx_surface_c_box(void *dest, int x1, int y1, int x2, int y2, unsigned int c) { ((surface*)dest)->box(x1, y1, x2, y2, c); }
void ugfx_surface_c_invert(void *dest, int x1, int y1, int x2, int y2) { ((surface*)dest)->invert(x1, y1, x2, y2); }
void ugfx_surface_c_fill(void *dest, unsigned int c) { ((surface*)dest)->fill(c); }
void *ugfx_spiscreen_c(int driver) { return (void*)new spiscreen(driver); }
void ugfx_spiscreen_c_free(void *screen) { delete (spiscreen*)screen; }
void ugfx_spiscreen_c_refresh(void *screen) { ((spiscreen*)screen)->refresh(); }
}