lua_api.txt 25 KB

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