-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathas3api.cpp
100 lines (85 loc) · 2.92 KB
/
as3api.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
** ADOBE SYSTEMS INCORPORATED
** Copyright 2012 Adobe Systems Incorporated
** All Rights Reserved.
**
** NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
** terms of the Adobe license agreement accompanying it. If you have received this file from a
** source other than Adobe, then your use, modification, or distribution of it requires the prior
** written permission of Adobe.
*/
#include "pathfinder.h"
#include "AS3/AS3.h"
// First we mark the function declaration with a GCC attribute specifying the
// AS3 signature
////** flascc_createPather **////
void flascc_createPather() __attribute__((used,
annotate("as3sig:public function flascc_createPather():int"),
annotate("as3package:com.renaun.flascc_interface")));
void flascc_createPather()
{
// Create an instance of the Class
Pather *result;
result = (Pather *)new Pather();
// Create int for the pointer into memory for this object instance
AS3_DeclareVar(asresult, int);
AS3_CopyScalarToVar(asresult, result);
// return the pointer value of this object in memory
AS3_ReturnAS3Var(asresult);
}
////** flascc_deletePather **////
void flascc_deletePather() __attribute__((used,
annotate("as3sig:public function flascc_deletePather(self):void"),
annotate("as3package:com.renaun.flascc_interface")));
void flascc_deletePather()
{
Pather *arg1 = (Pather *) 0 ;
AS3_GetScalarFromVar(arg1, self);
delete arg1;
AS3_ReturnAS3Var(undefined);
}
////** flascc_setMap **////
void flascc_setMap() __attribute__((used,
annotate("as3sig:public function flascc_setMap(self, buffer:int, colSize:int, rowSize:int):void"),
annotate("as3package:com.renaun.flascc_interface")));
void flascc_setMap()
{
Pather *arg1 = (Pather *) 0 ;
unsigned char *arg2 = (unsigned char *) 0 ;
int arg3;
int arg4;
// convert arguments
AS3_GetScalarFromVar(arg1, self);
AS3_GetScalarFromVar(arg2, buffer);
AS3_GetScalarFromVar(arg3, colSize);
AS3_GetScalarFromVar(arg4, rowSize);
// apply to object
(arg1)->setMap((unsigned char *)arg2, arg3, arg4);
// return void
AS3_ReturnAS3Var(undefined);
}
////** flascc_getPath **////
void flascc_getPath() __attribute__((used,
annotate("as3sig:public function flascc_getPath(self, sx:int, sy:int, nx:int, ny:int):int"),
annotate("as3package:com.renaun.flascc_interface")));
void flascc_getPath()
{
Pather *arg1 = (Pather *) 0 ;
int arg2;
int arg3;
int arg4;
int arg5;
int* result;
// convert arguments
AS3_GetScalarFromVar(arg1, self);
AS3_GetScalarFromVar(arg2, sx);
AS3_GetScalarFromVar(arg3, sy);
AS3_GetScalarFromVar(arg4, nx);
AS3_GetScalarFromVar(arg5, ny);
// apply to object
result = (arg1)->getPath(arg2, arg3, arg4, arg5);
// return Number
AS3_DeclareVar(asresult, int);
AS3_CopyScalarToVar(asresult, result);
AS3_ReturnAS3Var(asresult);
}