impworks / corund

2D game engine for mobile devices in C#.
MIT License
17 stars 1 forks source link

Platform-specific shaders #8

Closed impworks closed 7 years ago

impworks commented 7 years ago

The way shaders are built differs across platforms. Therefore, we need the following structure:

Two assemblies are currently set up: Corund.Effects.WP8 and Corund.Effects.Android. The actual shader code resides in the Corund.Effects folder.

The trouble is that PCL does not support ResourceManager.GetObject to get raw byte arrays. Only GetString is supported. Therefore, the built *.xnb must be encoded and decoded via Base64.

ForNeVeR commented 7 years ago

Have you tried to access the shader without ResourceManager as an embedded resource via e.g. typeof(BlurShader).GetTypeInfo().Assembly.GetManifestResourceStream("blur.xnb")? I think it should work even in PCL.

impworks commented 7 years ago

Will give it a go.

impworks commented 7 years ago

Worked for WP8, will probably work for other platforms too!