Skip to content

Commit

Permalink
fix emit in getboundingclientrect
Browse files Browse the repository at this point in the history
  • Loading branch information
stisa committed Feb 26, 2017
1 parent 798efed commit 87efe89
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions webgl.nim
Expand Up @@ -233,14 +233,18 @@ type
finish* : proc() #Blocks execution until all previously called commands are finished.
flush* : proc() #Empties different

proc getBoundingClientRect*(c:Canvas):tuple[t,b,l,r:float] =
proc getBoundingClientRect*(c:Canvas):tuple[top,bottom,left,right:float] =
var
t,b,lf,r:float
{.emit:"""
var rect = `c`.getBoundingClientRect();
`result.t`= rect.top;
`result.b`= rect.bottom;
`result.l`= rect.left;
`result.r`= rect.right;
var _rect = `c`.getBoundingClientRect();
`t`= _rect.top;
`b`= _rect.bottom;
`l`= _rect.left;
`r`= _rect.right;
"""}
result = (t,b,lf,r)

proc bufferData*(gl:WebGLRenderingContext, target:GLenum, size:GLsizeiptr, usage:GLenum) = #Updates buffer data.
{. emit: "`gl`.bufferData(`target`,`size`,`usage`);" .}
proc bufferData*(gl:WebGLRenderingContext, target:GLenum, data:Float32Array, usage:GLenum) = #Updates buffer data.
Expand Down

0 comments on commit 87efe89

Please sign in to comment.