/* Copyright (C) 2006 Parallel Realities This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "title.h" void drawTitle() { graphics->blit(textureManager->getTexture("backdrop"), graphics->screenMidX, graphics->screenMidY, true); graphics->blit(textureManager->getTexture("title"), graphics->screenMidX, 75, true); graphics->blit(textureManager->getTexture("episode2"), graphics->screenMidX, 130, true); graphics->blit(textureManager->getTexture("copyright"), 5, graphics->screen->h - 20, false); Texture *version = textureManager->getTexture("version"); graphics->blit(version, graphics->screen->w - version->iw - 5, graphics->screen->h - 20, false); } int doTitle() { newGame(); loadWidgets("data/widgets/title"); loadWidgets("data/widgets/inGameOptions"); loadWidgets("data/widgets/generalOptions"); loadWidgets("data/widgets/controlOptions");; loadWidgets("data/widgets/status"); loadWidgets("data/widgets/loadSave"); loadWidgets("data/widgets/gameover"); loadWidgets("data/widgets/cheats"); loadWidgets("data/widgets/additional"); loadWidgets("data/widgets/language"); audio->loadMusic("music/Helmet Shake.mod"); Texture *title = graphics->loadTexture("gfx/game/title.png"); textureManager->addTexture("title", title); Texture *backdrop = graphics->loadTexture("gfx/game/titleBack.png"); textureManager->addTexture("backdrop", backdrop); Texture *copyright = graphics->getGLString("Copyright Parallel Realities 2007"); textureManager->addTexture("copyright", copyright); Texture *version = graphics->getGLString("Version %.2f", VERSION); textureManager->addTexture("version", version); Texture *episode2 = graphics->loadTexture("gfx/game/episode2.png"); textureManager->addTexture("episode2", episode2); Button *newGame = (Button*)uiManager->getWidget("New", "titleWidgets"); Button *training = (Button*)uiManager->getWidget("Training", "titleWidgets"); Button *load = (Button*)uiManager->getWidget("Load", "titleWidgets"); Button *options = (Button*)uiManager->getWidget("Options", "titleWidgets"); Button *quit = (Button*)uiManager->getWidget("Quit", "titleWidgets"); uiManager->onlyShowGroup("titleWidgets"); Grid *grid = uiManager->getGrid("TitleGrid"); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); bool finished = false; mouse->setBusy(false); graphics->clearScreen(); audio->playMusic(); graphics->delay(1000, false); engine->resetTimeDifference(); game->inGame = false; int rtn = SECTION_TITLE; while (!finished) { engine->doTimeDifference(); engine->getInput(); graphics->updateScreen(); graphics->clearScreen(); graphics->setMode(MODE_2D); glColor3f(1.0, 1.0, 1.0); drawTitle(); graphics->fade(0.10, grid->x, grid->y, grid->width, grid->height); graphics->outlineRect(grid->x, grid->y, grid->width, grid->height, GLColor::lightGrey); drawWidgets(); if (newGame->wasClicked()) { rtn = SECTION_NEWGAME; finished = true; } if (training->wasClicked()) { rtn = SECTION_TRAINING; finished = true; } if (options->wasClicked()) { doConfigOptions(); mouse->setBusy(false); uiManager->onlyShowGroup("titleWidgets"); } if (load->wasClicked()) { if (loadGame()) { rtn = SECTION_LOAD; finished = true; } mouse->setBusy(false); uiManager->onlyShowGroup("titleWidgets"); } if (quit->wasClicked()) { exit(0); } } audio->stopMusic(); graphics->clearScreen(); if (rtn != SECTION_TITLE) { graphics->delay(1000, false); } else { graphics->delay(1, false); } return rtn; } int doCredits() { }