lua_api.txt 25 KB

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