src/intro.c
author Tampax86
Thu, 17 Jul 2025 22:03:19 -0400
changeset 0 b2e3aa63e96c
permissions -rw-r--r--
First commit

/*
Copyright (c) 2023 MCL Software

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "intro.h"
#include "effects.h"

static int placesFromLeft = 0;
bool introInProgress = 0;
char introText[] = "It's the first week of September, 2021.\nYou started your freshman year at NH High School.\nA new trend has emerged on your favorite video sharing site\nin which people steal school property, including soap dispensers and masks.\n      \nYou decide to take part in the trend yourself.\n                Good luck.                \n                  ";
char introTextDisplayed[sizeof introText];


bool INTR_DrawIntro()
{
    if(introInProgress)
    {
        SDL_RenderClear(renderer);

        if(placesFromLeft != -1)
        {
            strncpy(introTextDisplayed, introText, placesFromLeft);
            placesFromLeft = ISOL_TypingEffect(sizeof introText);
        }

        FC_DrawAlign(font, renderer, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 3, FC_ALIGN_CENTER, "%s", introTextDisplayed);

        if(placesFromLeft == -1 && ISOL_FadeOut(10))
        {
            introInProgress = 0;
            return 1;
        }

        SDL_RenderPresent(renderer);
    }

    else
    {
        introInProgress = 1;

    }

    return 0;
}



void INTR_EndIntro()
{

}