Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

DemoBattleMode.cpp

Go to the documentation of this file.
00001 /*
00002 CS Senior Project 2003
00003 Team : Leftfield
00004 Project : ModernWarfare
00005 Members :
00006 - Russ Christensen              <rchriste@cs.utah.edu>
00007 - Todd Smith                    <tcsmith@cs.utah.edu>
00008 - Usit Duongsaa                 <duongsaa@cs.utah.edu>
00009 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00012 
00013 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
00014 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
00015 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00016 */
00017 
00023 #include "WinMainSelector.h"
00024 
00025 #ifdef COMPILE_DEMOBATTLE
00026 
00027 #include "..\AEngine\AEngine.h"
00028 #include "globals.h"
00029 #include "BattleEntry.h"
00030 
00031 using namespace Globals;
00032 
00033 BattleEntry *pBattle;
00034 FLOAT           screenSize;
00035 
00036 //------------------------------------------------------------------------------------
00037 void init()
00038 {       
00039         sys_showConsole(false); 
00040         Globals::artWork = new ArtWork();
00041         pBattle = NULL; 
00042         screenSize = 1.0f;
00043         sys_setSkipRate(0);
00044 }
00045 //------------------------------------------------------------------------------------
00046 void update()
00047 {
00048         if( input_isKeyPressed(KeyCodes::key_SPACE) && pBattle==NULL )
00049         {
00050                 pBattle = new BattleEntry( Colors::blue, Colors::black, Vec2D(0.0f,0.0f) );
00051 
00052                 pBattle->teamAGroups.push_back( Int2Tuple( UnitTypes::LIGHT_TANK, 30 ) );
00053                 pBattle->teamAGroups.push_back( Int2Tuple( UnitTypes::HEAVY_TANK, 16 ) );
00054                 pBattle->teamAGroups.push_back( Int2Tuple( UnitTypes::LAUNCHER, 24 ) );
00055                 pBattle->teamAGroups.push_back( Int2Tuple( UnitTypes::ARTILLERY, 18 ) );
00056 
00057                 pBattle->teamBGroups.push_back( Int2Tuple( UnitTypes::LIGHT_TANK, 30 ) );
00058                 pBattle->teamBGroups.push_back( Int2Tuple( UnitTypes::LIGHT_TANK, 30 ) );
00059 
00060                 screenSize = 0.01f;
00061         }
00062 
00063         if(pBattle)
00064         {
00065                 pBattle->input();
00066                 pBattle->update();
00067                 if(pBattle->isBattleFinished()) pBattle = NULL;
00068         }
00069 
00070         if(screenSize<1.0f) screenSize = (screenSize + 0.004f) * 1.025f;
00071         if(screenSize>1.0f) screenSize = 1.0f;
00072         camera_setScreenSize(screenSize);
00073 }
00074 //------------------------------------------------------------------------------------
00075 void render()
00076 {
00077         if(pBattle)
00078         {
00079                 pBattle->render();
00080         }
00081         else
00082         {
00083                 overlay_text() << "DemoBattleMode : Main" << endl;      
00084                 overlay_text() << "Press SpaceBar to Simulate a Battle" << endl;
00085                 overlay_textOut( Vec2D(0.0f,0.0f) );
00086         }
00087 }
00088 //------------------------------------------------------------------------------------
00089 INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR, INT )
00090 {
00091         sys_init(hInst,800,600,32,true);
00092         sys_setInitFunc(init);
00093         sys_setUpdateFunc(update);
00094         sys_setRenderFunc(render);
00095         sys_go();
00096         return 0;
00097 }
00098 //------------------------------------------------------------------------------------
00099 #endif

Generated on Wed Apr 23 05:50:15 2003 for Modern Warfare by doxygen1.3-rc2