diff options
| author | raysan5 <raysan5@gmail.com> | 2017-08-04 18:56:36 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2017-08-04 18:56:36 +0200 |
| commit | ae35c37c8a98a0413ae525719bbbdee53dfcc86d (patch) | |
| tree | a23ed9a9cc88b6f245908c9f080187dfbe99b684 | |
| parent | eeca607506b22f154a7b31ef8308d3ecd30ad383 (diff) | |
| download | raylib-ae35c37c8a98a0413ae525719bbbdee53dfcc86d.tar.gz raylib-ae35c37c8a98a0413ae525719bbbdee53dfcc86d.zip | |
Corrected game to run on OpenGL 1.1
| -rw-r--r-- | games/wave_collector/screens/screen_gameplay.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/games/wave_collector/screens/screen_gameplay.c b/games/wave_collector/screens/screen_gameplay.c index 73b3f435..6d82d72e 100644 --- a/games/wave_collector/screens/screen_gameplay.c +++ b/games/wave_collector/screens/screen_gameplay.c @@ -421,21 +421,25 @@ void DrawGameplayScreen(void) DrawTextEx(font, FormatText("%02i%%", (int)((float)warpCounter/395.0f*100.0f)), (Vector2){754 + 390, 600}, font.baseSize, -2, SKYBLUE); // Draw wave - // NOTE: Old drawing method, replaced by rendertarget - //DrawSamplesMap(samples, totalSamples, currentSample, waveRec, MAROON); - //DrawRectangle(waveRec.x + (int)currentSample*1240/totalSamples, waveRec.y, 2, 99, DARKGRAY); - //DrawRectangleLines(20, 20, 1240, 140, DARKGRAY); - //DrawRectangle(20, 150, (float)currentSample/totalSamples*1240, 10, GRAY); - - // Draw wave using render target - ClearBackground(BLANK); - BeginTextureMode(waveTarget); - DrawSamplesMap(samples, totalSamples, currentSample, (Rectangle){ 0, 0, waveTarget.texture.width, waveTarget.texture.height }, MAROON); - EndTextureMode(); - - // TODO: Apply antialiasing shader - DrawTextureEx(waveTarget.texture, (Vector2){ waveRec.x, waveRec.y }, 0.0f, 1.0f, WHITE); - DrawRectangle(waveRec.x + (int)currentSample*1215/totalSamples, waveRec.y, 2, 99, DARKGRAY); + if (waveTarget.texture.id <= 0) // Render target could not be loaded (OpenGL 1.1) + { + // Draw wave directly on screen + DrawSamplesMap(samples, totalSamples, currentSample, waveRec, MAROON); + DrawRectangle(waveRec.x + (int)currentSample*1215/totalSamples, waveRec.y, 2, 99, DARKGRAY); + } + else + { + // Draw wave using render target + ClearBackground(BLANK); + BeginTextureMode(waveTarget); + DrawSamplesMap(samples, totalSamples, currentSample, (Rectangle){ 0, 0, waveTarget.texture.width, waveTarget.texture.height }, MAROON); + EndTextureMode(); + + // TODO: Apply antialiasing shader + + DrawTextureEx(waveTarget.texture, (Vector2){ waveRec.x, waveRec.y }, 0.0f, 1.0f, WHITE); + DrawRectangle(waveRec.x + (int)currentSample*1215/totalSamples, waveRec.y, 2, 99, DARKGRAY); + } } // Gameplay Screen Unload logic |
