| 61 | #include "extensions/olcPGEX_TransformedView.h" |
| 62 | |
| 63 | class Example : public olc::PixelGameEngine |
| 64 | { |
| 65 | public: |
| 66 | Example() |
| 67 | { |
| 68 | // Name your application |
| 69 | sAppName = "Example"; |
| 70 | } |
| 71 | |
| 72 | /* |
| 73 | |
| 74 | PLEASE NOTE! This is all an ill-thought through idea. I do not recommend you actually use this. |
| 75 | |
| 76 | */ |
| 77 | |
| 78 | // You need an instance of a shader object to apply pixel shading |
| 79 | olc::Shade shader; |
| 80 | |
| 81 | // Effects are the pixel shaders. They can be custom, or selected from a built in library |
| 82 | olc::Effect fxScanlines; |
| 83 | olc::Effect fxNormal; |
| 84 | olc::Effect fxBoxblur; |
| 85 | olc::Effect fxGreyscale; |
| 86 | olc::Effect fxThreshold; |
| 87 | olc::Effect fxSobel; |
| 88 | |
| 89 | // Pixel shading is all done in Decal land, so for this demo we render to several decals with |
| 90 | // different shading, and composite the result |
| 91 | olc::Renderable gfxNormalBouncers; |
| 92 | olc::Renderable gfxShadedBouncers; |
| 93 | olc::Renderable gfxTexture1; |
| 94 | olc::Renderable gfxTexture2; |
| 95 | |
| 96 | olc::Renderable gfxEffect1; |
| 97 | olc::Renderable gfxEffect2; |
| 98 | olc::Renderable gfxEffect3; |
| 99 | olc::Renderable gfxEffect4; |
| 100 | olc::Renderable gfxEffect5; |
| 101 | |
| 102 | |
| 103 | size_t nBouncers = 50; |
| 104 | std::vector<std::pair<olc::vf2d, olc::vf2d>> vBouncers; |
| 105 | |
| 106 | olc::TransformedView tv; |
| 107 | |
| 108 | |
| 109 | public: |
| 110 | bool OnUserCreate() override |
| 111 | { |
| 112 | // Transformed view is for panning and zooming |
| 113 | tv.Initialise({ ScreenWidth(), ScreenHeight() }, { 1.0f, 1.0f }); |
| 114 | |
| 115 | // These are decals, but created manually rather than from a file |
| 116 | gfxNormalBouncers.Create(ScreenWidth(), ScreenHeight()); |
| 117 | gfxShadedBouncers.Create(ScreenWidth(), ScreenHeight()); |
| 118 | gfxEffect1.Create(200, 200); |
| 119 | gfxEffect2.Create(200, 200); |
| 120 | gfxEffect3.Create(200, 200); |
nothing calls this directly
no outgoing calls
no test coverage detected