-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcamera.html
More file actions
422 lines (356 loc) · 14 KB
/
Copy pathcamera.html
File metadata and controls
422 lines (356 loc) · 14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--Old html 4.0.1 way <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -->
<!--<meta charset="UTF-8">--><!-- New HTML5 way -->
<!-- Mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1"><!-- Favourite icon -->
<link rel="apple-touch-icon" sizes="180x180" href="https://naev.org/favicon-180.png">
<link rel="icon" type="image/png" sizes="196x196" href="https://naev.org/favicon-196.png">
<link rel="icon" type="image/png" sizes="128x128" href="https://naev.org/favicon-128.png">
<link rel="icon" type="image/png" sizes="64x64" href="https://naev.org/favicon-64.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://naev.org/favicon-32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://naev.org/favicon-16.png">
<link rel="shortcut icon" type="image/x-icon" href="https://naev.org/favicon.ico">
<link rel="stylesheet" href="../ldoc.css"><!-- CSS -->
<link rel="stylesheet" href=https://naev.org/style.css><!-- CSS -->
<!-- EnlighterJS Resources !-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/enlighterjs@3.4.0/dist/enlighterjs.min.css" />
<title>Naev Lua API</title><!-- Website information -->
</head>
<body class="bg-light">
<div id="naev-header" class="container-fluid nebula-bg">
<canvas id="nebula-canvas-0"></canvas>
<div class="container" style="position: relative; z-index: 1;">
<a href="https://naev.org/"><img src="https://naev.org/imgs/naev.png" alt="Naev"></a>
</div>
</div>
<nav class="navbar navbar-expand-sm navbar-dark bg-dark">
<div class="container">
<a class="p-0 navbar-brand" href="#"><img id="logo" class="img-fluid" src="https://naev.org/favicon.png" alt=
"Naev"></a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=
"#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label=
"Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse justify-content-between" id="navbarNavAltMarkup">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://naev.org/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://naev.org/page/1/">Blarg</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://naev.org/media/">Media</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://naev.org/downloads/">Downloads</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://naev.org/contact/">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/naev/naev">Github</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/naev/naev/wiki">Wiki</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://naev.org/api/">Lua API</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://naev.org/devmanual/">Dev Manual</a>
</li>
</ul>
</div>
</div>
</nav>
<div id="lDoc_container">
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Naev Lua API</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="../modules/ai.html">ai</a></li>
<li><a href="../modules/asteroid.html">asteroid</a></li>
<li><a href="../modules/audio.html">audio</a></li>
<li><a href="../modules/bkg.html">bkg</a></li>
<li><strong>camera</strong></li>
<li><a href="../modules/canvas.html">canvas</a></li>
<li><a href="../modules/cinema.html">cinema</a></li>
<li><a href="../modules/colour.html">colour</a></li>
<li><a href="../modules/commodity.html">commodity</a></li>
<li><a href="../modules/data.html">data</a></li>
<li><a href="../modules/diff.html">diff</a></li>
<li><a href="../modules/equipopt.optimize.html">equipopt.optimize</a></li>
<li><a href="../modules/escort.html">escort</a></li>
<li><a href="../modules/evt.html">evt</a></li>
<li><a href="../modules/faction.html">faction</a></li>
<li><a href="../modules/file.html">file</a></li>
<li><a href="../modules/fleet.html">fleet</a></li>
<li><a href="../modules/font.html">font</a></li>
<li><a href="../modules/format.html">format</a></li>
<li><a href="../modules/gfx.html">gfx</a></li>
<li><a href="../modules/gui.html">gui</a></li>
<li><a href="../modules/hook.html">hook</a></li>
<li><a href="../modules/jump.html">jump</a></li>
<li><a href="../modules/lazyload.html">lazyload</a></li>
<li><a href="../modules/linenoise.html">linenoise</a></li>
<li><a href="../modules/linopt.html">linopt</a></li>
<li><a href="../modules/lmisn.html">lmisn</a></li>
<li><a href="../modules/lmusic.html">lmusic</a></li>
<li><a href="../modules/love_shaders.html">love_shaders</a></li>
<li><a href="../modules/luatk.html">luatk</a></li>
<li><a href="../modules/misn.html">misn</a></li>
<li><a href="../modules/munition.html">munition</a></li>
<li><a href="../modules/music.html">music</a></li>
<li><a href="../modules/naev.html">naev</a></li>
<li><a href="../modules/news.html">news</a></li>
<li><a href="../modules/outfit.html">outfit</a></li>
<li><a href="../modules/pilot.html">pilot</a></li>
<li><a href="../modules/pilotai.html">pilotai</a></li>
<li><a href="../modules/pilotoutfit.html">pilotoutfit</a></li>
<li><a href="../modules/player.html">player</a></li>
<li><a href="../modules/portrait.html">portrait</a></li>
<li><a href="../modules/pp_shaders.html">pp_shaders</a></li>
<li><a href="../modules/prng.html">prng</a></li>
<li><a href="../modules/prob.html">prob</a></li>
<li><a href="../modules/proximity.html">proximity</a></li>
<li><a href="../modules/rnd.html">rnd</a></li>
<li><a href="../modules/safelanes.html">safelanes</a></li>
<li><a href="../modules/shader.html">shader</a></li>
<li><a href="../modules/ship.html">ship</a></li>
<li><a href="../modules/shiplog.html">shiplog</a></li>
<li><a href="../modules/spfx.html">spfx</a></li>
<li><a href="../modules/spob.html">spob</a></li>
<li><a href="../modules/swapship.html">swapship</a></li>
<li><a href="../modules/system.html">system</a></li>
<li><a href="../modules/tex.html">tex</a></li>
<li><a href="../modules/time.html">time</a></li>
<li><a href="../modules/tk.html">tk</a></li>
<li><a href="../modules/transform.html">transform</a></li>
<li><a href="../modules/var.html">var</a></li>
<li><a href="../modules/vn.html">vn</a></li>
<li><a href="../modules/vntk.html">vntk</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>camera</code></h1>
<p>Lua bindings to interact with the Camera.</p>
<p> An example would be:
<pre>
</pre></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get">get ()</a></td>
<td class="summary">Gets the x/y position and zoom of the camera.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#getZoom">getZoom ()</a></td>
<td class="summary">Gets the camera zoom.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos ()</a></td>
<td class="summary">Gets the camera position.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set">set (target[, hard_over=false[, speed=math.min(2000]])</a></td>
<td class="summary">Sets the camera.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#setZoom">setZoom (zoom[, hard_over=false[, speed=naev.conf().zoom_speed]])</a></td>
<td class="summary">Sets the camera zoom.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#shake">shake (amplitude)</a></td>
<td class="summary">Makes the camera shake.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "get"></a>
<strong>get ()</strong>
</dt>
<dd>
Gets the x/y position and zoom of the camera.
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
X position of the camera.</li>
<li>
<span class="types"><span class="type">number</span></span>
Y position of the camera.</li>
<li>
<span class="types"><span class="type">number</span></span>
Zoom level of the camera.</li>
</ol>
</dd>
<dt>
<a name = "getZoom"></a>
<strong>getZoom ()</strong>
</dt>
<dd>
Gets the camera zoom.
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
Zoom level of the camera.</li>
<li>
<span class="types"><span class="type">number</span></span>
Maximum zoom level of the camera (furthest).</li>
<li>
<span class="types"><span class="type">number</span></span>
Minimum zoom level of the camera (closest).</li>
</ol>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos ()</strong>
</dt>
<dd>
Gets the camera position.
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Vec2</span></span>
Position of the camera.
</ol>
</dd>
<dt>
<a name = "set"></a>
<strong>set (target[, hard_over=false[, speed=math.min(2000]])</strong>
</dt>
<dd>
Sets the camera. </p>
<p> Make sure to reset camera after using it or we'll run into trouble.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">target</span>
<span class="types"><span class="type">Pilot</span>, <span class="type">Vec2</span> or <span class="type">nil</span></span>
It will follow pilots around. If nil, it
follows the player.
</li>
<li><span class="parameter">hard_over</span>
<span class="types"><span class="type">boolean</span></span>
Indicates that the camera should
instantly teleport instead of fly over.
(<em>default</em> false)
</li>
<li><span class="parameter">speed</span>
Speed at which to fly over if
hard_over is false.
(<em>default</em> math.min(2000)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<li><pre data-enlighter-language="lua" class="example">camera.set() -- Resets the camera to the pilot hard.
</pre></li>
<li><pre data-enlighter-language="lua" class="example">camera.set( a_pilot, true ) -- Flies camera over to a_pilot.
</pre></li>
<li><pre data-enlighter-language="lua" class="example">camera.set( vec2.new() ) -- Jumps camera to 0,0
</pre></li>
</ul>
</dd>
<dt>
<a name = "setZoom"></a>
<strong>setZoom (zoom[, hard_over=false[, speed=naev.conf().zoom_speed]])</strong>
</dt>
<dd>
Sets the camera zoom. </p>
<p> Make sure to reset camera the zoom after using it or we'll run into trouble.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">zoom</span>
<span class="types"><span class="type">number</span></span>
Level of zoom to use (1 would indicate 1 unit = 1
pixel while 2 would be 1 unit = 2 pixels)
</li>
<li><span class="parameter">hard_over</span>
<span class="types"><span class="type">boolean</span></span>
Indicates that the camera should
change the zoom gradually instead of instantly.
(<em>default</em> false)
</li>
<li><span class="parameter">speed</span>
<span class="types"><span class="type">number</span></span>
Rate of change to
use.
(<em>default</em> naev.conf().zoom_speed)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre data-enlighter-language="lua" class="example">camera.setZoom() -- Resets the camera zoom
</pre>
</ul>
</dd>
<dt>
<a name = "shake"></a>
<strong>shake (amplitude)</strong>
</dt>
<dd>
Makes the camera shake.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">amplitude</span>
<span class="types"><span class="type">number</span></span>
Amplitude of the shaking.
</li>
</ul>
<h3>Usage:</h3>
<ul>
<li><pre data-enlighter-language="lua" class="example">camera.shake() -- Shakes the camera with amplitude 1.
</pre></li>
<li><pre data-enlighter-language="lua" class="example">camera.shake( 0.5 ) -- Shakes the camera with amplitude .5
</pre></li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2025-08-31 00:15:12 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
<div id="naev-footer" class="container-fluid nebula-bg mt-5">
<canvas id="nebula-canvas-1"></canvas>
<div class="container" style="position: relative; z-index: 1;">
<footer class="row text-muted">
<p class="col-xs-12 col-sm-6 text-left">© 2025 Naev Development Blarg</p>
<p class="col-xs-12 col-sm-6 text-right">Original content licensed under <a href=
"https://creativecommons.org/licenses/by-sa/4.0/">CC-by-sa 4.0</a></p>
</footer>
</div>
</div>
<!-- Naev.org Javascript -->
<script type="text/javascript" src="https://naev.org/site.js"></script>
<!-- EnlighterJS -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/enlighterjs@3.4.0/dist/enlighterjs.min.js">
integrity="sha384-qMvs9nZ6afccojk2J2vg2CwyiHc5m/k1nb9VWa+otyt3VK4agPEc9/pfWC/iOxkG"
crossorigin="anonymous">
</script>
<!-- Init Code -->
<script type="text/javascript">
// - highlight all pre + code tags (CSS3 selectors)
// - use theme "enlighter"
// - replace tabs with 2 spaces
EnlighterJS.init('pre', 'code', {
language : 'lua',
theme: 'enlighter',
indent : 2
});
</script>
</body>
</html>