File tree Expand file tree Collapse file tree 1 file changed +5
-42
lines changed
Expand file tree Collapse file tree 1 file changed +5
-42
lines changed Original file line number Diff line number Diff line change 2020]
2121
2222
23- class States :
24- on_loaded_funcs = []
25- on_load_funcs = []
26- loaded = False
27-
28- @classmethod
29- def sort_callbacks (cls ):
30- cls .on_load_funcs = sorted (cls .on_load_funcs , key = lambda x : x [0 ])
31- cls .on_loaded_funcs = sorted (cls .on_loaded_funcs , key = lambda x : x [0 ])
32-
33-
3423def load ():
35- States .sort_callbacks ()
36-
37- for func in reversed (States .on_load_funcs ):
38- func [1 ]()
39-
40- scenes .load ()
41- shaders .load ()
42- textures .load ()
43- tracks .load ()
44- data .load ()
45-
46- States .loaded = True
47- for func in reversed (States .on_loaded_funcs ):
48- func [1 ]()
24+ scenes .load_pool ()
25+ shaders .load_pool ()
26+ textures .load_pool ()
27+ data .load_pool ()
4928
5029
5130def count ():
52- return shaders .count + textures .count
53-
54-
55- def loading_complete ():
56- return States .loaded
57-
58-
59- def on_load (func , priority = 0 ):
60- States .on_load_funcs .append ((priority , func ))
61-
62-
63- def on_loaded (func , priority = 0 ):
64- if loading_complete ():
65- func ()
66- return
67-
68- States .on_loaded_funcs .append ((priority , func ))
31+ return scenes .count + shaders .count + textures .count + data .count
You can’t perform that action at this time.
0 commit comments