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
|
// SDL_App.cpp : Defines the entry point for our Project
//
//#include "stdafx.h"
#include <Windows.h>
#include "GL_Functions.h"
#include "pctimer.h"
#include <string>
#include <cmath>
#include <stdio.h>
#include <crtdbg.h>
enum STATE
{
MENU,
GAME,
INSTRUCTIONS,
HIGHSCORES,
EXIT
};
/*
bool statename
*/
bool Menu;
bool Game;
STATE currentstate;
void main(int argc, char* argv[])
{
//Opens the window with respective width and height
InitGL(1024, 768);
//The selectors texture load and X and Y values
int Select = LoadTexture("./images/select.png");
int SelectY = 278;
float Rot = 0;
////////////////////////////////
//MENU SWITCHING AND SUCH
{
currentstate = MENU;
bool bcontinueGame = true;
while (bcontinueGame)
{
switch(currentstate)
{
case MENU:
bcontinueGame = Menu;
case GAME:
bcontinueGame = Game;
case EXIT:
break;
default:
break;
};
}
}
//////////////////////////////////
do
{
//Clear Screen
ClearScreen();
//Headings and menu items
DrawString("PONG - The Game", 64, 64, 5.0f);
DrawString("1. Start Game", 64, 256, 3.0f);
DrawString("2. Instructions", 64, 384, 3.0f);
DrawString("3. High Scores", 64, 512, 3.0f);
DrawString("4. Exit", 64, 640, 3.0f);
//The selector
DrawSpriteRotated(Select, 32, SelectY, 32, 32, Rot += 200.0f);
//Moving the selector
if (IsKeyDown(KEY_DOWN))
{
SelectY = SelectY + 128;
}
if (SelectY > 700)
{
SelectY = 278;
}
if (IsKeyDown(KEY_UP))
{
SelectY = SelectY - 128;
}
if (SelectY < 255)
{
SelectY = 278;
}
//Slows the game
Sleep(75);
}
//Do some secret stuff
while (FrameworkUpdate());
//Clean up after yourself
FreeTexture(Select);
//Close down
CloseDown();
_CrtDumpMemoryLeaks();
}
|