|
|
@@ -1,28 +1,35 @@
|
|
|
package karl2d
|
|
|
|
|
|
+CONFIG_RENDER_BACKEND_NAME :: #config(KARL2D_RENDER_BACKEND, "")
|
|
|
+
|
|
|
when ODIN_OS == .Windows {
|
|
|
- DEFAULT_RENDER_BACKEND :: RENDER_BACKEND_INTERFACE_D3D11
|
|
|
+ DEFAULT_RENDER_BACKEND_NAME :: "d3d11"
|
|
|
+ AVAILABLE_RENDER_BACKENDS :: "d3d11, gl"
|
|
|
} else when ODIN_OS == .Linux || ODIN_OS == .Darwin {
|
|
|
- DEFAULT_RENDER_BACKEND :: RENDER_BACKEND_INTERFACE_GL
|
|
|
+ DEFAULT_RENDER_BACKEND_NAME :: "gl"
|
|
|
+ AVAILABLE_RENDER_BACKENDS :: "gl"
|
|
|
} else when ODIN_OS == .JS {
|
|
|
- DEFAULT_RENDER_BACKEND :: RENDER_BACKEND_INTERFACE_WEBGL
|
|
|
-} else when ODIN_OS == .Freestanding {
|
|
|
- DEFAULT_RENDER_BACKEND :: RENDER_BACKEND_NIL
|
|
|
+ DEFAULT_RENDER_BACKEND_NAME :: "webgl"
|
|
|
+ AVAILABLE_RENDER_BACKENDS :: "webgl"
|
|
|
+} else {
|
|
|
+ DEFAULT_RENDER_BACKEND_NAME :: "nil"
|
|
|
+ AVAILABLE_RENDER_BACKENDS :: "nil"
|
|
|
}
|
|
|
|
|
|
-CUSTOM_RENDER_BACKEND_STR :: #config(KARL2D_RENDER_BACKEND, "")
|
|
|
+when CONFIG_RENDER_BACKEND_NAME == "" {
|
|
|
+ RENDER_BACKEND_NAME :: DEFAULT_RENDER_BACKEND_NAME
|
|
|
+} else {
|
|
|
+ RENDER_BACKEND_NAME :: CONFIG_RENDER_BACKEND_NAME
|
|
|
+}
|
|
|
|
|
|
-when CUSTOM_RENDER_BACKEND_STR != "" {
|
|
|
- when CUSTOM_RENDER_BACKEND_STR == "gl" {
|
|
|
- RENDER_BACKEND :: RENDER_BACKEND_INTERFACE_GL
|
|
|
- } else when CUSTOM_RENDER_BACKEND_STR == "d3d11" {
|
|
|
- RENDER_BACKEND :: RENDER_BACKEND_INTERFACE_D3D11
|
|
|
- } else when CUSTOM_RENDER_BACKEND_STR == "nil" {
|
|
|
- RENDER_BACKEND :: RENDER_BACKEND_NIL
|
|
|
- } else {
|
|
|
- #panic(CUSTOM_RENDER_BACKEND_STR + " is not a valid value for KARL2D_RENDER_BACKEND. Available backends are: gl, d3d11")
|
|
|
- //RENDER_BACKEND :: DEFAULT_RENDER_BACKEND
|
|
|
- }
|
|
|
+when RENDER_BACKEND_NAME == "gl" {
|
|
|
+ RENDER_BACKEND :: RENDER_BACKEND_GL
|
|
|
+} else when RENDER_BACKEND_NAME == "d3d11" {
|
|
|
+ RENDER_BACKEND :: RENDER_BACKEND_D3D11
|
|
|
+} else when RENDER_BACKEND_NAME == "webgl" {
|
|
|
+ RENDER_BACKEND :: RENDER_BACKEND_WEBGL
|
|
|
+} else when RENDER_BACKEND_NAME == "nil" {
|
|
|
+ RENDER_BACKEND :: RENDER_BACKEND_NIL
|
|
|
} else {
|
|
|
- RENDER_BACKEND :: DEFAULT_RENDER_BACKEND
|
|
|
-}
|
|
|
+ #panic("'" + RENDER_BACKEND_NAME + "' is not a valid value for 'KARL2D_RENDER_BACKEND' on Operating System " + ODIN_OS_STRING + ". Available backends are: " + AVAILABLE_RENDER_BACKENDS)
|
|
|
+}
|