summaryrefslogtreecommitdiffhomepage
path: root/games/wave_collector/screens
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-04-13 13:31:45 +0200
committerraysan5 <[email protected]>2020-04-13 13:31:45 +0200
commitfd5d1dfcb6d740728f21cdd08ba8387b0ee2f899 (patch)
tree6884674e4585aeef46346e0f8868b0e25c634efd /games/wave_collector/screens
parenteb04be8141c5e70f99d8104c44a61fb71779a55a (diff)
downloadraylib-fd5d1dfcb6d740728f21cdd08ba8387b0ee2f899.tar.gz
raylib-fd5d1dfcb6d740728f21cdd08ba8387b0ee2f899.zip
WARNING: REMOVED raylib/games - Moved to raysan5/raylib-games
Move raylib games to another repo. It will reduce repo size for new clones. I considered also removing the related history with [`git filter-repo`](https://github.com/newren/git-filter-repo) (the current sane alternative to the deprecated `filter-branch`) but it has some implications: It would had made a new repository with distinct history and checksums. If the repo was previously published, the history of the new one won't have been compatible with the history others have pulled.
Diffstat (limited to 'games/wave_collector/screens')
-rw-r--r--games/wave_collector/screens/screen_ending.c111
-rw-r--r--games/wave_collector/screens/screen_gameplay.c496
-rw-r--r--games/wave_collector/screens/screen_logo.c181
-rw-r--r--games/wave_collector/screens/screen_title.c112
-rw-r--r--games/wave_collector/screens/screens.h88
5 files changed, 0 insertions, 988 deletions
diff --git a/games/wave_collector/screens/screen_ending.c b/games/wave_collector/screens/screen_ending.c
deleted file mode 100644
index 7dc21965..00000000
--- a/games/wave_collector/screens/screen_ending.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/**********************************************************************************************
-*
-* raylib - Advance Game template
-*
-* Ending Screen Functions Definitions (Init, Update, Draw, Unload)
-*
-* Copyright (c) 2014 Ramon Santamaria (@raysan5)
-*
-* This software is provided "as-is", without any express or implied warranty. In no event
-* will the authors be held liable for any damages arising from the use of this software.
-*
-* Permission is granted to anyone to use this software for any purpose, including commercial
-* applications, and to alter it and redistribute it freely, subject to the following restrictions:
-*
-* 1. The origin of this software must not be misrepresented; you must not claim that you
-* wrote the original software. If you use this software in a product, an acknowledgment
-* in the product documentation would be appreciated but is not required.
-*
-* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
-* as being the original software.
-*
-* 3. This notice may not be removed or altered from any source distribution.
-*
-**********************************************************************************************/
-
-#include "raylib.h"
-#include "screens.h"
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition (local to this module)
-//----------------------------------------------------------------------------------
-
-// Ending screen global variables
-static int framesCounter;
-static int finishScreen;
-
-static Texture2D texBackground;
-static Texture2D texWin;
-static Texture2D texLose;
-static Texture2D texLogo;
-
-//----------------------------------------------------------------------------------
-// Ending Screen Functions Definition
-//----------------------------------------------------------------------------------
-
-// Ending Screen Initialization logic
-void InitEndingScreen(void)
-{
- // TODO: Initialize ENDING screen variables here!
- framesCounter = 0;
- finishScreen = 0;
-
- texBackground = LoadTexture("resources/textures/background.png");
- texWin = LoadTexture("resources/textures/win.png");
- texLose = LoadTexture("resources/textures/lose.png");
- texLogo = LoadTexture("resources/textures/logo_raylib.png");
-}
-
-// Ending Screen Update logic
-void UpdateEndingScreen(void)
-{
- // TODO: Update ENDING screen variables here!
- framesCounter++;
-
- // Press enter to return to TITLE screen
- if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
- {
- finishScreen = 1;
- }
-}
-
-// Ending Screen Draw logic
-void DrawEndingScreen(void)
-{
- DrawTexture(texBackground, 0, 0, WHITE);
-
- if (endingStatus == 1) // Win
- {
- DrawTexture(texWin, GetScreenWidth()/2 - texWin.width/2, 90, WHITE);
- DrawTextEx(font, "congrats, you got the wave!", (Vector2){ 200, 335 }, font.baseSize, 0, WHITE);
- }
- else if (endingStatus == 2) // Lose
- {
- DrawTexture(texLose, GetScreenWidth()/2 - texWin.width/2, 90, WHITE);
- DrawTextEx(font, "it seems you lose the wave...", (Vector2){ 205, 335 }, font.baseSize, 0, WHITE);
- }
-
- DrawRectangle(0, GetScreenHeight() - 70, 560, 40, Fade(RAYWHITE, 0.8f));
- DrawText("(c) Developed by Ramon Santamaria (@raysan5)", 36, GetScreenHeight() - 60, 20, DARKBLUE);
-
- DrawText("powered by", GetScreenWidth() - 162, GetScreenHeight() - 190, 20, DARKGRAY);
- DrawTexture(texLogo, GetScreenWidth() - 128 - 34, GetScreenHeight() - 128 - 36, WHITE);
-
- if ((framesCounter > 80) && ((framesCounter/40)%2)) DrawTextEx(font, "mouse click to return", (Vector2){ 300, 464 }, font.baseSize, 0, SKYBLUE);
-}
-
-// Ending Screen Unload logic
-void UnloadEndingScreen(void)
-{
- // TODO: Unload ENDING screen variables here!
- UnloadTexture(texBackground);
- UnloadTexture(texWin);
- UnloadTexture(texLose);
- UnloadTexture(texLogo);
-}
-
-// Ending Screen should finish?
-int FinishEndingScreen(void)
-{
- return finishScreen;
-} \ No newline at end of file
diff --git a/games/wave_collector/screens/screen_gameplay.c b/games/wave_collector/screens/screen_gameplay.c
deleted file mode 100644
index 1835c222..00000000
--- a/games/wave_collector/screens/screen_gameplay.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/**********************************************************************************************
-*
-* raylib - Advance Game template
-*
-* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
-*
-* Copyright (c) 2014 Ramon Santamaria (@raysan5)
-*
-* This software is provided "as-is", without any express or implied warranty. In no event
-* will the authors be held liable for any damages arising from the use of this software.
-*
-* Permission is granted to anyone to use this software for any purpose, including commercial
-* applications, and to alter it and redistribute it freely, subject to the following restrictions:
-*
-* 1. The origin of this software must not be misrepresented; you must not claim that you
-* wrote the original software. If you use this software in a product, an acknowledgment
-* in the product documentation would be appreciated but is not required.
-*
-* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
-* as being the original software.
-*
-* 3. This notice may not be removed or altered from any source distribution.
-*
-**********************************************************************************************/
-
-#include "raylib.h"
-#include "screens.h"
-
-#include <stdio.h>
-
-#include <stdlib.h> // Required for: malloc(), free()
-#include <math.h> // Required for: sqrtf(), asinf()
-
-#define MAX_SAMPLES_SPEED 7 // Max speed for samples movement
-#define MIN_SAMPLES_SPEED 3 // Min speed for samples movement
-#define SAMPLES_SPACING 100 // Separation between samples in pixels
-#define SAMPLES_MULTIPLIER 700 // Defines sample data scaling value (it would be adjusted to MAX_GAME_HEIGHT)
-#define MAX_GAME_HEIGHT 400 // Defines max possible amplitude between samples (game area)
-
-//----------------------------------------------------------------------------------
-// Types and Structures Definition
-//----------------------------------------------------------------------------------
-typedef struct Player {
- Vector2 position;
- Vector2 speed;
- int width;
- int height;
- Color color;
-} Player;
-
-typedef struct Sample {
- Vector2 position;
- float value; // Raw audio sample value (normalized)
- int radius;
- bool active; // Define if sample is active (can be collected)
- bool collected; // Define if sample has been collected
- bool renderable; // Define if sample should be rendered
- Color color;
-} Sample;
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition (local to this module)
-//----------------------------------------------------------------------------------
-
-// Gameplay screen global variables
-static int framesCounter;
-static int finishScreen;
-static bool pause;
-
-// Player variables
-static Player player;
-static Rectangle playerArea; // Define player movement area (and sample collection limits)
-
-static float warpCounter; // Time warp counter
-static float synchro; // Calculates collected samples relation [0..1]
-
-static int combo;
-static int maxCombo;
-
-static Rectangle waveRec;
-
-// Samples variables
-static Sample *samples; // Game samples
-static int totalSamples; // Total game samples (proportional to waveData num samples)
-static int collectedSamples; // Samples collected by player
-static int currentSample; // Last sample to go through player collect area
-static float samplesSpeed; // All samples move at the same speed
-static float waveTime; // Total sample time in ms
-
-// Resources variables
-static Texture2D texBackground;
-static Texture2D texPlayer;
-static Texture2D texSampleSmall;
-static Texture2D texSampleMid;
-static Texture2D texSampleBig;
-
-static RenderTexture2D waveTarget;
-
-static Sound fxSampleOn; // Collected sample sound
-static Sound fxSampleOff; // Miss sample sound
-static Sound fxPause; // Pause sound
-// Debug variables
-
-//------------------------------------------------------------------------------------
-// Module Functions Declaration (local)
-//------------------------------------------------------------------------------------
-static void DrawSamplesMap(Sample *samples, int sampleCount, int playedSamples, Rectangle bounds, Color color);
-
-//----------------------------------------------------------------------------------
-// Gameplay Screen Functions Definition
-//----------------------------------------------------------------------------------
-
-// Gameplay Screen Initialization logic
-void InitGameplayScreen(void)
-{
- framesCounter = 0;
- finishScreen = 0;
- pause = false;
- endingStatus = 0;
-
- // Textures loading
- texBackground = LoadTexture("resources/textures/background_gameplay.png");
- texPlayer = LoadTexture("resources/textures/player.png");
- texSampleSmall = LoadTexture("resources/textures/sample_small.png");
- texSampleMid = LoadTexture("resources/textures/sample_mid.png");
- texSampleBig = LoadTexture("resources/textures/sample_big.png");
-
- waveRec = (Rectangle){ 32, 32, 1280 - 64, 105 };
- waveTarget = LoadRenderTexture(waveRec.width, waveRec.height);
-
- // Sound loading
- fxSampleOn = LoadSound("resources/audio/sample_on.wav");
- fxSampleOff = LoadSound("resources/audio/sample_off.wav");
- fxPause = LoadSound("resources/audio/pause.wav");
-
- SetSoundVolume(fxSampleOn, 0.6f);
- SetSoundVolume(fxPause, 0.5f);
-
- // Initialize player data
- playerArea = (Rectangle){ 200, 160, 80, 400 };
-
- player.width = 20;
- player.height = 60;
- player.speed = (Vector2){ 15, 15 };
- player.color = GOLD;
- player.position = (Vector2){ playerArea.x + playerArea.width/2 - texPlayer.width/2,
- playerArea.y + playerArea.height/2 - texPlayer.height/2 };
-
- warpCounter = 395;
- synchro = 0.2f;
-
- combo = 0;
- maxCombo = 0;
-
- // Initialize wave and samples data
- Wave wave = LoadWave("resources/audio/wave.ogg");
- float *waveData = GetWaveData(wave); // TODO: Be careful with channels!
-
- // We calculate the required parameters to adjust audio time to gameplay time
- // that way samples collected correspond to audio playing
- // Synchonization is not perfect due to possible rounding issues (float to int)
- waveTime = wave.sampleCount/wave.sampleRate; // Total sample time in seconds
- float requiredSamples = (MAX_SAMPLES_SPEED*waveTime*60 - 1000)/SAMPLES_SPACING;
- int samplesDivision = (int)(wave.sampleCount/requiredSamples);
-
- totalSamples = wave.sampleCount/samplesDivision;
-
- // We don't need wave any more (already got waveData)
- UnloadWave(wave);
-
- collectedSamples = 0;
-
- // Init samples
- samples = (Sample *)malloc(totalSamples*sizeof(Sample));
-
- // Normalize wave data (min vs max values) to scale properly
- float minSampleValue = 0.0f;
- float maxSampleValue = 0.0f;
-
- for (int i = 0; i < totalSamples; i++)
- {
- if (waveData[i*samplesDivision] < minSampleValue) minSampleValue = waveData[i*samplesDivision];
- if (waveData[i*samplesDivision] > maxSampleValue) maxSampleValue = waveData[i*samplesDivision];
- }
-
- float sampleScaleFactor = 1.0f/(maxSampleValue - minSampleValue); // 400 pixels maximum size
-
- // Initialize samples
- for (int i = 0; i < totalSamples; i++)
- {
- samples[i].value = waveData[i*samplesDivision]*sampleScaleFactor; // Normalized value [-1.0..1.0]
- samples[i].position.x = player.position.x + 1000 + i*SAMPLES_SPACING;
-
- samples[i].position.y = GetScreenHeight()/2 + samples[i].value*SAMPLES_MULTIPLIER;
-
- if (samples[i].position.y > GetScreenHeight()/2 + MAX_GAME_HEIGHT/2) samples[i].position.y = GetScreenHeight()/2 - MAX_GAME_HEIGHT/2;
- else if (samples[i].position.y < GetScreenHeight()/2 - MAX_GAME_HEIGHT/2) samples[i].position.y = GetScreenHeight()/2 + MAX_GAME_HEIGHT/2;
-
- samples[i].radius = 6;
- samples[i].active = true;
- samples[i].collected = false;
- samples[i].color = RED;
- samples[i].renderable = false;
- }
-
- samplesSpeed = MAX_SAMPLES_SPEED;
- currentSample = 0;
-
- //FILE *samplesFile = fopen("resources/samples.data", "wb");
- //fwrite(samples, totalSamples*sizeof(Sample), 1, samplesFile);
- //fclose(samplesFile);
-
- // We already saved the samples we needed for the game, we can free waveData
- free(waveData);
-
- // Load and start playing music
- // NOTE: Music is loaded in main code base
- StopMusicStream(music);
- PlayMusicStream(music);
-}
-
-// Gameplay Screen Update logic
-void UpdateGameplayScreen(void)
-{
- if (IsKeyPressed('P'))
- {
- PlaySound(fxPause);
- pause = !pause;
-
- if (pause) PauseMusicStream(music);
- else ResumeMusicStream(music);
- }
-
- if (!pause)
- {
- framesCounter++; // Time starts counting to awake enemies
-
- // Player movement logic (mouse)
- player.position.y = GetMousePosition().y;
-
- // Player movement logic (keyboard)
- if (IsKeyDown(KEY_W)) player.position.y -= player.speed.y;
- else if (IsKeyDown(KEY_S)) player.position.y += player.speed.y;
-
- // Player movement logic (gamepad)
- /*
- if (IsGamepadAvailable(GAMEPAD_PLAYER1))
- {
- Vector2 movement = { 0.0f };
-
- movement.x = GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_X);
- movement.y = GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_Y);
-
- player.position.x += movement.x*0.1f; // Scale gamepad movement value
- player.position.y += movement.y*0.1f; // Scale gamepad movement value
- }
- */
-
- // Player logic: check player area limits
- if (player.position.x < playerArea.x) player.position.x = playerArea.x;
- else if ((player.position.x + player.width) > (playerArea.x + playerArea.width)) player.position.x = playerArea.x + playerArea.width - player.width;
-
- if (player.position.y < playerArea.y) player.position.y = playerArea.y;
- else if ((player.position.y + player.height) > (playerArea.y + playerArea.height)) player.position.y = playerArea.y + playerArea.height - player.height;
-
- // Samples logic
- for (int i = 0; i < totalSamples; i++)
- {
- // Samples movement logic
- samples[i].position.x -= samplesSpeed;
-
- if (((samples[i].position.x + samples[i].radius) > -SAMPLES_SPACING) &&
- ((samples[i].position.x - samples[i].radius) < GetScreenWidth())) samples[i].renderable = true;
- else samples[i].renderable = false;
-
- // Samples catch logic
- if (!samples[i].collected && CheckCollisionCircleRec(samples[i].position, samples[i].radius, (Rectangle){ (int)player.position.x, (int)player.position.y, player.width, player.height }))
- {
- samples[i].collected = true;
- collectedSamples++;
- synchro += 0.02;
-
- combo++;
- if (combo > maxCombo) maxCombo = combo;
-
- if (synchro >= 1.0f) synchro = 1.0f;
-
- // Set sound pitch depending on sample position (base pitch: 1.0f)
- // NOTE: waveData[i*WAVE_SAMPLES_DIV] is scaled to [0.3..1.7]
- SetSoundPitch(fxSampleOn, samples[i].value*1.4f + 0.7f);
-
- PlaySound(fxSampleOn);
- }
-
- if ((samples[i].position.x - samples[i].radius) < player.position.x)
- {
- currentSample = i; // Register last sample going out range
-
- if (samples[i].active)
- {
- samples[i].active = false;
-
- if (!samples[i].collected)
- {
- synchro -= 0.05f;
- PlaySound(fxSampleOff);
- combo = 0;
- }
- }
- }
- }
-
- if (IsKeyDown(KEY_SPACE) && (warpCounter > 0))
- {
- warpCounter--;
- if (warpCounter < 0) warpCounter = 0;
-
- samplesSpeed -= 0.1f;
- if (samplesSpeed <= MIN_SAMPLES_SPEED) samplesSpeed = MIN_SAMPLES_SPEED;
-
- SetMusicPitch(music, samplesSpeed/MAX_SAMPLES_SPEED);
- }
- else
- {
- warpCounter++;
- if (warpCounter > 395) warpCounter = 395;
-
- samplesSpeed += 0.1f;
- if (samplesSpeed >= MAX_SAMPLES_SPEED) samplesSpeed = MAX_SAMPLES_SPEED;
-
- SetMusicPitch(music, samplesSpeed/MAX_SAMPLES_SPEED);
- }
-
- // Check ending conditions
- if (currentSample >= totalSamples - 1)
- {
- endingStatus = 1; // Win
- finishScreen = 1;
- }
-
- if (synchro <= 0.0f)
- {
- synchro = 0.0f;
- endingStatus = 2; // Loose
- finishScreen = 1;
- }
- }
-}
-
-// Gameplay Screen Draw logic
-void DrawGameplayScreen(void)
-{
- // Draw background
- DrawTexture(texBackground, 0, 0, WHITE);
-
- // Screen elements drawing
- //DrawRectangleLines(playerArea.x, playerArea.y, playerArea.width, playerArea.height, BLUE);
- DrawRectangle(0, GetScreenHeight()/2 - 1, GetScreenWidth(), 2, Fade(BLUE, 0.3f));
- //DrawRectangleLines(0, GetScreenHeight()/2 - MAX_GAME_HEIGHT/2, GetScreenWidth(), MAX_GAME_HEIGHT, GRAY);
-
- // Draw samples
- for (int i = 0; i < totalSamples - 1; i++)
- {
- if (samples[i].renderable)
- {
- Color col = samples[i].color;
-
- if (i < (currentSample + 1)) col = Fade(DARKGRAY, 0.5f);
- else col = WHITE;
-
- if (!samples[i].collected)
- {
- //DrawCircleV(samples[i].position, samples[i].radius, col);
-
- if (combo > 30) DrawTexture(texSampleSmall, samples[i].position.x - texSampleSmall.width/2, samples[i].position.y - texSampleSmall.height/2, col);
- else if (combo > 15) DrawTexture(texSampleMid, samples[i].position.x - texSampleMid.width/2, samples[i].position.y - texSampleMid.height/2, col);
- else DrawTexture(texSampleBig, samples[i].position.x - texSampleBig.width/2, samples[i].position.y - texSampleBig.height/2, col);
- }
-
- if (i < (currentSample + 1)) col = Fade(GRAY, 0.3f);
- else col = Fade(RED, 0.5f);
-
- // Draw line between samples
- DrawLineEx(samples[i].position, samples[i + 1].position, 3.0f, col);
- }
- }
-
- // Draw player
- //DrawRectangle((int)player.position.x, (int)player.position.y, player.width, player.height, player.color);
- DrawTexture(texPlayer, player.position.x - 32, player.position.y - 24, WHITE);
-
- // Draw pause message
- if (pause) DrawTextEx(font, "WAVE PAUSED", (Vector2){ 235, 400 }, font.baseSize*2, 0, WHITE);
-
- // Draw number of samples
- //DrawText(FormatText("%05i", collectedSamples), 900, 200, 40, GRAY);
- //DrawText(FormatText("%05i", totalSamples), 900, 250, 40, GRAY);
- DrawTextEx(font, FormatText("%05i / %05i", collectedSamples, totalSamples), (Vector2){810, 170}, font.baseSize, -2, SKYBLUE);
-
- // Draw combo
- DrawTextEx(font, FormatText("Combo: %02i [max: %02i]", combo, maxCombo), (Vector2){200, 170}, font.baseSize/2, -2, SKYBLUE);
-
- // Draw synchonicity level
- DrawRectangle(99, 622, 395, 32, Fade(RAYWHITE, 0.8f));
-
- if (synchro <= 0.3f) DrawRectangle(99, 622, synchro*395, 32, Fade(RED, 0.8f));
- else if (synchro <= 0.8f) DrawRectangle(99, 622, synchro*395, 32, Fade(ORANGE,0.8f));
- else if (synchro < 1.0f) DrawRectangle(99, 622, synchro*395, 32, Fade(LIME,0.8f));
- else DrawRectangle(99, 622, synchro*395, 32, Fade(GREEN, 0.9f));
-
- DrawRectangleLines(99, 622, 395, 32, MAROON);
-
- if (synchro == 1.0f) DrawTextEx(font, FormatText("%02i%%", (int)(synchro*100)), (Vector2){99 + 390, 600}, font.baseSize, -2, GREEN);
- else DrawTextEx(font, FormatText("%02i%%", (int)(synchro*100)), (Vector2){99 + 390, 600}, font.baseSize, -2, SKYBLUE);
-
- // Draw time warp coool-down bar
- DrawRectangle(754, 622, 395, 32, Fade(RAYWHITE, 0.8f));
- DrawRectangle(754, 622, warpCounter, 32, Fade(SKYBLUE, 0.8f));
- DrawRectangleLines(754, 622, 395, 32, DARKGRAY);
- //DrawText(FormatText("%02i%%", (int)(synchro*100)), 754 + 410, 628, 20, DARKGRAY);
- DrawTextEx(font, FormatText("%02i%%", (int)((float)warpCounter/395.0f*100.0f)), (Vector2){754 + 390, 600}, font.baseSize, -2, SKYBLUE);
-
- // Draw wave
- 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
- BeginTextureMode(waveTarget);
- ClearBackground(BLANK);
- 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
-void UnloadGameplayScreen(void)
-{
- StopMusicStream(music);
-
- // Unload textures
- UnloadTexture(texBackground);
- UnloadTexture(texPlayer);
- UnloadTexture(texSampleSmall);
- UnloadTexture(texSampleMid);
- UnloadTexture(texSampleBig);
-
- UnloadRenderTexture(waveTarget);
-
- // Unload sounds
- UnloadSound(fxSampleOn);
- UnloadSound(fxSampleOff);
- UnloadSound(fxPause);
-
- free(samples); // Unload game samples
-}
-
-// Gameplay Screen should finish?
-int FinishGameplayScreen(void)
-{
- return finishScreen;
-}
-
-//------------------------------------------------------------------------------------
-// Module Functions Definitions (local)
-//------------------------------------------------------------------------------------
-
-// Draw samples in wave form (including already played samples in a different color!)
-// NOTE: For proper visualization, MSAA x4 is recommended, alternatively
-// it should be rendered to a bigger texture and then scaled down with
-// bilinear/trilinear texture filtering
-static void DrawSamplesMap(Sample *samples, int sampleCount, int playedSamples, Rectangle bounds, Color color)
-{
- // NOTE: We just pick a sample to draw every increment
- float sampleIncrementX = (float)bounds.width/sampleCount;
-
- Color col = color;
-
- for (int i = 0; i < sampleCount - 1; i++)
- {
- if (i < playedSamples) col = GRAY;
- else col = color;
-
- DrawLineV((Vector2){ (float)bounds.x + (float)i*sampleIncrementX, (float)(bounds.y + bounds.height/2) + samples[i].value*bounds.height },
- (Vector2){ (float)bounds.x + (float)(i + 1)*sampleIncrementX, (float)(bounds.y + bounds.height/2) + + samples[i + 1].value*bounds.height }, col);
- }
-} \ No newline at end of file
diff --git a/games/wave_collector/screens/screen_logo.c b/games/wave_collector/screens/screen_logo.c
deleted file mode 100644
index 5f18a321..00000000
--- a/games/wave_collector/screens/screen_logo.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/**********************************************************************************************
-*
-* raylib - Advance Game template
-*
-* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
-*
-* Copyright (c) 2014 Ramon Santamaria (@raysan5)
-*
-* This software is provided "as-is", without any express or implied warranty. In no event
-* will the authors be held liable for any damages arising from the use of this software.
-*
-* Permission is granted to anyone to use this software for any purpose, including commercial
-* applications, and to alter it and redistribute it freely, subject to the following restrictions:
-*
-* 1. The origin of this software must not be misrepresented; you must not claim that you
-* wrote the original software. If you use this software in a product, an acknowledgment
-* in the product documentation would be appreciated but is not required.
-*
-* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
-* as being the original software.
-*
-* 3. This notice may not be removed or altered from any source distribution.
-*
-**********************************************************************************************/
-
-#include "raylib.h"
-#include "screens.h"
-
-#define LOGO_RECS_SIDE 16
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition (local to this module)
-//----------------------------------------------------------------------------------
-
-// Logo screen global variables
-static int framesCounter;
-static int finishScreen;
-
-static int logoPositionX;
-static int logoPositionY;
-
-static int lettersCount;
-
-static int topSideRecWidth;
-static int leftSideRecHeight;
-
-static int bottomSideRecWidth;
-static int rightSideRecHeight;
-
-static int state; // Tracking animation states (State Machine)
-static float alpha = 1.0f; // Useful for fading
-
-//----------------------------------------------------------------------------------
-// Logo Screen Functions Definition
-//----------------------------------------------------------------------------------
-
-// Logo Screen Initialization logic
-void InitLogoScreen(void)
-{
- // Initialize LOGO screen variables here!
- finishScreen = 0;
- framesCounter = 0;
- lettersCount = 0;
-
- logoPositionX = GetScreenWidth()/2 - 128;
- logoPositionY = GetScreenHeight()/2 - 128;
-
- topSideRecWidth = LOGO_RECS_SIDE;
- leftSideRecHeight = LOGO_RECS_SIDE;
- bottomSideRecWidth = LOGO_RECS_SIDE;
- rightSideRecHeight = LOGO_RECS_SIDE;
-
- state = 0;
- alpha = 1.0f;
-}
-
-// Logo Screen Update logic
-void UpdateLogoScreen(void)
-{
- // Update LOGO screen variables here!
- if (state == 0) // State 0: Small box blinking
- {
- framesCounter++;
-
- if (framesCounter == 80)
- {
- state = 1;
- framesCounter = 0; // Reset counter... will be used later...
-
- PlayMusicStream(music); // Start playing music... ;)
- }
- }
- else if (state == 1) // State 1: Top and left bars growing
- {
- topSideRecWidth += 8;
- leftSideRecHeight += 8;
-
- if (topSideRecWidth == 256) state = 2;
- }
- else if (state == 2) // State 2: Bottom and right bars growing
- {
- bottomSideRecWidth += 8;
- rightSideRecHeight += 8;
-
- if (bottomSideRecWidth == 256) state = 3;
- }
- else if (state == 3) // State 3: Letters appearing (one by one)
- {
- framesCounter++;
-
- if (lettersCount < 10)
- {
- if (framesCounter/15) // Every 12 frames, one more letter!
- {
- lettersCount++;
- framesCounter = 0;
- }
- }
- else // When all letters have appeared, just fade out everything
- {
- if (framesCounter > 200)
- {
- alpha -= 0.02f;
-
- if (alpha <= 0.0f)
- {
- alpha = 0.0f;
- finishScreen = 1;
- }
- }
- }
- }
-}
-
-// Logo Screen Draw logic
-void DrawLogoScreen(void)
-{
- if (state == 0)
- {
- if ((framesCounter/10)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK);
- }
- else if (state == 1)
- {
- DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
- DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
- }
- else if (state == 2)
- {
- DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
- DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
-
- DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK);
- DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK);
- }
- else if (state == 3)
- {
- DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha));
- DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha));
-
- DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha));
- DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha));
-
- DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, Fade(RAYWHITE, alpha));
-
- DrawText(SubText("raylib", 0, lettersCount), GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha));
-
- if (framesCounter > 20) DrawText("powered by", logoPositionX, logoPositionY - 27, 20, Fade(DARKGRAY, alpha));
- }
-}
-
-// Logo Screen Unload logic
-void UnloadLogoScreen(void)
-{
- // Unload LOGO screen variables here!
-}
-
-// Logo Screen should finish?
-int FinishLogoScreen(void)
-{
- return finishScreen;
-} \ No newline at end of file
diff --git a/games/wave_collector/screens/screen_title.c b/games/wave_collector/screens/screen_title.c
deleted file mode 100644
index 5c414f4f..00000000
--- a/games/wave_collector/screens/screen_title.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/**********************************************************************************************
-*
-* raylib - Advance Game template
-*
-* Title Screen Functions Definitions (Init, Update, Draw, Unload)
-*
-* Copyright (c) 2014 Ramon Santamaria (@raysan5)
-*
-* This software is provided "as-is", without any express or implied warranty. In no event
-* will the authors be held liable for any damages arising from the use of this software.
-*
-* Permission is granted to anyone to use this software for any purpose, including commercial
-* applications, and to alter it and redistribute it freely, subject to the following restrictions:
-*
-* 1. The origin of this software must not be misrepresented; you must not claim that you
-* wrote the original software. If you use this software in a product, an acknowledgment
-* in the product documentation would be appreciated but is not required.
-*
-* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
-* as being the original software.
-*
-* 3. This notice may not be removed or altered from any source distribution.
-*
-**********************************************************************************************/
-
-#include "raylib.h"
-#include "screens.h"
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition (local to this module)
-//----------------------------------------------------------------------------------
-
-// Title screen global variables
-static int framesCounter;
-static int finishScreen;
-
-static Texture2D texBackground;
-static Texture2D texTitle;
-static Texture2D texLogo;
-
-static float titleAlpha = 0.0f;
-
-static Sound fxStart;
-
-//----------------------------------------------------------------------------------
-// Title Screen Functions Definition
-//----------------------------------------------------------------------------------
-
-// Title Screen Initialization logic
-void InitTitleScreen(void)
-{
- // Initialize TITLE screen variables here!
- framesCounter = 0;
- finishScreen = 0;
-
- texBackground = LoadTexture("resources/textures/background_title.png");
- texTitle = LoadTexture("resources/textures/title.png");
- texLogo = LoadTexture("resources/textures/logo_raylib.png");
-
- fxStart = LoadSound("resources/audio/start.wav");
-}
-
-// Title Screen Update logic
-void UpdateTitleScreen(void)
-{
- // Update TITLE screen variables here!
- framesCounter++;
-
- titleAlpha += 0.005f;
-
- if (titleAlpha >= 1.0f) titleAlpha = 1.0f;
-
- // Press enter to change to ATTIC screen
- if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
- {
- PlaySound(fxStart);
- StopMusicStream(music);
- finishScreen = 1;
- }
-}
-
-// Title Screen Draw logic
-void DrawTitleScreen(void)
-{
- DrawTexture(texBackground, 0, 0, WHITE);
- DrawTexture(texTitle, GetScreenWidth()/2 - texTitle.width/2, -25, Fade(WHITE, titleAlpha));
-
- DrawRectangle(0, GetScreenHeight() - 70, 560, 40, Fade(RAYWHITE, 0.8f));
- DrawText("(c) Developed by Ramon Santamaria (@raysan5)", 36, GetScreenHeight() - 60, 20, DARKBLUE);
-
- DrawText("powered by", GetScreenWidth() - 162, GetScreenHeight() - 190, 20, DARKGRAY);
- DrawTexture(texLogo, GetScreenWidth() - 128 - 34, GetScreenHeight() - 128 - 36, WHITE);
-
- if ((framesCounter > 160) && ((framesCounter/40)%2)) DrawTextEx(font, "mouse click to start", (Vector2){ 325, 500 }, font.baseSize, 0, SKYBLUE);
-}
-
-// Title Screen Unload logic
-void UnloadTitleScreen(void)
-{
- // Unload TITLE screen variables here!
- UnloadTexture(texBackground);
- UnloadTexture(texTitle);
- UnloadTexture(texLogo);
-
- UnloadSound(fxStart);
-}
-
-// Title Screen should finish?
-int FinishTitleScreen(void)
-{
- return finishScreen;
-} \ No newline at end of file
diff --git a/games/wave_collector/screens/screens.h b/games/wave_collector/screens/screens.h
deleted file mode 100644
index 6e896d58..00000000
--- a/games/wave_collector/screens/screens.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**********************************************************************************************
-*
-* raylib - Advance Game template
-*
-* Screens Functions Declarations (Init, Update, Draw, Unload)
-*
-* Copyright (c) 2014 Ramon Santamaria (@raysan5)
-*
-* This software is provided "as-is", without any express or implied warranty. In no event
-* will the authors be held liable for any damages arising from the use of this software.
-*
-* Permission is granted to anyone to use this software for any purpose, including commercial
-* applications, and to alter it and redistribute it freely, subject to the following restrictions:
-*
-* 1. The origin of this software must not be misrepresented; you must not claim that you
-* wrote the original software. If you use this software in a product, an acknowledgment
-* in the product documentation would be appreciated but is not required.
-*
-* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
-* as being the original software.
-*
-* 3. This notice may not be removed or altered from any source distribution.
-*
-**********************************************************************************************/
-
-#ifndef SCREENS_H
-#define SCREENS_H
-
-//----------------------------------------------------------------------------------
-// Types and Structures Definition
-//----------------------------------------------------------------------------------
-typedef enum GameScreen { LOGO = 0, TITLE, GAMEPLAY, ENDING } GameScreen;
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition
-//----------------------------------------------------------------------------------
-GameScreen currentScreen;
-Font font;
-Music music;
-int endingStatus; // 1 - Win, 2 - Lose
-
-char *sampleFilename; // Required for custom music file
-
-#ifdef __cplusplus
-extern "C" { // Prevents name mangling of functions
-#endif
-
-//----------------------------------------------------------------------------------
-// Logo Screen Functions Declaration
-//----------------------------------------------------------------------------------
-void InitLogoScreen(void);
-void UpdateLogoScreen(void);
-void DrawLogoScreen(void);
-void UnloadLogoScreen(void);
-int FinishLogoScreen(void);
-
-//----------------------------------------------------------------------------------
-// Title Screen Functions Declaration
-//----------------------------------------------------------------------------------
-void InitTitleScreen(void);
-void UpdateTitleScreen(void);
-void DrawTitleScreen(void);
-void UnloadTitleScreen(void);
-int FinishTitleScreen(void);
-
-//----------------------------------------------------------------------------------
-// Gameplay Screen Functions Declaration
-//----------------------------------------------------------------------------------
-void InitGameplayScreen(void);
-void UpdateGameplayScreen(void);
-void DrawGameplayScreen(void);
-void UnloadGameplayScreen(void);
-int FinishGameplayScreen(void);
-
-//----------------------------------------------------------------------------------
-// Ending Screen Functions Declaration
-//----------------------------------------------------------------------------------
-void InitEndingScreen(void);
-void UpdateEndingScreen(void);
-void DrawEndingScreen(void);
-void UnloadEndingScreen(void);
-int FinishEndingScreen(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SCREENS_H \ No newline at end of file