This repository has been archived by the owner on Apr 17, 2019. It is now read-only.
/
wrap.go
125 lines (120 loc) · 3.88 KB
/
wrap.go
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package wrap
import "github.com/tanema/amore/runtime"
var graphicsFunctions = runtime.LuaFuncs{
"circle": gfxCirle,
"arc": gfxArc,
"ellipse": gfxEllipse,
"points": gfxPoints,
"line": gfxLine,
"rectangle": gfxRectangle,
"polygon": gfxPolygon,
"getviewport": gfxGetViewport,
"setviewport": gfxSetViewport,
"getwidth": gfxGetWidth,
"getheight": gfxGetHeight,
"getdimensions": gfxGetDimensions,
"origin": gfxOrigin,
"translate": gfxTranslate,
"rotate": gfxRotate,
"scale": gfxScale,
"shear": gfxShear,
"push": gfxPush,
"pop": gfxPop,
"clear": gfxClear,
"setscissor": gfxSetScissor,
"getscissor": gfxGetScissor,
"setlinewidth": gfxSetLineWidth,
"setlinejoin": gfxSetLineJoin,
"getlinewidth": gfxGetLineWidth,
"getlinejoin": gfxGetLineJoin,
"setpointsize": gfxSetPointSize,
"getpointsize": gfxGetPointSize,
"setcolor": gfxSetColor,
"setbackgroundcolor": gfxSetBackgroundColor,
"getcolor": gfxGetColor,
"getbackgroundcolor": gfxGetBackgroundColor,
"getcolormask": gfxGetColorMask,
"setcolormask": gfxSetColorMask,
"print": gfxPrint,
"printf": gfxPrintf,
"getfont": gfxGetFont,
"setfont": gfxSetFont,
"setblendmode": gfxSetBlendMode,
"getstenciltest": gfxGetStencilTest,
"setstenciltest": gfxSetStencilTest,
"stencil": gfxStencil,
"setshader": gfxSetShader,
// metatable entries
"newimage": gfxNewImage,
"newtext": gfxNewText,
"newfont": gfxNewFont,
"newquad": gfxNewQuad,
"newcanvas": gfxNewCanvas,
"newspritebatch": gfxNewSpriteBatch,
"newshader": gfxNewShader,
}
var graphicsMetaTables = runtime.LuaMetaTable{
"Image": {
"draw": gfxTextureDraw,
"drawq": gfxTextureDrawq,
"getwidth": gfxTextureGetWidth,
"getheigth": gfxTextureGetHeight,
"getDimensions": gfxTextureGetDimensions,
"setwrap": gfxTextureSetWrap,
"setfilter": gfxTextureSetFilter,
},
"Text": {
"set": gfxTextSet,
"draw": gfxTextDraw,
"getwidth": gfxTextGetWidth,
"getheight": gfxTextGetHeight,
"getdimensions": gfxTextGetDimensions,
"getfont": gfxTextGetFont,
"setfont": gfxTextSetFont,
},
"Font": {
"getwidth": gfxFontGetWidth,
"getheight": gfxFontGetHeight,
"setfallback": gfxFontSetFallback,
"getwrap": gfxFontGetWrap,
},
"Quad": {
"getwidth": gfxQuadGetWidth,
"geteheight": gfxQuadGetHeight,
"getviewport": gfxQuadGetViewport,
"setviewport": gfxQuadSetViewport,
},
"Canvas": {
"newimage": gfxCanvasNewImage,
"draw": gfxTextureDraw,
"drawq": gfxTextureDrawq,
"getwidth": gfxTextureGetWidth,
"getheigth": gfxTextureGetHeight,
"getDimensions": gfxTextureGetDimensions,
"setwrap": gfxTextureSetWrap,
"setfilter": gfxTextureSetFilter,
},
"SpriteBatch": {
"add": gfxSpriteBatchAdd,
"addq": gfxSpriteBatchAddq,
"set": gfxSpriteBatchSet,
"setq": gfxSpriteBatchSetq,
"clear": gfxSpriteBatchClear,
"settexture": gfxSpriteBatchSetTexture,
"gettexture": gfxSpriteBatchGetTexture,
"setcolor": gfxSpriteBatchSetColor,
"getcolor": gfxSpriteBatchGetColor,
"getcount": gfxSpriteBatchGetCount,
"setbuffersize": gfxSpriteBatchSetBufferSize,
"getbuffersize": gfxSpriteBatchGetBufferSize,
"setdrawrange": gfxSpriteBatchSetDrawRange,
"getdrawrange": gfxSpriteBatchGetDrawRange,
"draw": gfxSpriteBatchDraw,
},
"Shader": {
"send": gfxShaderSend,
},
}
func init() {
runtime.RegisterModule("gfx", graphicsFunctions, graphicsMetaTables)
}