VirtualComputer/libpxc/pxct.c

32 lines
776 B
C
Raw Permalink Normal View History

#include <stdio.h>
2019-03-06 22:41:35 +00:00
#include <stdlib.h>
#include <time.h>
/* https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html
gcc -Wall -c -fpic pxc.c
gcc -Wall -shared pxc.o -o pxc.so
gcc -Wall pxct.c -L. -lpxc -Wl,-rpath=.
*/
int convert(int px[], int *out[]);
2019-03-06 22:41:35 +00:00
typedef long long int addr;
void setSource(addr address, short w, short h, short mcx, short mcy);
void* updateAndGetMap(int x, int y, int w, int h, int** out_changed);
int main() {
2019-03-06 22:41:35 +00:00
printf("Setting source...");
void* p = malloc(640*480*4);
setSource((addr)p, 640, 480, 5, 4);
printf("Adding random values...\n");
srand(time(NULL));
unsigned int* xp=p;
for(int i=0; i<640*480; i++)
*(xp++)=rand();
2019-03-06 22:41:35 +00:00
printf("Updating map...");
void* x=updateAndGetMap(0, 0, 320, 240, NULL);
2019-03-06 22:41:35 +00:00
free(p);
return 0;
}