· 6 years ago · Mar 10, 2020, 05:22 PM
1GameSense API for Lua
2
3 cvar.set_string
4 cvar.get_string
5 cvar.set_float
6 cvar.set_raw_float
7 cvar.get_float
8 cvar.set_int
9 cvar.set_raw_int
10 cvar.get_int
11 cvar.invoke_callback
12 globals.realtime
13 globals.curtime
14 globals.frametime
15 globals.absoluteframetime
16 globals.maxplayers
17 globals.tickcount
18 globals.tickinterval
19 globals.framecount
20 globals.mapname
21 globals.lastoutgoingcommand
22 entity.get_local_player
23 entity.get_all
24 entity.get_players
25 entity.get_game_rules
26 entity.get_player_resource
27 entity.get_classname
28 entity.set_prop
29 entity.get_prop
30 entity.is_enemy
31 entity.is_alive
32 entity.is_dormant
33 entity.get_player_name
34 entity.get_player_weapon
35 entity.hitbox_position
36 entity.get_steam64
37 entity.get_bounding_box
38 client.set_event_callback
39 client.log
40 client.color_log
41 client.exec
42 client.userid_to_entindex
43 client.draw_debug_text
44 client.draw_hitboxes
45 client.random_int
46 client.random_float
47 client.screen_size
48 client.visible
49 client.trace_line
50 client.trace_bullet
51 client.scale_damage
52 client.delay_call
53 client.latency
54 client.camera_angles
55 client.camera_angles
56 client.timestamp
57 client.eye_position
58 client.set_clan_tag
59 client.system_time
60 client.reload_active_scripts
61 ui.new_checkbox
62 ui.new_slider
63 ui.new_combobox
64 ui.new_multiselect
65 ui.new_hotkey
66 ui.new_button
67 ui.new_color_picker
68 ui.new_textbox
69 ui.reference
70 ui.set
71 ui.get
72 ui.set_callback
73 ui.set_visible
74 ui.is_menu_open
75 ui.mouse_position
76 renderer.text
77 renderer.measure_text
78 renderer.rectangle
79 renderer.line
80 renderer.gradient
81 renderer.circle
82 renderer.circle_outline
83 renderer.triangle
84 renderer.world_to_screen
85 renderer.indicator
86 renderer.texture
87 renderer.load_svg
88
89cvar.set_string
90
91syntax: cvar.set_string(value)
92
93value - String value
94
95
96
97cvar.get_string
98
99syntax: cvar.get_string()
100
101Returns nil on failure.
102
103
104
105cvar.set_float
106
107syntax: cvar.set_float(value)
108
109value - Float value
110
111cvar.cl_interp_ratio:set_float(1)
112
113
114
115cvar.set_raw_float
116
117syntax: cvar.set_raw_float(value)
118
119value - Float value
120
121This sets the float value without changing the integer and string values.
122
123
124
125cvar.get_float
126
127syntax: cvar.get_float()
128
129Returns nil if called on a ConCommand.
130
131
132
133cvar.set_int
134
135syntax: cvar.set_int(value)
136
137value - Integer value
138
139
140
141cvar.set_raw_int
142
143syntax: cvar.set_raw_int(value)
144
145value - Integer value
146
147This sets the integer value without changing the float and string values.
148
149
150
151cvar.get_int
152
153syntax: cvar.get_int()
154
155Returns nil if called on a ConCommand.
156
157
158
159cvar.invoke_callback
160
161syntax: cvar.invoke_callback()
162
163For ConCommands, optionally pass extra arguments and they will be forwarded to the callback. For ConVars, optionally pass an extra integer argument specifying the index of the change callback to invoke, otherwise all change callbacks will be invoked.
164
165cvar.snd_setmixer:invoke_callback("Ambient", "vol", "0") -- equivalent to typing "snd_setmixer Ambient vol 0" in console
166
167
168
169globals.realtime
170
171syntax: globals.realtime()
172
173Returns the local time in seconds.
174
175
176
177globals.curtime
178
179syntax: globals.curtime()
180
181Returns the game time in seconds. This number is synchronized with the server.
182
183
184
185globals.frametime
186
187syntax: globals.frametime()
188
189Returns the number of seconds elapsed during the last game frame.
190
191
192
193globals.absoluteframetime
194
195syntax: globals.absoluteframetime()
196
197Returns the number of seconds elapsed during the last game frame.
198
199
200
201globals.maxplayers
202
203syntax: globals.maxplayers()
204
205Returns the maximum number of players in the server.
206
207
208
209globals.tickcount
210
211syntax: globals.tickcount()
212
213Returns the number of ticks elapsed in the server.
214
215
216
217globals.tickinterval
218
219syntax: globals.tickinterval()
220
221Returns the time elapsed in one game tick in seconds.
222
223
224
225globals.framecount
226
227syntax: globals.framecount()
228
229Returns the number of frames since the game started
230
231
232
233globals.mapname
234
235syntax: globals.mapname()
236
237Returns the name of the loaded map, or nil if you are not in game.
238
239
240
241globals.lastoutgoingcommand
242
243syntax: globals.lastoutgoingcommand()
244
245Returns the command number of the last outgoing command.
246
247
248
249entity.get_local_player
250
251syntax: entity.get_local_player()
252
253Returns the entity index for the local player, or nil on failure.
254
255
256
257entity.get_all
258
259syntax: entity.get_all(classname)
260
261classname - Optional string that specifies the class name of entities that will be added to the list, for example "CCSPlayer".
262
263Returns an array of entity indices. Pass no arguments for all entities.
264
265
266
267entity.get_players
268
269syntax: entity.get_players(enemies_only)
270
271enemies_only - Optional. If true then you and the players on your team will not be added to the list.
272
273Returns an array of player entity indices. Dormant and dead players will not be added to the list.
274
275
276
277entity.get_game_rules
278
279syntax: entity.get_game_rules()
280
281Returns entity index of CCSGameRulesProxy instance, or nil if none exists.
282
283
284
285entity.get_player_resource
286
287syntax: entity.get_player_resource()
288
289Returns entity index of CCSPlayerResource instance, or nil if none exists.
290
291
292
293entity.get_classname
294
295syntax: entity.get_classname(ent)
296
297ent - Entity index.
298
299Returns the name of the entity's class, or nil on failure.
300
301
302
303entity.set_prop
304
305syntax: entity.set_prop(ent, propname, value, array_index)
306
307ent - Entity index.
308
309propname - Name of the networked property.
310
311value - The property will be set to this value. For vectors or angles, separate the components by commas.
312
313array_index - Optional. If propname is an array, the value at this array index will be set.
314
315
316
317entity.get_prop
318
319syntax: entity.get_prop(ent, propname, array_index)
320
321ent - Entity index.
322
323propname - Name of the networked property.
324
325array_index - Optional. If propname is an array, the value at this array index will be returned.
326
327Returns the value of the property, or nil on failure. For vectors or angles, this returns three values.
328
329
330
331entity.is_enemy
332
333syntax: entity.is_enemy(ent)
334
335ent - Entity index.
336
337Returns true if the entity is on the other team.
338
339
340
341entity.is_alive
342
343syntax: entity.is_alive(ent)
344
345ent - Entity index.
346
347Returns true if the player is not dead.
348
349
350
351entity.is_dormant
352
353syntax: entity.is_dormant(ent)
354
355ent - Entity index.
356
357Returns true if the player is not dormant.
358
359
360
361entity.get_player_name
362
363syntax: entity.get_player_name(ent)
364
365ent - Player entity index.
366
367Returns the player's name, or the string "unknown" on failure.
368
369
370
371entity.get_player_weapon
372
373syntax: entity.get_player_weapon(ent)
374
375ent - Player entity index.
376
377Returns the entity index of the player's active weapon, or nil if the player is not alive, dormant, etc.
378
379
380
381entity.hitbox_position
382
383syntax: entity.hitbox_position(player, hitbox)
384
385player - Entity index of the player.
386
387hitbox - Either a string of the hitbox name, or an integer index of the hitbox.
388
389Returns world coordinates x, y, z, or nil on failure.
390
391
392
393entity.get_steam64
394
395syntax: entity.get_steam64(player)
396
397player - Entity index of the player.
398
399Returns steamID3, or nil on failure.
400
401
402
403entity.get_bounding_box
404
405syntax: entity.get_bounding_box(player)
406
407player - Entity index of the player.
408
409Returns x1, y1, x2, y2, alpha_multiplier. The contents of x1, y1, x2, y2 must be ignored when alpha_multiplier is zero, which indicates that the bounding box is invalid and should not be drawn.
410
411
412
413client.set_event_callback
414
415syntax: client.set_event_callback(event_name, callback)
416
417event_name - Name of the event.
418
419callback - Lua function to call when this event occurs.
420
421Raises an error and prints a message in console upon failure.
422
423
424
425client.log
426
427syntax: client.log(msg, ...)
428
429msg - The message
430
431... - Optional comma-separated arguments to concatenate with msg.
432
433
434
435client.color_log
436
437syntax: client.color_log(r, g, b, msg, ...)
438
439r - Red (0-255)
440
441g - Red (0-255)
442
443b - Red (0-255)
444
445msg - The message
446
447... - Optional comma-separated arguments to concatenate with msg.
448
449
450
451client.exec
452
453syntax: client.exec(cmd, ...)
454
455cmd - The console command(s) to execute.
456
457... - Optional comma-separated arguments to concatenate with cmd.
458
459
460
461client.userid_to_entindex
462
463syntax: client.userid_to_entindex(userid)
464
465userid - This is given by some game events.
466
467Returns the entity index, or 0 on failure.
468
469
470
471client.draw_debug_text
472
473syntax: client.draw_debug_text(x, y, z, line_offset, duration, r, g, b, a, ...)
474
475x - Position in world space
476
477y - Position in world space
478
479z - Position in world space
480
481line_offset - Used for vertical alignment, use 0 for the first line.
482
483duration - Time in seconds that the text will remain on the screen.
484
485r - Red (1-255)
486
487g - Green (1-255)
488
489b - Blue (1-255)
490
491a - Alpha (1-255)
492
493... - The text that will be drawn
494
495Avoid calling this during the paint event.
496
497
498
499client.draw_hitboxes
500
501syntax: client.draw_hitboxes(entindex, duration, hitboxes, r, g, b, a, tick)
502
503entindex - Entity index
504
505duration - Time in seconds
506
507hitboxes - Either the hitbox index, an array of hitbox indices, or 19 for all hitboxes
508
509r - Red (1-255)
510
511g - Green (1-255)
512
513b - Blue (1-255)
514
515a - Alpha (1-255)
516
517tick - Optional integer
518
519Draws hitbox overlays. Avoid calling this during the paint event.
520
521
522
523client.random_int
524
525syntax: client.random_int(minimum, maximum)
526
527minimum - Lowest possible result
528
529maximum - Highest possible result
530
531Returns a random integer between minimum and maximum.
532
533
534
535client.random_float
536
537syntax: client.random_float(minimum, maximum)
538
539minimum - Lowest possible result
540
541maximum - Highest possible result
542
543Returns a random float between minimum and maximum.
544
545
546
547client.screen_size
548
549syntax: client.screen_size()
550
551Returns (width, height).
552
553
554
555client.visible
556
557syntax: client.visible(x, y, z)
558
559x - Position in world space
560
561y - Position in world space
562
563z - Position in world space
564
565Returns true if the position is visible. For example, you could use a player's origin to see if they are visible.
566
567
568
569client.trace_line
570
571syntax: client.trace_line(skip_entindex, from_x, from_y, from_z, to_x, to_y, to_z)
572
573skip_entindex - Ignore this entity while tracing
574
575from_x - Position in world space
576
577from_y - Position in world space
578
579from_z - Position in world space
580
581to_x - Position in world space
582
583to_y - Position in world space
584
585to_z - Position in world space
586
587Returns fraction, entindex. fraction is a percentage in the range [0.0, 1.0] that tells you how far the trace went before hitting something, so 1.0 means nothing was hit. entindex is the entity index that hit, or -1 if no entity was hit.
588
589
590
591client.trace_bullet
592
593syntax: client.trace_bullet(from_player, from_x, from_y, from_z, to_x, to_y, to_z)
594
595from_player - Entity index of the player whose weapon will be used for this trace
596
597from_x - Position in world space
598
599from_y - Position in world space
600
601from_z - Position in world space
602
603to_x - Position in world space
604
605to_y - Position in world space
606
607to_z - Position in world space
608
609Returns entindex, damage. Entindex is nil when no player is hit.
610
611
612
613client.scale_damage
614
615syntax: client.scale_damage(entindex, hitgroup, damage)
616
617entindex - Player entity index
618
619hitgroup - Hit group index
620
621damage - Damage
622
623Returns adjusted damage for the specified hitgroup
624
625
626
627client.delay_call
628
629syntax: client.delay_call(delay, callback, ...)
630
631delay - Time in seconds to wait before calling callback.
632
633callback - The lua function that will be called after delay seconds.
634
635... - Optional arguments that will be passed to the callback.
636
637
638
639client.latency
640
641syntax: client.latency()
642
643Returns your latency in seconds.
644
645
646
647client.camera_angles
648
649syntax: client.camera_angles()
650
651Returns pitch, yaw, roll of where you are looking.
652
653
654
655client.camera_angles
656
657syntax: client.camera_angles(pitch, yaw)
658
659pitch - Pitch
660
661yaw - Yaw
662
663Set camera angles
664
665
666
667client.timestamp
668
669syntax: client.timestamp()
670
671Returns high precision timestamp in milliseconds.
672
673
674
675client.eye_position
676
677syntax: client.eye_position()
678
679Returns x, y, z world coordinates of the local player's eye position, or nil on failure.
680
681
682
683client.set_clan_tag
684
685syntax: client.set_clan_tag(...)
686
687... - The text that will be drawn
688
689The clan tag is removed if no argument is passed or if it is an empty string. Additional arguments will be concatenated similar to client.log.
690
691
692
693client.system_time
694
695syntax: client.system_time()
696
697Returns hour, minute, seconds, milliseconds.
698
699local h, m, s, ms = client.system_time()
700
701
702
703client.reload_active_scripts
704
705syntax: client.reload_active_scripts()
706
707Reloads all scripts the following frame.
708
709
710
711ui.new_checkbox
712
713syntax: ui.new_checkbox(tab, container, name)
714
715tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
716
717container - The name of the existing container to which this control will be added.
718
719name - The name of the checkbox.
720
721Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
722
723
724
725ui.new_slider
726
727syntax: ui.new_slider(tab, container, name, min, max, init_value, show_tooltip, unit, scale, tooltips)
728
729tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
730
731container - The name of the existing container to which this control will be added.
732
733name - The name of the slider.
734
735min - The minimum value that can be set using the slider.
736
737max - The maximum value that can be set using the slider.
738
739init_value - Optional integer. The initial value. If not provided, the initial value will be min.
740
741show_tooltip - Optional boolean. true if the slider should display its current value.
742
743unit - Optional string that is two characters or less. This will be appended to the display value. For example, "px" for pixels or "%" for a percentage.
744
745scale - Optional The display value will be multiplied by this scale. For example, 0.1 will make a slider with the range [0-1800] show as 0.0-180.0 with one decimal place.
746
747tooltips - Optional table used to override the tooltip for the specified values. The key must be within min-max. The value is a string that will be shown instead of the numeric value whenever that value is selected.
748
749Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
750
751
752
753ui.new_combobox
754
755syntax: ui.new_combobox(tab, container, name, ...)
756
757tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
758
759container - The name of the existing container to which this control will be added.
760
761name - The name of the combobox.
762
763... - One or more comma separated string values that will be added to the combobox. Alternatively, a table of strings that will be added.
764
765Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
766
767
768
769ui.new_multiselect
770
771syntax: ui.new_multiselect(tab, container, name, ...)
772
773tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
774
775container - The name of the existing container to which this control will be added.
776
777name - The name of the multiselect.
778
779... - One or more comma separated string values that will be added to the combobox. Alternatively, a table of strings that will be added.
780
781Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
782
783
784
785ui.new_hotkey
786
787syntax: ui.new_hotkey(tab, container, name, inline)
788
789tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
790
791container - The name of the existing container to which this control will be added.
792
793name - The name of the hotkey.
794
795inline - Optional boolean. If set to true, the hotkey will be placed to the right of the preceding menu item.
796
797Returns a special value that can be passed to ui.get to see if the hotkey is pressed, or throws an error on failure.
798
799
800
801ui.new_button
802
803syntax: ui.new_button(tab, container, name, callback)
804
805tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
806
807container - The name of the existing container to which this checkbox will be added.
808
809name - The name of the button.
810
811callback - The lua function that will be called when the button is pressed.
812
813Throws an error on failure. The return value should not be used with ui.set or ui.get.
814
815
816
817ui.new_color_picker
818
819syntax: ui.new_color_picker(tab, container, name, r, g, b, a)
820
821tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
822
823container - The name of the existing container to which this checkbox will be added.
824
825name - The name of the color picker. This will not be shown, it is only used to identify this item in saved configs.
826
827r - Optional initial red value (0-255)
828
829g - Optional initial green value (0-255)
830
831b - Optional initial blue value (0-255)
832
833a - Optional initial alpha value (0-255)
834
835Throws an error on failure. The color picker is placed to the right of the previous menu item.
836
837
838
839ui.new_textbox
840
841syntax: ui.new_textbox(tab, container)
842
843tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
844
845container - The name of the existing container to which this textbox will be added.
846
847Throws an error on failure. Returns a special value that can be used with ui.get
848
849
850
851ui.reference
852
853syntax: ui.reference(tab, container, name)
854
855tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
856
857container - The name of the existing container to which this checkbox will be added.
858
859name - The name of the menu item.
860
861Avoid calling this from inside a function. Returns a reference that can be passed to ui.get and ui.set, or throws an error on failure. This allows you to access a built-in pre-existing menu items. This function returns multiple values when the specified menu item is followed by unnamed menu items, for example a color picker or a hotkey.
862
863
864
865ui.set
866
867syntax: ui.set(item, value, ...)
868
869item - The result of either ui.new_checkbox, ui.new_slider, or ui.reference.
870
871value - The value to which the menu item will be set.
872
873... - Optional. For multiselect comboboxes, you may want to set more than one option.
874
875For checkboxes, pass true or false. For a slider, pass a number that is within the slider's minimum/maximum values. For a combobox, pass a string value. For a multiselect combobox, pass zero or more strings. For referenced buttons, param is ignored and the button's callback is invoked. For color pickers, pass the arguments r, g, b, a.
876
877
878
879ui.get
880
881syntax: ui.get(item)
882
883item - The special value returned by ui.new_checkbox, ui.new_slider, ui.new_combobox, ui.new_hotkey, or ui.reference.
884
885For a checkbox, returns true or false. For a slider, returns an integer. For a combobox, returns a string. For a multiselect combobox, returns an array of strings. For a hotkey, returns true if the hotkey is active. For a color picker, returns r, g, b, a. Throws an error on failure.
886
887
888
889ui.set_callback
890
891syntax: ui.set_callback(item, callback)
892
893item - The special value returned by ui.new_*. Do not try passing a reference to an existing menu item.
894
895callback - Lua function that will be called when the menu item changes values. For example, this will be called when the user checks or unchecks a checkbox.
896
897
898
899ui.set_visible
900
901syntax: ui.set_visible(item, visible)
902
903item - A menu item reference.
904
905visible - Boolean. Pass false to hide the control from the menu.
906
907
908
909ui.is_menu_open
910
911syntax: ui.is_menu_open()
912
913Returns true if the menu is currently open.
914
915
916
917ui.mouse_position
918
919syntax: ui.mouse_position()
920
921Returns current mouse coordinates x, y
922
923
924
925renderer.text
926
927syntax: renderer.text(x, y, r, g, b, a, flags, max_width, ...)
928
929x - Screen coordinate
930
931y - Screen coordinate
932
933r - Red (1-255)
934
935g - Green (1-255)
936
937b - Blue (1-255)
938
939a - Alpha (1-255)
940
941flags - "+" for large text, "-" for small text, "c" for centered text, "r" for right-aligned text, "b" for bold text. "c" can be combined with other flags. nil can be specified for normal sized uncentered text.
942
943max_width - Text will be clipped if it exceeds this width in pixels. Use 0 for no limit.
944
945... - Text that will be drawn
946
947This can only be called from the paint callback.
948
949
950
951renderer.measure_text
952
953syntax: renderer.measure_text(flags, ...)
954
955flags - "+" for large text, "-" for small text, or nil for normal sized text.
956
957... - Text that will be measured
958
959Returns width, height. This can only be called from the paint callback.
960
961
962
963renderer.rectangle
964
965syntax: renderer.rectangle(x, y, w, h, r, g, b, a)
966
967x - Screen coordinate
968
969y - Screen coordinate
970
971w - Width in pixels
972
973h - Height in pixels
974
975r - Red (1-255)
976
977g - Green (1-255)
978
979b - Blue (1-255)
980
981a - Alpha (1-255)
982
983This can only be called from the paint callback.
984
985
986
987renderer.line
988
989syntax: renderer.line(xa, ya, xb, yb, r, g, b, a)
990
991xa - Screen coordinate of point A
992
993ya - Screen coordinate of point A
994
995xb - Screen coordinate of point B
996
997yb - Screen coordinate of point B
998
999r - Red (1-255)
1000
1001g - Green (1-255)
1002
1003b - Blue (1-255)
1004
1005a - Alpha (1-255)
1006
1007This can only be called from the paint callback.
1008
1009
1010
1011renderer.gradient
1012
1013syntax: renderer.gradient(x, y, w, h, r1, g1, b1, a1, r2, g2, b2, a2, ltr)
1014
1015x - Screen coordinate
1016
1017y - Screen coordinate
1018
1019w - Width in pixels
1020
1021h - Height in pixels
1022
1023r1 - Red (1-255)
1024
1025g1 - Green (1-255)
1026
1027b1 - Blue (1-255)
1028
1029a1 - Alpha (1-255)
1030
1031r2 - Red (1-255)
1032
1033g2 - Green (1-255)
1034
1035b2 - Blue (1-255)
1036
1037a2 - Alpha (1-255)
1038
1039ltr - Left to right. Pass true for horizontal gradient, or false for vertical.
1040
1041This can only be called from the paint callback.
1042
1043
1044
1045renderer.circle
1046
1047syntax: renderer.circle(x, y, r, g, b, a, radius, start_degrees, percentage)
1048
1049x - Screen coordinate
1050
1051y - Screen coordinate
1052
1053r - Red (1-255)
1054
1055g - Green (1-255)
1056
1057b - Blue (1-255)
1058
1059a - Alpha (1-255)
1060
1061radius - Radius of the circle in pixels.
1062
1063start_degrees - 0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
1064
1065percentage - Must be within [0.0-1.0]. 1.0 is a full circle, 0.5 is a half circle, etc.
1066
1067This can only be called from the paint callback.
1068
1069
1070
1071renderer.circle_outline
1072
1073syntax: renderer.circle_outline(x, y, r, g, b, a, radius, start_degrees, percentage, thickness)
1074
1075x - Screen coordinate
1076
1077y - Screen coordinate
1078
1079r - Red (1-255)
1080
1081g - Green (1-255)
1082
1083b - Blue (1-255)
1084
1085a - Alpha (1-255)
1086
1087radius - Radius of the circle in pixels.
1088
1089start_degrees - 0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
1090
1091percentage - Must be within [0.0-1.0]. 1.0 is a full circle, 0.5 is a half circle, etc.
1092
1093thickness - Thickness of the outline in pixels.
1094
1095This can only be called from the paint callback.
1096
1097
1098
1099renderer.triangle
1100
1101syntax: renderer.triangle(x0, y0, x1, y1, x2, y2, r, g, b, a)
1102
1103x0 - Screen coordinate X for point A
1104
1105y0 - Screen coordinate Y for point A
1106
1107x1 - Screen coordinate X for point B
1108
1109y1 - Screen coordinate Y for point B
1110
1111x2 - Screen coordinate X for point C
1112
1113y2 - Screen coordinate Y for point C
1114
1115r - Red (1-255)
1116
1117g - Green (1-255)
1118
1119b - Blue (1-255)
1120
1121a - Alpha (1-255)
1122
1123This can only be called from the paint callback.
1124
1125
1126
1127renderer.world_to_screen
1128
1129syntax: renderer.world_to_screen(x, y, z)
1130
1131x - Position in world space
1132
1133y - Position in world space
1134
1135z - Position in world space
1136
1137Returns two screen coordinates (x, y), or nil if the world position is not visible on your screen. This can only be called from the paint callback.
1138
1139
1140
1141renderer.indicator
1142
1143syntax: renderer.indicator(r, g, b, a, ...)
1144
1145r - Red (1-255)
1146
1147g - Green (1-255)
1148
1149b - Blue (1-255)
1150
1151a - Alpha (1-255)
1152
1153... - The text that will be drawn
1154
1155Returns the Y screen coordinate (vertical offset) of the drawn text, or nil on failure. This can only be called from the paint callback.
1156
1157
1158
1159renderer.texture
1160
1161syntax: renderer.texture(id, x, y, w, h, r, g, b, a)
1162
1163id - Texture ID
1164
1165x - X screen coordinate
1166
1167y - Y screen coordinate
1168
1169w - Width
1170
1171h - Height
1172
1173r - Red (0-255)
1174
1175g - Green (0-255)
1176
1177b - Blue (0-255)
1178
1179a - Alpha (0-255)
1180
1181
1182
1183renderer.load_svg
1184
1185syntax: renderer.load_svg(contents, width, height)
1186
1187contents - SVG file contents
1188
1189width - Width
1190
1191height - Height
1192
1193Returns a texture ID that can be used with renderer.texture, or nil on failure