diff --git a/ag.cc b/ag.cc index b2a925e..08f93b0 100644 --- a/ag.cc +++ b/ag.cc @@ -23,11 +23,14 @@ namespace ag static const luaL_Reg functions[] = { { "clearEventHandler", clearEventHandler }, { "doPhysics", doPhysics }, + { "drawLine", drawLine }, { "drawObjects", drawObjects }, + { "drawRect", drawRect }, { "drawText", drawText }, { "elapsedTime", elapsedTime }, { "endFrame", endFrame }, { "exit", exit }, + { "fillRect", fillRect }, { "getCamera", getCamera }, { "getScreenSize", getScreenSize }, { "getTextSize", getTextSize }, diff --git a/doc/index.html b/doc/index.html index 154d669..1eb7394 100644 --- a/doc/index.html +++ b/doc/index.html @@ -64,6 +64,20 @@ mode is enabled; this mode is enabled by default. See setAutoPhysics for more information.

+ +

drawLine

+

ag.drawLine(r, g, b, x1, y1, x2, y2 [, width])

+

+This function tells the engine to draw a line to the screen. +The color of the line is given by (r, g, b). +The start and end coordinates of the line are (x1, y1) and (x2, y2). +width is an optional parameter and defaults to 1 if not +specified. +It controls the width of the line to be drawn. +drawLine() should normally be called from the +update_overlay event handler. +

+

drawObjects

ag.drawObjects()

@@ -75,6 +89,31 @@ See
setAutoDrawObjects for more information.

+ +

drawRect

+

ag.drawRect(r, g, b, width, height, x, y [, rot])

+

+This function draws a rectangle to the screen. +The color of the rectangle is given by (r, g, b). +The size is given by width and height. +The center of the rectangle is given by (x, y). +rot is an optional parameter that defaults to 0.0. +It specifies the rotation of the rectangle. +drawRect() should normally be called from the +update_overlay event handler. +

+ +
+

drawText

+

ag.drawText(message, r, g, b, ptsize, x, y)

+

+This function draws the text message, which should be +a string, to the screen at position (x, y), with color +specified by (r, g, b), and with font size ptsize. +It should normally be called from the update_overlay +event handler. +

+

elapsedTime

elapsed_msec = ag.elapsedTime()

@@ -107,6 +146,20 @@ will be executed and callbacks to other events may still be called. The engine should exit within one update step.

+
+

fillRect

+

ag.fillRect(r, g, b, width, height, x, y [, rot])

+

+This function draws a solid, filled rectangle to the screen. +The color of the rectangle is given by (r, g, b). +The size is given by width and height. +The center of the rectangle is given by (x, y). +rot is an optional parameter that defaults to 0.0. +It specifies the rotation of the rectangle. +fillRect() should normally be called from the +update_overlay event handler. +

+

getCamera

eye_x, eye_y, eye_z, center_x, center_y, center_z, up_x, up_y, up_z = ag.getCamera()

@@ -116,6 +169,15 @@ focus position (center coordinates), and up vector for the current camera settings.

+
+

getTextSize

+

width, height = ag.getTextSize(message, ptsize)

+

+This function returns the width and height, in pixels, that +the text specified by message, which should be a string, +would take when drawn to the screen using font size ptsize. +

+

getScreenSize

width, height = ag.getScreenSize()