1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
/*
File: Menu.h
Description: Menu management
Program: BlockOut
Author: Jean-Luc PONS
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.
*/
#include "MenuPage.h"
#include "PolyCube.h"
#include "MenuGrid.h"
#include "SetupManager.h"
#include "SoundManager.h"
#include "Http.h"
#define BLLETTER_NB 9
#define ANIMTIME 1.5f
class Menu {
public:
Menu();
// Initialise device objects
int Create(int width,int height);
// Set/Grt view matrix
void SetViewMatrix(GLfloat *mView);
GLfloat *GetViewMatrix();
// Render the menu
void Render();
// Release device objects
void InvalidateDeviceObjects();
// Process menu
int Process(BYTE *keys,float fTime);
// Set manager
void SetSetupManager(SetupManager *manager);
SetupManager *GetSetup();
void SetSoundManager(SoundManager *manager);
SoundManager *GetSound();
void SetHttp(Http *h);
Http *GetHttp();
// Ask full repaint
void FullRepaint();
// Menu page
void ToPage(MenuPage *page);
void ToPage(MenuPage *page,int iParam,void *wParam);
void RenderText(int x,int y,BOOL selected,char *text);
void RenderTitle(char *title);
PageMainMenu mainMenuPage;
PageStartGame startGamePage;
PageChooseSetup chooseSetupPage;
PageChangeSetup changeSetupPage;
PageHallOfFame hallOfFamePage;
PageHallOfFameOnLine hallOfFamePageOnLine;
PageOptions optionsPage;
PageGSOptions gsOptionsPage;
PageScoreDetails scoreDetailsPage;
PageControls controlsPage;
PageHttp httpPage;
PageCredits creditsPage;
// On-Line Logo
Sprite2D onlineLogo;
private:
void CreatePage() {
mainMenuPage.SetParent(this);
startGamePage.SetParent(this);
chooseSetupPage.SetParent(this);
changeSetupPage.SetParent(this);
hallOfFamePage.SetParent(this);
optionsPage.SetParent(this);
gsOptionsPage.SetParent(this);
scoreDetailsPage.SetParent(this);
controlsPage.SetParent(this);
httpPage.SetParent(this);
hallOfFamePageOnLine.SetParent(this);
creditsPage.SetParent(this);
};
void InitGraphics();
void ProcessAnim(float fTime);
int InitBlLetters();
void ResetAnim(float fTime);
void RenderChar(int x,int y,int w,int h,BOOL selected,char c);
// Viewport and transformation matrix
GLVIEWPORT menuView;
GLfloat matProj[16];
GLfloat matView[16];
// Menu grid
MenuGrid theGrid;
// Menu background and font
Sprite2D background;
Sprite2D background2;
Sprite2D font;
Sprite2D font2;
int wFont;
int hFont;
int scrWidth;
int scrHeight;
int fullRepaint;
// Menu selection
MenuPage *selPage;
// Setup
SetupManager *setupManager;
SoundManager *soundManager;
Http *http;
// Big Cube letters "BLOCKOUT"
PolyCube blLetters[BLLETTER_NB];
GLMatrix blOrgMatrix;
GLMatrix blMatrix[BLLETTER_NB];
VERTEX startPos[BLLETTER_NB];
VERTEX endPos[BLLETTER_NB];
BOOL isAdded[BLLETTER_NB];
BOOL isStarted[BLLETTER_NB];
BOOL animEnded;
BOOL menuEscaped;
// Time stamps
float startMenuTime;
};
|