Code: Select all
Enumeration
#ProGUI_RenderVector
#ProGUI_RenderDirect2D
#ProGUI_RenderCairo
#ProGUI_RenderAlexVG
EndEnumeration
Global ProGUI_RenderSubsystem = #ProGUI_RenderDirect2D
;- Driver utility macros
#DriverErrorNotImplemented = #True
Macro DriverNotImplemented(driver)
CompilerIf #DriverErrorNotImplemented
DebuggerError(#PB_Compiler_Procedure + " : " + driver + " driver not implemented!!")
CompilerElse
DebuggerWarning(#PB_Compiler_Procedure + " : " + driver + " driver not implemented!! at line " + Str(#PB_Compiler_Line))
CompilerEndIf
EndMacro
Macro SelectDriver(var, value, function)
Enumeration Driver
EndEnumeration
CompilerIf #PB_Compiler_EnumerationValue = 1
function
CompilerElse
CompilerIf MacroExpandedCount % #PB_Compiler_EnumerationValue = 1
Select var
CompilerEndIf
Case value
function
CompilerIf MacroExpandedCount % #PB_Compiler_EnumerationValue = 0
EndSelect
CompilerEndIf
CompilerEndIf
EndMacro
;-
;- Direct2D Driver - this would be in it's own include e.g. Direct2D.pbi
Enumeration Driver
#Driver_Direct2D
EndEnumeration
CompilerIf Defined(Driver_Direct2D, #PB_Constant)
Macro drv_D2D(function = DriverNotImplemented("D2D"))
SelectDriver(ProGUI_RenderSubsystem, #ProGUI_RenderDirect2D, function)
EndMacro
;- functions
Macro drv_D2D_BeginLayer()
Debug "drv_D2D_BeginLayer()"
EndMacro
Macro drv_D2D_test()
Debug "drv_D2D_test()"
EndMacro
Macro drv_D2D_test2()
Debug "drv_D2D_test2()"
EndMacro
CompilerElse
Macro drv_D2D(function=)
EndMacro
CompilerEndIf
;-
;- Vector Driver - this would be in it's own include e.g. Vector.pbi
Enumeration Driver
#Driver_Vector
EndEnumeration
CompilerIf Defined(Driver_Vector, #PB_Constant)
Macro drv_Vec(function = DriverNotImplemented("Vec"))
SelectDriver(ProGUI_RenderSubsystem, #ProGUI_RenderVector, function)
EndMacro
;- functions
Macro drv_Vec_BeginLayer()
Debug "drv_Vec_BeginLayer()"
EndMacro
Macro drv_Vec_test()
Debug "drv_Vec_test()"
EndMacro
Macro drv_Vec_test2()
Debug "drv_Vec_test2()"
EndMacro
CompilerElse
Macro drv_Vec(function=)
EndMacro
CompilerEndIf
;-
;- Cairo Driver - this would be in it's own include e.g. Cairo.pbi
Enumeration Driver
#Driver_Cairo
EndEnumeration
CompilerIf Defined(Driver_Cairo, #PB_Constant)
Macro drv_Cairo(function = DriverNotImplemented("Cairo"))
SelectDriver(ProGUI_RenderSubsystem, #ProGUI_RenderCairo, function)
EndMacro
;- functions
Macro drv_Cairo_BeginLayer()
Debug "drv_Cairo_BeginLayer()"
EndMacro
Macro drv_Cairo_test()
Debug "drv_Cairo_test()"
EndMacro
Macro drv_Cairo_test2()
Debug "drv_Cairo_test2()"
EndMacro
CompilerElse
Macro drv_Cairo(function=)
EndMacro
CompilerEndIf
;-
;- AlexVG Driver - this would be in it's own include e.g. AlexVG.pbi
Enumeration Driver
#Driver_AlexVG
EndEnumeration
CompilerIf Defined(Driver_AlexVG, #PB_Constant)
Macro drv_AlexVG(function = DriverNotImplemented("AlexVG"))
SelectDriver(ProGUI_RenderSubsystem, #ProGUI_RenderAlexVG, function)
EndMacro
;- functions
Macro drv_AlexVG_BeginLayer()
Debug "drv_AlexVG_BeginLayer()"
EndMacro
Macro drv_AlexVG_test()
Debug "drv_AlexVG_test()"
EndMacro
Macro drv_AlexVG_test2()
Debug "drv_AlexVG_test2()"
EndMacro
CompilerElse
Macro drv_AlexVG(function=)
EndMacro
CompilerEndIf
;-
;- Drivers - this would be in it's own include e.g. Drivers.pbi with includes for all the drivers i.e. xinclude Direct2D.pbi, Vector.pbi etc..
Macro drv_BeginLayer()
drv_Vec(drv_Vec_BeginLayer())
drv_D2D(drv_D2D_BeginLayer())
drv_Cairo(drv_Cairo_BeginLayer())
drv_AlexVG(drv_AlexVG_BeginLayer())
EndMacro
Macro drv_test()
drv_Vec(drv_Vec_test())
drv_D2D(drv_D2D_test())
drv_Cairo(drv_Cairo_test())
drv_AlexVG(drv_AlexVG_test())
EndMacro
Macro drv_test2()
drv_Vec(drv_Vec_test2())
drv_D2D(drv_D2D_test2())
drv_Cairo() ;drv_Cairo_test2()
drv_AlexVG(drv_AlexVG_test2())
EndMacro
;-
;- Top Level Procedures, xinclude Drivers.pbi
Procedure BeginLayer()
Debug "BeginLayer do generic stuff"
drv_BeginLayer()
Debug "BeginLayer cleanup generic stuff"
Debug ""
EndProcedure
Procedure test()
Debug "test do generic stuff"
drv_test()
Debug "test cleanup generic stuff"
Debug ""
EndProcedure
Procedure test2()
Debug "test2 do generic stuff"
drv_test2()
Debug "test2 cleanup generic stuff"
Debug ""
EndProcedure
BeginLayer()
test()
test2()