lua_api.txt 26 KB

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