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