Mercurial > games > semicongine
annotate semicongine.nim @ 1425:0daed956cf9e
add: function to set engine
author | sam <sam@basx.dev> |
---|---|
date | Fri, 10 Jan 2025 00:09:59 +0700 |
parents | 3b8a736c45a7 |
children | 676fc13685a9 |
rev | line source |
---|---|
1298
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
1 import ./semicongine/core |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
2 export core |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
3 |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
4 import ./semicongine/resources |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
5 export resources |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
6 |
1362
3dbf77ca78b9
did: refactor loading, adding threaded background loading (still missing stuff though)
sam <sam@basx.dev>
parents:
1299
diff
changeset
|
7 import ./semicongine/loaders |
3dbf77ca78b9
did: refactor loading, adding threaded background loading (still missing stuff though)
sam <sam@basx.dev>
parents:
1299
diff
changeset
|
8 export loaders |
3dbf77ca78b9
did: refactor loading, adding threaded background loading (still missing stuff though)
sam <sam@basx.dev>
parents:
1299
diff
changeset
|
9 |
3dbf77ca78b9
did: refactor loading, adding threaded background loading (still missing stuff though)
sam <sam@basx.dev>
parents:
1299
diff
changeset
|
10 import ./semicongine/background_loader |
3dbf77ca78b9
did: refactor loading, adding threaded background loading (still missing stuff though)
sam <sam@basx.dev>
parents:
1299
diff
changeset
|
11 export background_loader |
3dbf77ca78b9
did: refactor loading, adding threaded background loading (still missing stuff though)
sam <sam@basx.dev>
parents:
1299
diff
changeset
|
12 |
1298
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
13 import ./semicongine/image |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
14 export image |
1267 | 15 |
1298
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
16 import ./semicongine/rendering |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
17 export rendering |
1267 | 18 |
1423
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
19 import ./semicongine/rendering/renderer |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
20 export renderer |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
21 |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
22 import ./semicongine/rendering/swapchain |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
23 export swapchain |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
24 |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
25 import ./semicongine/rendering/renderpasses |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
26 export renderpasses |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
27 |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
28 import ./semicongine/rendering/shaders |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
29 export shaders |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
30 |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
31 import ./semicongine/rendering/memory |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
32 export memory |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
33 |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
34 import ./semicongine/rendering/vulkan_wrappers |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
35 export vulkan_wrappers |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
36 |
1298
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
37 import ./semicongine/storage |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
38 import ./semicongine/input |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
39 export storage |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
40 export input |
1267 | 41 |
1298
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
42 import ./semicongine/audio |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
43 export audio |
1267 | 44 |
45 # texture packing is required for font atlas | |
1423
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
46 import ./semicongine/text/font |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
47 export font |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
48 |
1298
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
49 import ./semicongine/text |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
50 export text |
1267 | 51 |
1298
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
52 import ./semicongine/gltf |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
53 export gltf |
1267 | 54 |
55 when not defined(WITHOUT_CONTRIB): | |
1298
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
56 import ./semicongine/contrib/steam |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
57 import ./semicongine/contrib/settings |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
58 import ./semicongine/contrib/algorithms/texture_packing |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
59 import ./semicongine/contrib/algorithms/collision |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
60 import ./semicongine/contrib/algorithms/noise |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
61 export steam |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
62 export settings |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
63 export texture_packing |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
64 export collision |
1feaa8a97acf
did: halfway complete refactoring to move from all-include to some-include+imports, no API changes
sam <sam@basx.dev>
parents:
1277
diff
changeset
|
65 export noise |
1420
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
66 |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
67 #### Main engine object |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
68 |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
69 proc initEngine*(appName: string) = |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
70 engine_obj_internal = Engine() |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
71 engine_obj_internal.vulkan = initVulkan(appName) |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
72 |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
73 # start audio |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
74 engine_obj_internal.mixer = createShared(Mixer) |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
75 engine_obj_internal.mixer[] = initMixer() |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
76 engine_obj_internal.audiothread.createThread(audioWorker, engine_obj_internal.mixer) |
6f81a41603d9
did: start working on big restructuring
sam <sam@basx.dev>
parents:
1362
diff
changeset
|
77 engine_obj_internal.initialized = true |
1423
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
78 |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
79 engine_obj_internal.rawLoader = initBackgroundLoader(loadBytes) |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
80 engine_obj_internal.jsonLoader = initBackgroundLoader(loadJson) |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
81 engine_obj_internal.configLoader = initBackgroundLoader(loadConfig) |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
82 engine_obj_internal.grayImageLoader = initBackgroundLoader(loadImage[Gray]) |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
83 engine_obj_internal.imageLoader = initBackgroundLoader(loadImage[BGRA]) |
3b8a736c45a7
did: put almost all global state into a single struct
sam <sam@basx.dev>
parents:
1420
diff
changeset
|
84 engine_obj_internal.audioLoader = initBackgroundLoader(loadAudio) |
1425 | 85 |
86 proc setEngine*(e: Engine) = | |
87 engine_obj_internal = e |