| 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); |
| 121 | gfxEffect4.Create(200, 200); |
| 122 | gfxEffect5.Create(200, 200); |
| 123 | |
| 124 | // This decal uses a graphic - you'll need your own |
| 125 | gfxTexture2.Load("E:\\work\\repos\\OneLoneCoder\\olcProjects2\\DEMO_Quad3D\\assets\\Baby.png"); |
| 126 | |
| 127 | // All of these effects "pixel shaders" are built-in. You can easily define your own EffectConfig |
| 128 | fxScanlines = shader.MakeEffect(olc::fx::FX_SCANLINE); |
| 129 | fxNormal = shader.MakeEffect(olc::fx::FX_NORMAL); |
| 130 | fxBoxblur = shader.MakeEffect(olc::fx::FX_BOXBLUR); |
| 131 | fxGreyscale = shader.MakeEffect(olc::fx::FX_GREYSCALE); |
| 132 | fxThreshold = shader.MakeEffect(olc::fx::FX_THRESHOLD); |
| 133 | fxSobel = shader.MakeEffect(olc::fx::FX_SOBEL); |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | vBouncers.resize(nBouncers); |
| 140 | for (size_t i = 0; i < nBouncers; i++) |
| 141 | { |
| 142 | float a = (float(rand()) / float(RAND_MAX)) * 2.0f * 3.14159f; |
| 143 | |
| 144 | vBouncers[i] = |
| 145 | std::make_pair<olc::vf2d, olc::vf2d>( |
| 146 | { float(rand() % (ScreenWidth() - gfxTexture2.Sprite()->width)) + 100, float(rand() % (ScreenHeight() - gfxTexture2.Sprite()->height)) + 100 }, |
| 147 | { cos(a), sin(a) }); |
| 148 | } |
| 149 | |
| 150 | return true; |
| 151 | } |
| 152 | |
| 153 | bool OnUserUpdate(float fElapsedTime) override |
| 154 | { |
nothing calls this directly
no test coverage detected