lua_api.txt 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. .. contents::
  2. Math
  3. ====
  4. Vector3
  5. -------
  6. **Vector3** (x, y, z) : Vector3
  7. Constructor.
  8. **x** (v) : float
  9. Returns the x value of the vector.
  10. **y** (v) : float
  11. Returns the y value of the vector.
  12. **z** (v) : float
  13. Returns the z value of the vector.
  14. **.x** : float
  15. Returns/assigns the x value of the vector.
  16. **.y** : float
  17. Returns/assigns the y value of the vector.
  18. **.z** : float
  19. Returns/assigns the z value of the vector.
  20. **set_x** (v, x)
  21. Sets the value of the x value of the vector.
  22. **set_y** (v, y)
  23. Sets the value of the y value of the vector.
  24. **set_z** (v, z)
  25. Sets the value of the z value of the vector.
  26. **values** (v) : float, float, float
  27. Returns the x, y and z values of the vector.
  28. **add** (a, b) : Vector3
  29. Adds the vector *a* to *b* and returns the result.
  30. **subtract** (a, b) : Vector3
  31. Subtracts the vector *b* from *a* and returns the result.
  32. **multiply** (a, k) : Vector3
  33. Multiplies the vector *a* by the scalar *k* and returns the result.
  34. **divide** (a, k) : Vector3
  35. Divides the vector *a* by the scalar *k* and returns the result.
  36. **dot** (a, b) : float
  37. Returns the dot product between the vectors *a* and *b*.
  38. **cross** (a, b) : Vector3
  39. Returns the cross product between the vectors *a* and *b*.
  40. **equal** (a, b) : bool
  41. Returns true whether the vectors *a* and *b* are equal.
  42. **length** (a) : float
  43. Returns the lenght of *a*.
  44. **squared_length** (a) : float
  45. Returns the squared length of *a*.
  46. **set_length** (a, len)
  47. Sets the lenght of *a* to *len*.
  48. **normalize** (a) : Vector3
  49. Normalizes *a* and returns the result.
  50. **distance** (a, b) : float
  51. Returns the distance between the points *a* and *b*.
  52. **angle** (a, b) : float
  53. Returns the angle between the vectors *a* and *b*.
  54. **max** (a, b) : Vector3
  55. Returns a vector that contains the largest value for each component from *a* and *b*.
  56. **min** (a, b) : Vector3
  57. Returns a vector that contains the smallest value for each component from *a* and *b*.
  58. **forward** () : Vector3
  59. **backward** () : Vector3
  60. **left** () : Vector3
  61. **right** () : Vector3
  62. **up** () : Vector3
  63. **down** () : Vector3
  64. Returns the corresponding semantic axis.
  65. **zero** () : Vector3
  66. Returns a vector with all values set to zero.
  67. Vector3Box
  68. ----------
  69. **Vector3Box** ()
  70. Creates a new Vector3Box.
  71. **Vector3Box** (v)
  72. Creates a new Vector3Box from the Vector3 *v*.
  73. **Vector3Box** (x, y, z)
  74. Creates a new Vector3Box from components.
  75. **store** (v)
  76. Stores the Vector3 *v* in the box.
  77. **store** (x, y, z)
  78. Stores Vector3(x, y, z) in the box.
  79. **unbox** () : Vector3
  80. Returns the stored vector from the box.
  81. Quaternion
  82. ----------
  83. **Quaternion** (v, w) : Quaternion
  84. Constructor.
  85. **negate** (q) : Quaternion
  86. Negates the quaternion *q* and returns the result.
  87. **identity** () : Quaternion
  88. Returns the identity quaternion.
  89. **multiply** (a, b) : Quaternion
  90. Multiplies the quaternions *a* and *b*. (i.e. rotates first by *a* then by *b*).
  91. **multiply_by_scalar** (a, k) : Quaternion
  92. Multiplies the quaternion *a* by the scalar *k*.
  93. **length** (q) : float
  94. Returns the length of *q*.
  95. **normalize** (q) : Quaternion
  96. Normalizes the quaternion *q* and returns the result.
  97. **conjugate** (q) : Quaternion
  98. Returns the conjugate of quaternion *q*.
  99. **inverse** (q) : Quaternion
  100. Returns the inverse of quaternion *q*.
  101. **power** (q, exp) : Quaternion
  102. Returns the quaternion *q* raised to the power of *exp*.
  103. **elements** (q) : x, y, z, w
  104. Returns the elements of the quaternion.
  105. **look** (dir, [up]) : Quaternion
  106. Returns the quaternion describing the rotation needed to face towards *dir*.
  107. If *up* is not specified, Vector3.up() is used.
  108. **right** (q) : Vector3
  109. Returns the right axis of the rotation described by *q*.
  110. **up** (q) : Vector3
  111. Returns the up axis of the rotation described by *q*.
  112. **forward** (q) : Vector3
  113. Returns the forward axis of the rotation described by *q*.
  114. QuaternionBox
  115. -------------
  116. **QuaternionBox** ()
  117. Creates a new QuaternionBox.
  118. **QuaternionBox** (q)
  119. Creates a new QuaternionBox from the Quaternion *q*.
  120. **QuaternionBox** (x, y, z, w)
  121. Creates a new QuaternionBox from elements.
  122. **store(q)** ()
  123. Stores the Quaternion *q* in the box.
  124. **store** (x, y, z, w)
  125. Stores Quaternion(x, y, z, w) in the box.
  126. **unbox** () : Quaternion
  127. Returns the stored quaternion from the box.
  128. Matrix4x4
  129. ---------
  130. **Matrix4x4** (m0, m1, ..., m15) : Matrix4x4
  131. Constructor.
  132. **from_quaternion** (q) : Matrix4x4
  133. Returns a new matrix from *q*.
  134. **from_translation** (t) : Matrix4x4
  135. Returns a new matrix from *t*.
  136. **from_quaternion_translation** (q, t) : Matrix4x4
  137. Returns a new matrix from *q* and *t*.
  138. **from_axes** (x, y, z, t) : Matrix4x4
  139. Returns a new matrix from *x*, *y*, *z* and *t*.
  140. **copy** (m) : Matrix4x4
  141. Returns a copy of the matrix *m*.
  142. **add** (a, b) : Matrix4x4
  143. Adds the matrix *a* to *b* and returns the result.
  144. **subtract** (a, b) : Matrix4x4
  145. Subtracts the matrix *b* from *a* and returns the result.
  146. **multiply** (a, b) : Matrix4x4
  147. Multiplies the matrix *a* by *b* and returns the result. (i.e. transforms first by *a* then by *b*)
  148. **transpose** (m) : Matrix4x4
  149. Transposes the matrix *m* and returns the result.
  150. **determinant** (m) : float
  151. Returns the determinant of the matrix *m*.
  152. **invert** (m) : Matrix4x4
  153. Inverts the matrix *m* and returns the result.
  154. **x** (m) : Vector3
  155. Returns the x asis of the matrix *m*.
  156. **y** (m) : Vector3
  157. Returns the y asis of the matrix *m*.
  158. **z** (m) : Vector3
  159. Returns the z asis of the matrix *m*.
  160. **set_x** (m, x)
  161. Sets the x axis of the matrix *m*.
  162. **set_y** (m, y)
  163. Sets the y axis of the matrix *m*.
  164. **set_z** (m, z)
  165. Sets the z axis of the matrix *m*.
  166. **rotation** (m) : Quaternion
  167. Returns the rotation portion of the matrix *m*.
  168. **set_rotation** (m, r)
  169. Sets the rotation portion of the matrix *m*.
  170. **translation** (m, a) : Vector3
  171. Returns the translation portion of the matrix *m*.
  172. **set_translation** (m, t)
  173. Sets the translation portion of the matrix *m*.
  174. **identity** ()
  175. Returns the identity matrix.
  176. **transform** (m, v) : Vector3
  177. Transforms the vector *v* by the matrix *m* and returns the result.
  178. **to_string** (a)
  179. Returns a string representing the matrix.
  180. Matrix4x4Box
  181. ------------
  182. **Matrix4x4Box** (m)
  183. Creates a new Matrix4x4Box from the Matrix4x4 *m*.
  184. **store** (m)
  185. Stores the Matrix4x4 *m* in the box.
  186. **unbox** () : Matrix4x4
  187. Returns the stored matrix from the box.
  188. Math
  189. ----
  190. **ray_plane_intersection** (from, dir, point, normal) : float
  191. Returns the distance along ray (from, dir) to intersection point with plane defined by
  192. *point* and *normal* or -1.0 if no intersection.
  193. **ray_disc_intersection** (from, dir, center, radius, normal) : float
  194. Returns the distance along ray (from, dir) to intersection point with disc defined by
  195. *center*, *radius* and *normal* or -1.0 if no intersection.
  196. **ray_sphere_intersection** (from, dir, center, radius) : float
  197. Returns the distance along ray (from, dir) to intersection point with sphere defined by
  198. *center* and *radius* or -1.0 if no intersection.
  199. **ray_obb_intersection** (from, dir, tm, extents) : float
  200. Returns the distance along ray (from, dir) to intersection point with the oriented
  201. bounding box (tm, extents) or -1.0 if no intersection.
  202. World
  203. =====
  204. **spawn_unit** (world, name, [position, rotation]) : Unit
  205. Spawns a new instance of the unit *name* at the given *position* and *rotation*.
  206. **destroy_unit** (world, unit)
  207. Destroys the given *unit*.
  208. **num_units** (world) : int
  209. Returns the number of units in the *world*.
  210. **units** (world) : Table
  211. Returns all the the units in the world in a table.
  212. **update_animations** (world, dt)
  213. Update all animations with *dt*.
  214. **update_scene** (world, dt)
  215. Updates the scene with *dt*.
  216. **update** (world, dt)
  217. Updates the world with *dt*.
  218. **play_sound** (world, name, [loop, volume, position, range]) : SoundInstanceId
  219. Plays the sound with the given *name* at the given *position*, with the given
  220. *volume* and *range*. *loop* controls whether the sound must loop or not.
  221. **stop_sound** (world, id)
  222. Stops the sound with the given *id*.
  223. **link_sound** (world, id, unit, node)
  224. Links the sound *id* to the *node* of the given *unit*.
  225. After this call, the sound *id* will follow the unit *unit*.
  226. **set_listener_pose** (world, pose)
  227. Sets the *pose* of the listener.
  228. **set_sound_position** (world, position)
  229. Sets the *position* of the sound *id*.
  230. **set_sound_range** (world, range)
  231. Sets the *range* of the sound *id*.
  232. **set_sound_volume** (world, volume)
  233. Sets the *volume* of the sound *id*.
  234. **create_window_gui** (world) : Gui
  235. Creates a new window-space Gui of size *width* and *height*.
  236. **destroy_gui** (world, id)
  237. Destroys the gui with the given *id*.
  238. **create_debug_line** (world, depth_test) : DebugLine
  239. Creates a new DebugLine. *depth_test* controls whether to
  240. enable depth test when rendering the lines.
  241. **destroy_debug_line** (world, line)
  242. Destroys the debug *line*.
  243. **load_level** (world, name) : Level
  244. Loads the level *name* into the world.
  245. **physics_world** (world) : PhysicsWorld
  246. Returns the physics sub-world.
  247. **sound_world** (world) : SoundWorld
  248. Returns the sound sub-world.
  249. Unit
  250. ----
  251. **local_position** (unit) : Vector3
  252. Returns the local position of the unit.
  253. **local_rotation** (unit) : Quaternion
  254. Returns the local rotation of the unit.
  255. **local_scale** (unit) : Vector3
  256. Returns the local scale of the unit.
  257. **local_pose** (unit) : Matrix4x4
  258. Returns the local pose of the unit.
  259. **world_position** (unit) : Vector3
  260. Returns the world position of the unit.
  261. **world_rotation** (unit) : Quaternion
  262. Returns the world rotation of the unit.
  263. **world_pose** (unit) : Matrix4x4
  264. Returns the world pose of the unit.
  265. **set_local_position** (unit, position)
  266. Sets the local position of the unit.
  267. **set_local_rotation** (unit, rotation)
  268. Sets the local rotation of the unit.
  269. **set_local_scale** (unit, scale)
  270. Sets the local scale of the unit.
  271. **set_local_pose** (unit, n, pose)
  272. Sets the local pose of the unit.
  273. **camera** (unit, name)
  274. Returns the camera *name*.
  275. **material** (unit, name)
  276. Returns the material *name*.
  277. **mesh** (unit, name)
  278. Returns the mesh *name*.
  279. **sprite** (unit, name)
  280. Returns the sprite *name*.
  281. **actor** (unit, name)
  282. Returns the actor *name*.
  283. **controller** (unit, name)
  284. Returns the controller *name*.
  285. **is_a** (unit, type)
  286. Returns whether the unit is of the given *type*.
  287. **play_sprite_animation** (unit, name, loop)
  288. Plays the sprite animation *name*.
  289. **stop_sprite_animation** (unit)
  290. Stops the current playing animation.
  291. Camera
  292. ------
  293. **set_projection_type** (camera, type)
  294. Sets the projection type of the camera.
  295. **projection_type** (camera) : int
  296. Returns the projection type of the camera.
  297. **fov** (camera) : float
  298. Returns the field-of-view of the camera in degrees.
  299. **set_fov** (camera, degrees)
  300. Sets the field-of-view of the camera in degrees.
  301. **aspect** (camera) : float
  302. Returns the aspect ratio of the camera. (Perspective projection only.)
  303. **set_aspect** (camera)
  304. Sets the aspect ratio of the camera. (Perspective projection only.)
  305. **near_clip_distance** (camera) : float
  306. Returns the near clip distance of the camera.
  307. **set_near_clip_distance** (camera, near)
  308. Sets the near clip distance of the camera.
  309. **far_clip_distance** (camera) : float
  310. Returns the far clip distance of the camera.
  311. **set_far_clip_distance** (camera, far)
  312. Sets the far clip distance of the camera.
  313. **set_orthographic_metrics** (camera, left, right, bottom, top)
  314. Sets the coordinates for orthographic clipping planes. (Orthographic projection only.)
  315. **set_viewport_metrics** (camera, x, y, width, height)
  316. Sets the coordinates for the camera viewport in pixels.
  317. **screen_to_world** (camera, pos) : Vector3
  318. Returns *pos* from screen-space to world-space coordinates.
  319. **world_to_screen** (camera, pos) : Vector3
  320. Returns *pos* from world-space to screen-space coordinates.
  321. Sprite
  322. ------
  323. **set_frame** (sprite, num)
  324. Sets the frame of the sprite.
  325. **set_depth** (sprite, depth)
  326. Sets the depth of the sprite.
  327. Sprites with higher depth values are drawn in front of sprites
  328. whith lower depth values.
  329. Mesh
  330. ----
  331. **local_position** (mesh) : Vector3
  332. Returns the local position of the mesh.
  333. **local_rotation** (mesh) : Quaternion
  334. Returns the local rotation of the mesh.
  335. **local_pose** (mesh) : Matrix4x4
  336. Returns the local pose of the mesh.
  337. **set_local_position** (mesh, unit, position)
  338. Sets the local position of the mesh.
  339. **set_local_rotation** (mesh, unit, rotation)
  340. Sets the local rotation of the mesh.
  341. **set_local_pose** (mesh, unit, pose)
  342. Sets the local pose of the mesh.
  343. Material
  344. --------
  345. **set_float** (material, variable, value)
  346. Sets the material variable to the given value.
  347. **set_vector2** (material, variable, value)
  348. Sets the material variable to the given value.
  349. **set_vector3** (material, variable, value)
  350. Sets the material variable to the given value.
  351. Gui
  352. ---
  353. resolution
  354. TODO
  355. move
  356. TODO
  357. screen_to_gui
  358. TODO
  359. draw_rectangle
  360. TODO
  361. draw_image
  362. TODO
  363. draw_image_uv
  364. TODO
  365. draw_text
  366. TODO
  367. PhysicsWorld
  368. =============
  369. **gravity** (physics_world) : Vector3
  370. Returns the gravity.
  371. **set_gravity** (physics_world, gravity)
  372. Sets the gravity.
  373. **make_raycast**
  374. TODO
  375. **overlap_test**
  376. TODO
  377. Controller
  378. ----------
  379. **move** (controller, position)
  380. Moves the controller to *position*.
  381. **position** (controller) : Vector3
  382. Returns the position of the controller.
  383. **collides_up** (controller) : bool
  384. Returns whether the contoller collides upwards.
  385. **collides_down** (controller) : bool
  386. Returns whether the controller collides downwards.
  387. **collides_sides** (controller) : bool
  388. Returns whether the controller collides sidewards.
  389. Actor
  390. -----
  391. **world_position** (actor) : Vector3
  392. Returns the world position of the actor.
  393. **world_rotation** (actor) : Quaternion
  394. Returns the world rotation of the actor.
  395. **world_pose** (actor) : Matrix4x4
  396. Returns the world pose of the actor.
  397. **teleport_world_position** (actor, position)
  398. Teleports the actor to the given world position.
  399. **teleport_world_rotation** (actor, rotation)
  400. Teleports the actor to the given world rotation.
  401. **teleport_world_pose** (actor, pose)
  402. Teleports the actor to the given world pose.
  403. **center_of_mass** (actor) : Vector3
  404. Returns the center of mass of the actor.
  405. **enable_gravity** (actor)
  406. Enables gravity for the actor.
  407. **disable_gravity** (actor)
  408. Disables gravity for the actor.
  409. **enable_collision** (actor)
  410. Enables collision detection for the actor.
  411. **disable_collision** (actor)
  412. Disables collision detection for the actor.
  413. **set_collision_filter** (actor, name)
  414. Sets the collision filter of the actor.
  415. **set_kinematic** (actor, kinematic)
  416. Sets whether the actor is kinematic or not.
  417. Note that this call has no effect on static actors.
  418. **move** (actor, position)
  419. Moves the actor to *pos*
  420. Note that this call only affects nonkinematic actors.
  421. **is_static** (actor) : bool
  422. Returns whether the actor is static.
  423. **is_dynamic** (actor) bool
  424. Returns whether the actor is dynamic.
  425. **is_kinematic** (actor) : bool
  426. Returns whether the actor is kinematic (keyframed).
  427. **is_nonkinematic** (actor) : bool
  428. Returns whether the actor is nonkinematic (i.e. dynamic and not kinematic).
  429. **linear_damping** (actor) : float
  430. Returns the linear damping of the actor.
  431. **set_linear_damping** (actor, damping)
  432. Sets the linear damping of the actor.
  433. **angular_damping** (actor) : float
  434. Returns the angular damping of the actor.
  435. **set_angular_damping** (actor, rate)
  436. Sets the angular damping of the actor.
  437. **linear_velocity** (actor) : Vector3
  438. Returns the linear velocity of the actor.
  439. **set_linear_velocity** (actor, velocity)
  440. Sets the linear velocity of the actor.
  441. Note that this call only affects nonkinematic actors.
  442. **angular_velocity** (actor) : Vector3
  443. Returns the angular velocity of the actor.
  444. **set_angular_velocity** (actor, velocity)
  445. Sets the angular velocity of the actor.
  446. Note that this call only affects nonkinematic actors.
  447. **add_impulse** (actor, impulse)
  448. Adds a linear impulse (acting along the center of mass) to the actor.
  449. Note that this call only affects nonkinematic actors.
  450. **add_impulse_at** (actor, impulse, position)
  451. Adds a linear impulse (acting along the world position *pos*) to the actor.
  452. Note that this call only affects nonkinematic actors.
  453. **add_torque_impulse** (actor, impulse)
  454. Adds a torque impulse to the actor.
  455. **push** (actor, velocity, mass)
  456. Pushes the actor as if it was hit by a point object with the given *mass*
  457. travelling at the given *velocity*.
  458. Note that this call only affects nonkinematic actors.
  459. **push_at** (actor, velocity, mass, position)
  460. Like push() but applies the force at the world position *pos*.
  461. Note that this call only affects nonkinematic actors.
  462. **is_sleeping** (actor) : bool
  463. Returns whether the actor is sleeping.
  464. **wake_up** (actor)
  465. Wakes the actor up.
  466. **unit** (actor) : Unit
  467. Returns the unit that owns the actor or nil;
  468. SoundWorld
  469. ===========
  470. **stop_all** (sound_world)
  471. Stops all the sounds in the world.
  472. **pause_all** (sound_world)
  473. Pauses all the sounds in the world
  474. **resume_all** (sound_world)
  475. Resumes all previously paused sounds in the world.
  476. **is_playing** (sound_world, id) : bool
  477. Returns wheter the sound *id* is playing.
  478. ResourcePackage
  479. ================
  480. **load** (package)
  481. Loads all the resources in the package.
  482. Note that the resources are not immediately available after the call is made,
  483. instead, you have to poll for completion with has_loaded().
  484. **unload** (package)
  485. Unloads all the resources in the package.
  486. **flush** (package)
  487. Waits until the package has been loaded.
  488. **has_loaded** (package) : bool
  489. Returns whether the package has been loaded.
  490. Device
  491. ======
  492. **platform** () : string
  493. Returns a string identifying what platform the engine is running on.
  494. **architecture** () : string
  495. Returns a string identifying what architecture the engine is running on.
  496. **version** () : string
  497. Returns a string identifying the engine version.
  498. **last_delta_time** () : float
  499. Returns the time in seconds needed to render the last frame
  500. **quit** ()
  501. Quits the application.
  502. **resolution** () : Table
  503. Returns the main window resolution.
  504. **create_world** () : World
  505. Creates a new world.
  506. **destroy_world** (world)
  507. Destroys the given *world*.
  508. **render_world** (world, camera)
  509. Renders the given *world* from the point of view of the given *camera*.
  510. **create_resource_package** (name) : ResourcePackage
  511. Returns the resource package with the given *package_name* name.
  512. **destroy_resource_package** (package)
  513. Destroy a previously created resource *package*.
  514. Note that to unload the resources loaded by the package, you have to call
  515. ResourcePackage.unload() first.
  516. **console_send** (table)
  517. Sends the given lua *table* to clients connected to the engine.
  518. Note that the current version only supports explicitly escaped strings as key/value pairs.
  519. **can_get** (type, name) : bool
  520. Returns whether the resource (type, name) is loaded.
  521. When resource autoload is enabled it always returns true.
  522. **enable_resource_autoload** (enable)
  523. Sets whether resources should be automatically loaded when accessed.
  524. DebugLine
  525. =========
  526. **add_line** (debug_line, start, end, color)
  527. Adds a line from *start* to *end* with the given *color*.
  528. **add_axes** (debug_line, tm, length)
  529. Adds lines for each axis with the given *length*.
  530. **add_circle** (debug_line, center, radius, normal, color, [segments = 36])
  531. Adds a circle at *center* with the given *radius* and *normal* vector.
  532. **add_cone** (debug_line, from, to, radius, color, [segments = 36])
  533. Adds a cone with the base centered at *from* and the tip at *to*.
  534. **add_sphere** (debug_line, center, radius, color, [segments = 36])
  535. Adds a sphere at *center* with the given *radius*.
  536. **add_obb** (debug_line, tm, extents, color)
  537. Adds an orientd bounding box. *tm* describes the position and orientation of
  538. the box. *extents* describes the size of the box along the axis.
  539. **reset** (debug_line)
  540. Resets all the lines.
  541. **submit** (debug_line)
  542. Submits the lines to renderer for drawing.
  543. Input
  544. =====
  545. Keyboard
  546. --------
  547. **name** () : string
  548. Returns the name of the input device.
  549. **connected** () : bool
  550. Returns whether the input device is connected and functioning.
  551. **num_buttons** () : int
  552. Returns the number of buttons of the input device.
  553. **num_axes** () : int
  554. Returns the number of axes of the input device.
  555. **pressed** (id) : bool
  556. Returns whether the button *id* is pressed in the current frame.
  557. **released** (id) : bool
  558. Returns whether the button *id* is released in the current frame.
  559. **any_pressed** () : bool
  560. Returns wheter any button is pressed in the current frame.
  561. **any_released** () : bool
  562. Returns whether any button is released in the current frame.
  563. **button_id** (name) : int
  564. Returns the *id* of the button *name*.
  565. Keyboard Button Names
  566. ~~~~~~~~~~~~~~~~~~~~~
  567. * ``tab``, ``enter``, ``escape``, ``space``, ``backspace``
  568. * ``num_lock``, ``numpad_enter``, ``numpad_.``, ``numpad_*``, ``numpad_+``, ``numpad_-``, ``numpad_/``, ``numpad_0``, ``numpad_1``, ``numpad_2``, ``numpad_3``, ``numpad_4``, ``numpad_5``, ``numpad_6``, ``numpad_7``, ``numpad_8``, ``numpad_9``
  569. * ``f1``, ``f2``, ``f3``, ``f4``, ``f5``, ``f6``, ``f7``, ``f8``, ``f9``, ``f10``, ``f11``, ``f12``
  570. * ``home``, ``left``, ``up``, ``right``, ``down``, ``page_up``, ``page_down``, ``delete``, ``end``
  571. * ``left_ctrl``, ``right_ctrl``, ``left_shift``, ``right_shift``, ``caps_lock``, ``left_alt``, ``right_alt``, ``left_super``, ``right_super``
  572. * ``0``, ``1``, ``2``, ``3``, ``4``, ``5``, ``6``, ``7``, ``8``, ``9``
  573. * ``a``, ``b``, ``c``, ``d``, ``e``, ``f``, ``g``, ``h``, ``i``, ``j``, ``k``, ``l``, ``m``, ``n``, ``o``, ``p``, ``q``, ``r``, ``s``, ``t``, ``u``, ``v``, ``w``, ``x``, ``y``, ``z``
  574. Keyboard Axis Names
  575. ~~~~~~~~~~~~~~~~~~~
  576. None.
  577. Mouse
  578. -----
  579. **name** () : string
  580. Returns the name of the input device.
  581. **connected** () : bool
  582. Returns whether the input device is connected and functioning.
  583. **num_buttons** () : int
  584. Returns the number of buttons of the input device.
  585. **num_axes** () : int
  586. Returns the number of axes of the input device.
  587. **pressed** (id) : bool
  588. Returns whether the button *id* is pressed in the current frame.
  589. **released** (id) : bool
  590. Returns whether the button *id* is released in the current frame.
  591. **any_pressed** () : bool
  592. Returns wheter any button is pressed in the current frame.
  593. **any_released** () : bool
  594. Returns whether any button is released in the current frame.
  595. **axis** (id) : Vector3
  596. Returns the value of the axis *id*.
  597. The returned vector holds x and y coordinates of the pointer
  598. in window-space.
  599. **button_id** (name) : int
  600. Returns the *id* of the button *name*.
  601. **axis_id** (name) : int
  602. Returns the *id* of the axis *name*.
  603. Mouse Button Names
  604. ~~~~~~~~~~~~~~~~~~
  605. ``left``, ``middle``, ``right``, ``extra_1``, ``extra_2``
  606. Mouse Axis Names
  607. ~~~~~~~~~~~~~~~~
  608. * ``cursor``: Returns the cursor position (x, y) in screen coordinates.
  609. * ``cursor_delta``: Returns the delta of the cursor position (x, y) since last frame.
  610. * ``wheel``: Returns the movement of the mouse wheel in the y axis. Positive values of y mean upward scrolling, negative values mean downward scrolling.
  611. Touch
  612. -----
  613. **name** () : string
  614. Returns the name of the input device.
  615. **connected** () : bool
  616. Returns whether the input device is connected and functioning.
  617. **num_buttons** () : int
  618. Returns the number of buttons of the input device.
  619. **num_axes** () : int
  620. Returns the number of axes of the input device.
  621. **pressed** (id) : bool
  622. Returns whether the button *id* is pressed in the current frame.
  623. **released** (id) : bool
  624. Returns whether the button *id* is released in the current frame.
  625. **any_pressed** () : bool
  626. Returns wheter any button is pressed in the current frame.
  627. **any_released** () : bool
  628. Returns whether any button is released in the current frame.
  629. **axis** (id) : Vector3
  630. Returns the value of the axis *id*.
  631. The returned vector holds x and y coordinates of the pointer
  632. in window-space.
  633. Pad1, Pad2, Pad3, Pad4
  634. ----------------------
  635. **name** () : string
  636. Returns the name of the input device.
  637. **connected** () : bool
  638. Returns whether the input device is connected and functioning.
  639. **num_buttons** () : int
  640. Returns the number of buttons of the input device.
  641. **num_axes** () : int
  642. Returns the number of axes of the input device.
  643. **pressed** (id) : bool
  644. Returns whether the button *id* is pressed in the current frame.
  645. **released** (id) : bool
  646. Returns whether the button *id* is released in the current frame.
  647. **any_pressed** () : bool
  648. Returns wheter any button is pressed in the current frame.
  649. **any_released** () : bool
  650. Returns whether any button is released in the current frame.
  651. **axis** (id) : Vector3
  652. Returns the value of the axis *id*.
  653. The returned vector holds values in the range [-1;+1]
  654. **button_id** (name) : int
  655. Returns the *id* of the button *name*.
  656. **axis_id** (name) : int
  657. Returns the *id* of the axis *name*.
  658. Pad Button Names
  659. ~~~~~~~~~~~~~~~~
  660. * ``up``, ``down``, ``left``, ``right``
  661. * ``start``, ``back``, ``guide``
  662. * ``left_thumb``, ``right_thumb``
  663. * ``left_shoulder``, ``right_shoulder``
  664. * ``a``, ``b``, ``x``, ``y``
  665. Pad Axis Names
  666. ~~~~~~~~~~~~~~
  667. * ``left``, ``right``: Returns the direction (x, y) of the left or right thumbstick [-1; +1]. The z component represents the left or right trigger [0; +1].
  668. Window
  669. ======
  670. **show** ()
  671. Shows the window.
  672. **hide** ()
  673. Hides the window.
  674. **resize** (width, height)
  675. Resizes the window to *width* and *height*.
  676. **move** (x, y)
  677. Moves the window to *x* and *y*.
  678. **minimize** ()
  679. Minimizes the window.
  680. **restore** ()
  681. Restores the window.
  682. **is_resizable** () : bool
  683. Returns whether the window is resizable.
  684. **set_resizable** (resizable)
  685. Sets whether the window is resizable.
  686. **title** () : string
  687. Returns the title of the window.
  688. **set_title** (title)
  689. Sets the title of the window.