I know internally monogame uses if defines for different platforms. My question is as follows.
Is there a public Get accessor that will return for example DesktopGL or Windows (Dx) that i can call from within Game1 to return what monogame see's as the TargetPlatform internally ?
Recently i was asking about loading a .fx from a string. (Pumpkin Pudding had the answer)
I would like to wrap that up into a nice little codeblock that doesn't care if its open gl or dx under the hood and will switch on its own to compensate.
However to do so...
I need to add both dll's to my project which is fairly easy.
I also need to pass the correct target platform to the call.
In order to do that though... i need to detect the TargetPlatform programmatically before game load() finishes.
Here is a snippet of code to better illustrate the problem.
public Effect LoadFxFromString(GraphicsDevice gd, string fxcode)
string sourceFile = Directory.GetCurrentDirectory() + "/tmp.txt";
EffectImporter importer = new EffectImporter();
EffectContent content = importer.Import(sourceFile, null);
EffectProcessor processor = new EffectProcessor();
PipelineManager pm = new PipelineManager(string.Empty, string.Empty, string.Empty);
// ill need to detect the platform to pass the correct target
pm.Platform = TargetPlatform.Windows;
//pm.Platform = TargetPlatform.DesktopGL;
// ideally instead of the above.
// pm.Platform = this.CurrentlyRunningTargetPlatform;
pm.Profile = GraphicsProfile.HiDef;
PipelineProcessorContext ppc = new PipelineProcessorContext(pm, new PipelineBuildEvent());
CompiledEffectContent cecontent = processor.Process(content, ppc);
ContentCompiler compiler = new ContentCompiler();
return new Effect(gd, cecontent.GetEffectCode());
Essentially i need to know the TargetPlatform programatically.
Other wise ill have to constantly change this depending on the project template i make.
Instead of the return value allowing me to pass the target platform i need to use independently of which template i have selected for my project,
Which would be a little bit disappointing, however the above is very cool already.