-
Notifications
You must be signed in to change notification settings - Fork 0
/
SteelStudio.lua
892 lines (588 loc) · 20.7 KB
/
SteelStudio.lua
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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
-------------------------------- CLASSES --------------------------------
require('helpers/ValueHelpers')
require('helpers/Backgrounds')
require('helpers/Themes')
require('helpers/Locations')
require('helpers/Objects')
require('helpers/Audio')
local json = require('lib/json')
-------------------------------- CONSTANTS --------------------------------
require('Storage')
require('constants')
-------------------------------- Initializing --------------------------------
sim = ac.getSim() ---@type ac.StateSim
car = ac.getCar(sim.focusedCar) or ac.getCar(0) ---@type ac.StateCar?
local steelConfig = "steelstudio.json"
trackPath = ac.getFolder(ac.FolderID.ContentTracks) .. "\\" .. ac.getTrackID()
steelStudioPath = trackPath .. "\\extension\\" .. steelConfig
extensionPath = trackPath .. "\\extension\\"
records = nil
local foundSteelStudioConf = nil ---@type boolean?
local validSteelStudioConf = nil ---@type boolean?
steelStudioData = {}
---- CAR VALUES ---
carPosition = car.position
carLook = car.look
carSteer = car.steer
startPosition = nil
startLook = nil
--local skinDir = ac.getFolder(ac.FolderID.ContentCars) .. '/' .. ac.getCarID(0) .. '/skins/my_skin'
---- MESHES: CREW AND DRIVERS ----
crew = ac.findNodes('?Meccanico_PALETTA?')
drivers = ac.findNodes('?DRIVER?')
---- BACKGROUND VALUES ----
local bkgIdx = 0
changedValues = 'Original settings'
---- THEME CONFIGURATION ----
local themes = {}
local currentTheme = {}
local emptyTheme = {
theme = "New Theme",
backgrounds = {},
locations = {}
}
---- ERRORS on inputs ----
local errors = {
inputLocation = ''
}
-------------------------------- To be decided --------------------------------
local count = 1
local light = nil ---@type ac.LightSource?
local alignOnce = true
local initializedBackgrounds = false
local initializedUI = false
local confFilename = nil
local teleported = false
function saveLocations()
--local bckName = "Steelstudio" .. ".json"
--io.copyFile(extensionPath .. "empty.json", extensionPath .. bckName)
local file = io.open(LOCATIONS_FILE_PATH, "w")
if file then
ac.console("File existing, writing")
local content = deepcopy(LOCATIONS)
ac.debug("CONTENT", content)
file:write(json.encode(content))
file:close()
end
ui.toast(ui.Icons.Confirm, "Locations file saved!")
--forceReload()
--saveState.saved = true
end
function saveObjects()
--local bckName = "Steelstudio" .. ".json"
--io.copyFile(extensionPath .. "empty.json", extensionPath .. bckName)
local file = io.open(OBJECTS_FILE_PATH, "w")
if file then
logFile(LOGS_FILE_PATH, 'Save Objects: Existing file, writing changes')
local content = deepcopy(OBJECTS)
ac.debug("CONTENT", content)
file:write(json.encode(content))
file:close()
end
ui.toast(ui.Icons.Confirm, "Locations file saved!")
--forceReload()
--saveState.saved = true
end
function saveTheme(themeContent)
--local bckName = "Steelstudio" .. ".json"
--io.copyFile(extensionPath .. "empty.json", extensionPath .. bckName)
local fileName = THEMES_PREFIX .. themeContent.theme
local file = io.open(STEEL_STUDIO_FOLDER_PATH .. '\\' .. fileName .. '.json', "w")
if file then
ac.console("File existing, writing")
local content = deepcopy(themeContent)
ac.debug("THEME CONTENT", themeContent)
for k, background in pairs(content.backgrounds) do
local val = content.backgrounds[k].color
ac.debug("val", dump(val))
content.backgrounds[k].color = tostring(val.r .. ", " .. val.g .. ", " .. val.b .. ", " .. val.mult)
end
ac.debug("CONTENT", content)
file:write(json.encode(content))
file:close()
else
ui.toast(ui.Icons.Bomb, "File not found!")
end
-- ui.toast(ui.Icons.Confirm, filename .. " saved!")
--forceReload()
--saveState.saved = true
end
function recycleTheme(themeName)
local fileName = THEMES_PREFIX .. themeName
local filePath = STEEL_STUDIO_FOLDER_PATH .. '\\' .. fileName .. '.json'
--local file = io.open(filePath, "r")
--ac.debug("Theme path", filePath)
--ui.toast(ui.Icons.ArrowUp, filePath)
local exists = io.exists(filePath)
if exists then
io.deleteFile(filePath)
ui.toast(ui.Icons.Confirm, filePath .. " deleted")
end
end
--function script.onShowWindowMain()
--ac.console("Opened App, here initialize it")
--
function save()
--local bckName = "Steelstudio" .. ".json"
--io.copyFile(extensionPath .. "empty.json", extensionPath .. bckName)
local file = io.open(extensionPath .. steelConfig, "w")
if file then
ac.console("File existing, writing")
local content = deepcopy(themes)
-- for every theme in themes
for k, theme in pairs(content) do
-- for every background in theme
for k, background in pairs(theme.backgrounds) do
local val = theme.backgrounds[k].color
ac.debug("val", dump(val))
theme.backgrounds[k].color = tostring(val.r .. ", " .. val.g .. ", " .. val.b .. ", " .. val.mult)
end
end
ac.debug("CONTENT", content)
file:write(json.encode(content))
file:close()
end
-- ui.toast(ui.Icons.Confirm, filename .. " saved!")
--forceReload()
--saveState.saved = true
end
--[[ if light then
alignOnce = true
light:dispose()
light = nil
end ]]
--storage.initializedBackgrounds = false
--end
local function welcomeTab()
ui.text('Welcome!')
if foundSteelStudioConf then
ui.textWrapped(
"Steel Studio file found. This track is compatible with Steel Studio! Select one of the tabs to begin to customize the track or move your car.")
else
ui.textWrapped(
"No Steel Studio file found. Don't worry, this track is still not compatible wih Steel Studio, but you can begin setting it from a blank template.")
end
end
local function themesTab()
ui.textWrapped(
'"Themes" are collections of backgrounds. Choose and save your themes here.')
-- don't show theme settings if there is no current theme
if CURRENT_THEME and next(CURRENT_THEME) == nil then
ui.text("No themes found. Start by adding a new theme here. ")
if ui.button("Add new theme") then
CURRENT_THEME = deepcopy(emptyTheme)
end
return
end
local defaultLabel = 'Theme ' .. #LOADED_THEMES + 1
local newThemeLabel = ui.inputText("New Theme: ", defaultLabel, ui.InputTextFlags.Placeholder)
ui.sameLine(0, 8)
ui.pushStyleColor(ui.StyleColor.Button, COLOR_GREEN)
if ui.button("Save current theme") then
local currTheme = deepcopy(CURRENT_THEME)
currTheme.theme = newThemeLabel
--themes[inputstring] = currTheme
table.insert(LOADED_THEMES, currTheme)
saveTheme(currTheme)
end
ui.popStyleColor()
ac.debug("input", newThemeLabel)
ui.newLine()
for k, item in ipairs(LOADED_THEMES) do
ac.debug("itemKey", k)
ac.debug("item", item)
ui.beginGroup(400)
if ui.button(item['theme'], vec2(ui.availableSpaceX() - 40, 0)) then
CURRENT_THEME = deepcopy(item)
end
ui.sameLine(0, 8)
if ui.button("X") then
ui.modalPopup('Delete ' .. item['theme'], 'Are you sure to delete the selected theme?', function(okPressed)
if okPressed then
table.remove(LOADED_THEMES, k)
recycleTheme(item['theme'])
end
end)
end
ui.endGroup()
end
ac.debug("CURRENT_THEME", CURRENT_THEME)
-- from steel studio data, create themes buttons
for k, item in pairs(steelStudioData) do
--[[ ui.text(item['theme'])
ui.text(steelStudioData[k].backgrounds[1].color)
if ui.button(item['theme']) then
currentTheme.backgrounds = transformBackgroundTable(steelStudioData[k].backgrounds)
end ]]
end
end
local function backgroundsTab(dt)
--TODO: Based on Current theme. If I change values, do I need to save a new theme?
-- don't show background settings if there is no current theme
if CURRENT_THEME and not CURRENT_THEME.backgrounds then
ui.text("No background found in current theme. ")
return
else
ui.text(changedValues)
for i, controller in ipairs(CURRENT_THEME.backgrounds) do
ac.debug("controller color", controller.color)
addColorController("colorController" .. i, controller.label, controller.color,
controller.meshNames, controller.texture, Storage.colorPickerType)
ac.debug("picker", controller)
end
if ui.button("Add new Color Controller") then
ac.debug("dt", dt)
table.insert(CURRENT_THEME.backgrounds,
newBackground("notworking", rgb(0, 0, 0), "notworking", "no-really" .. bkgIdx))
bkgIdx = bkgIdx + 1
end
if ui.button("Shuffle Palette") then
for i in ipairs(CURRENT_THEME.backgrounds) do
CURRENT_THEME.backgrounds[i].color = rgbm(math.random(), math.random(), math.random(), 1.0)
end
end
ac.debug("CURRENT_THEME", CURRENT_THEME)
end
end
local function teleportTab()
-- don't show location settings if there is no current theme
if not LOCATIONS then
ui.text("No locations found for current track. ")
return
else if not physics.allowed() then
ui.text("Can't teleport cars in current session mode. Currently, it's only allowed in Practice Mode. ")
return
else
local carName = CARS[SELECTED_CAR]:name()
ui.combo("Teleport Car", carName, function()
for k, v in pairs(CARS) do
if ui.selectable(v:name()) then
SELECTED_CAR = v.index + 1
end
end
end)
local locationsIdx = "Point " .. #LOCATIONS + 1
inputstring = ui.inputText("Location name... " .. locationsIdx, locationsIdx, ui.InputTextFlags.Placeholder)
ui.sameLine(0, 8)
if ui.button("Add location", vec2(ui.availableSpaceX(), 0)) then
errors.inputLocation = ''
local currentPosition = dump(car.position)
ac.debug("Car pos X", currentPosition)
if (inputstring ~= nil and inputstring ~= '') then
table.insert(LOCATIONS, {
position = dump(car.position),
look = dump(car.look),
name = inputstring
})
inputstring = ''
else
errors.inputLocation = 'Error! Please enter a valid name.'
end
end
ui.textColored(errors.inputLocation, rgbm.colors.red)
-- create buttons for locations in current theme
for k, item in pairs(LOCATIONS) do
local position = stringToVec3(item['position'])
local look = stringToVec3(item['look'])
if ui.button(item['name']) then teleportCar(position, look, SELECTED_CAR - 1) end
end
if ui.button('Teleport to Starting Line') then physics.teleportCarTo(0, ac.SpawnSet.Start) end
if ui.button('Teleport to Hotlap Start') then physics.teleportCarTo(0, ac.SpawnSet.HotlapStart) end
if ui.button('Teleport to Pits') then physics.teleportCarTo(0, ac.SpawnSet.Pits) end
if ui.button('Flip Car Direction') then teleportCar(carPosition, -carLook, SELECTED_CAR - 1) end
ui.pushStyleColor(ui.StyleColor.Button, COLOR_GREEN)
if ui.button("Save Locations") then
saveLocations()
end
ui.popStyleColor()
end
end
end
local function objectsTab()
-- show/hide objects depending on enabled flag
--TODO: meshNames is table. iterate over the table
for k, mesh in pairs(OBJECTS) do
local foundMesh = ac.findMeshes(mesh['meshNames'][1])
if not mesh['enabled'] then
foundMesh:setVisible(false)
else
foundMesh:setVisible(true)
end
end
if #OBJECTS == 0 then
ui.text("No objects controller found for current track.")
return
else
ui.text("Objects:")
-- for every object, add a checkbox to allow changing enabled flag
for k, v in pairs(OBJECTS) do
local meshes = ac.findMeshes(v['meshNames'][1])
ac.debug("FOUND MESHES", meshes)
if ui.checkbox(v['name'], v['enabled']) then
ac.console("Disable ")
OBJECTS[k]['enabled'] = not OBJECTS[k]['enabled']
end
end
ui.pushStyleColor(ui.StyleColor.Button, COLOR_GREEN)
if ui.button("Save Objects") then
saveObjects()
end
ui.popStyleColor()
end
ac.debug("OBJECTS", OBJECTS)
end
local function debugger()
ac.debug("Track path", TRACK_PATH)
ac.debug("Track Extension Path", TRACK_EXTENSION_PATH)
ac.debug("Steel Studio Folder Path", STEEL_STUDIO_FOLDER_PATH)
--ac.debug("Steel Studio path", steelStudioPath)
ac.debug("Found Steel Studio Conf", foundSteelStudioConf)
ac.debug("Valid Steel Studio Conf", validSteelStudioConf)
ac.debug("camera direction", ac.getSim().cameraLook)
ac.debug("car position", carPosition)
ac.debug("car look", carLook)
ac.debug("car steer", carSteer)
ac.debug("car skin", carSkin)
ac.debug("Initialized Backgrounds", initializedBackgrounds)
ac.debug("Current Theme", currentTheme)
--ac.debug("Current Backgrounds", currentTheme.backgrounds)
ac.debug("LOADED THEMES", LOADED_THEMES)
ac.debug("CURRENT_THEME", CURRENT_THEME)
ac.debug("LOCATIONS", LOCATIONS)
ac.debug("LOCATIONS FILE PATH", LOCATIONS_FILE_PATH)
ac.debug("Initialized Audio", INITIALIZED_AUDIO)
end
local function extrasTab()
ui.text('EXTRA')
if ui.checkbox('Disable Audio', Storage.disableAudio) then
if not Storage.disableAudio then
ui.modalPopup('Disable Audio?',
'Are you sure to disable audio? Keep in mind that this setting will be kept between gaming sessions. You will have to remember to re enable it.',
function(okPressed)
if okPressed then
Storage.disableAudio = not Storage.disableAudio
end
end)
else
Storage.disableAudio = not Storage.disableAudio
end
end
if ui.checkbox('Hide Pit Crew', Storage.hideCrew) then
Storage.hideCrew = not Storage.hideCrew
end
if ui.checkbox('Hide Drivers', Storage.hideDrivers) then
Storage.hideDrivers = not Storage.hideDrivers
end
if Storage.hideCrew then
crew:setVisible(false)
else
crew:setVisible(true)
end
if Storage.hideDrivers then
drivers:setVisible(false)
else
drivers:setVisible(true)
end
if Storage.disableAudio then
for i, channel in pairs(AUDIO_VOLUME) do
AUDIO_VOLUME[i] = 0
end
else
AUDIO_VOLUME = deepcopy(INITIAL_AUDIO_VOLUME)
end
ac.debug("Audio Volume", AUDIO_VOLUME)
end
local function aboutTab()
ui.text('Steel Studio. Made by SteelRacing, aka steel89ita.')
ui.text('All rights reserved.')
ui.text('https://github.com/steel89ita/ac_steel_studio')
--ui.text('physics late: ' .. ac.getSim().physicsLate)
ui.text('CPU occupancy: ' .. ac.getSim().cpuOccupancy)
--ui.text('CPU time: ' .. ac.getSim().cpuTime)
ui.text("CONSTANT:" .. TEST_VALUE)
changeConstant()
end
local function tryOpenSteelStudioConf()
-- Load the JSON file
local file = io.open(steelStudioPath, "r")
if file == nil then
foundSteelStudioConf = false
--ac.console("error: no steel conf found for track")
else
--ac.console("nice: steel conf found for track")
foundSteelStudioConf = true
local data = file:read("*all")
file:close()
-- Parse the json data into a Lua table
records = json.decode(data)
-- return if there is no records, can't continue
if records then
validSteelStudioConf = true
steelStudioData = records
else
validSteelStudioConf = false
return
end
ac.debug("Steel Studio Data", steelStudioData)
if (initializedBackgrounds == false) then
---- Setup Current Theme
---- we use the first theme at launch
-- if the json doesn't have an array of themes, it's not valid
-- I can't continue setting the first background
if records[1] == nil then
ac.console("Not a valid Steel Studio Theme!")
return
end
--populate themes table. for theme buttons
-- from steel studio data, create themes buttons
for k, item in pairs(steelStudioData) do
local theme = item
--BUG: need to convert backgrounds?
theme.backgrounds = transformBackgroundTable(steelStudioData[k].backgrounds)
table.insert(themes, theme)
end
-- copy the first theme
currentTheme = deepcopy(records[1])
-- exit if no backgrounds in theme
if currentTheme.backgrounds == nil then
ac.console("No backgrounds found in theme!")
return
end
--currentTheme.backgrounds = transformBackgroundTable(currentTheme.backgrounds)
initializedBackgrounds = true
end
end
end
---- MAIN FUNCTION - WINDOW MAIN ----
function script.windowMain(dt)
-- Debugger infos
debugger()
-- Load Storage Settings not relative to track: crew/drivers visibility, hue wheel preference
SetStorageSettings()
-- Set Audio Value according to Extras Tab Audio Toggle
SetGameVolume()
if not FETCHED_THEMES then
FetchThemes()
FETCHED_THEMES = true
end
if not FETCHED_LOCATIONS then
FetchLocations()
FETCHED_LOCATIONS = true
end
if not FETCHED_OBJECTS then
FetchObjects()
--[[ local foundMeshes = ac.findAny('LIGHTS')
ac.debug("FMESHES", foundMeshes:name(2))
for i, v in ipairs(foundMeshes) do
ac.console(foundMeshes:name(i))
logFile(LOGS_FILE_PATH, foundMeshes:name(i))
end ]]
FETCHED_OBJECTS = true
end
if not INITIALIZED_AUDIO then
InitializeAudio()
INITIALIZED_AUDIO = true
end
if not INITIALIZED_CARS then
for i, c in ac.iterateCars() do
table.insert(CARS, i, c)
end
INITIALIZED_CARS = true
end
-- Open Steel Studio Configuration and load themes - apply first theme
-- tryOpenSteelStudioConf()
-- used to set background colors across all tabs according to current theme
if CURRENT_THEME and CURRENT_THEME.backgrounds ~= nil then
for i, item in ipairs(CURRENT_THEME.backgrounds) do
changeMaterialTexture(item.meshNames, item.texture, item.color)
end
end
ui.beginOutline()
ui.tabBar('someTabBarID', function()
ui.tabItem('Welcome', welcomeTab)
ui.tabItem('Themes', themesTab)
ui.tabItem('Backgrounds', backgroundsTab)
ui.tabItem('Teleport', teleportTab)
ui.tabItem('Objects', objectsTab)
ui.tabItem('Extra', extrasTab)
ui.tabItem('About', aboutTab)
end)
ui.endOutline(rgbm(0, 0, 0, ac.windowFading()), 1)
--[[ if checkCrew == true then
checkCrew = not checkCrew
mesh:setVisible(false)
else
mesh:setVisible(true)
end ]]
--ac.debug("Found node", mesh)
--mesh.setVisible(mesh, false)
--local teleport = physics.setCarPosition(0, pos, -ac.getSim().cameraLook)
--teleport = nil
--physics.setCarPosition(0, vec3(-0.0411275, -0.0275598, -2.67227), vec3(0, 0,0))
--physics.setCarPosition(0, pos, -ac.getSim().cameraLook)
--physics.setCarPosition(0, vec3(nil), -ac.getSim().cameraLook)
--storageContent = dump(storage)
--ac.console(storageContent)
--ui.beginGroup(ui.availableSpaceX() - 24)
--ac.console(colorControllers[1].color)
--local newColor = storage.defaultColor:clone()
--ui.colorButton('Color', newColor, ui.ColorPickerFlags.PickerHueBar)
--if ui.itemEdited() then
--storage.defaultColor = newColor
--end
--ui.sameLine(0, 4)
--ui.setNextItemWidth(ui.availableSpaceX())
--ui.popItemWidth()
--ui.endGroup()
--ui.sameLine(0, 4)
--trackDirectory = ac.getFolder(ac.FolderID.ContentTracks) .. "\\" .. ac.getTrackID()
--confFilename = trackDirectory .. "\\extension\\steel_studio.ini"
--local ini = ac.INIConfig.load(confFilename, 10)
--ac.debug("ini", ini)
--local background1 = ini:get('ST_BACKGROUND', 'Red')
--ac.debug("bg1", background1)
--local r, g, b = string.match(background1, '"(%d+)", "(%d+)", "(%d+)"')
--ac.debug("r", r)
--ac.debug("backgorund1", rgb(tonumber(r), tonumber(g), tonumber(b)))
-- Parse the data into separate variables
--local id = records[2].id
--local description1 = records[1].description
--local description2 = records[2].description
ui.pushItemWidth(ui.availableSpaceX())
end
function script.onHideWindowMain()
ac.console("Closed app")
initializedBackgrounds = false
FETCHED_OBJECTS = false
INITIALIZED_AUDIO = false
--[[ if light then
alignOnce = true
light:dispose()
light = nil
end ]]
--storage.initializedBackgrounds = false
end
function script.windowMainSettings(dt)
ui.text('UI Preferences')
ui.text('Color Picker Type')
if ui.button("Hue Wheel", vec2(0, 0), ui.ButtonFlags.Activable) then
if Storage.colorPickerType == ui.ColorPickerFlags.PickerHueBar then
Storage.colorPickerType = ui.ColorPickerFlags.PickerHueWheel
else
Storage.colorPickerType = ui.ColorPickerFlags.PickerHueBar
end
end
--[[ ui.childWindow('scrolling', vec2(200, 400), function()
for i = 1, 1000 do
ui.text('Row ' .. i)
end
end) ]]
end
--function script.update(dt)
--ac.console("UPDATE")
--[[ if light and (storage.align or alignOnce) then
light.position:set(sim.cameraPosition):addScaled(sim.cameraLook, 0.1)
light.direction:set(sim.cameraLook)
alignOnce = false
end ]]
--end