lua_api.txt 24 KB

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