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

MainMenu.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 
00018 
00023 #include "Network.h"
00024 #include "GameConfig.h"
00025 #include "EconData.h"
00026 #include "BattleUnitData.h"
00027 #include "Sound.h"
00028 #include "Typer.h"
00029 #include "..\AEngine\AEngine.h"
00030 #include "Overhead.h"
00031 #include "MainFuncs.h"
00032 
00033 using namespace Overhead;
00034 
00035 
00036 //------------------------------------------------------------------------------------
00037 
00038 Box butMainSinglePLayer( 0.365f, 0.496f, 0.620f, 0.580f );              // main menu
00039 Box butMainMultiPlayer ( 0.365f, 0.601f, 0.620f, 0.680f );
00040 Box butMainCredit      ( 0.365f, 0.701f, 0.620f, 0.780f );
00041 Box butMainExit        ( 0.365f, 0.799f, 0.620f, 0.880f );
00042 
00043 //------------------------------------------------------------------------------------
00044 void switchToMainMenu()
00045 {
00046         mode = MainModes::mainMenu;
00047 }
00048 //------------------------------------------------------------------------------------
00049 void updateMainMenu()
00050 {
00051         Vec2D mouse( input_getMouseX(), input_getMouseY() );
00052         if( input_isMouseLBClicked() )
00053         {
00054                 if( butMainSinglePLayer.isContain(mouse) )
00055                 {
00056                         net_runAsFakeServer("Fake Server Player",8);
00057                         overhead_init();                                // switch to overhead
00058                         mode = MainModes::overhead;
00059                 }
00060                 if( butMainMultiPlayer.isContain(mouse) )       switchToMultiplayMenu();
00061                 if( butMainCredit.isContain(mouse) )            switchToCredit();
00062                 if( butMainExit.isContain(mouse) )                      sys_terminate();
00063         }
00064 }
00065 //------------------------------------------------------------------------------------
00066 void renderMainMenu()
00067 {
00068         Vec2D mouse( input_getMouseX(), input_getMouseY() );                                            // Mouse Cursor
00069         overlay_image( Globals::artWork->mouse, mouse+Vec2D(0.025f,0.025f), Vec2D(0.05f,0.05f), BlendModes::KEY );
00070 
00071         // main menu screen
00072         overlay_image( artWork->main_menuTex, Vec2D(0.5f,0.5f), Vec2D(1.0f,1.0f) );
00073 
00074         // highlight the button that the mouse is currently over
00075         if( butMainSinglePLayer.isContain(mouse) )      drawBox( butMainSinglePLayer, Colors::yellow );
00076         if( butMainMultiPlayer.isContain(mouse) )       drawBox( butMainMultiPlayer, Colors::yellow );
00077         if( butMainCredit.isContain(mouse) )            drawBox( butMainCredit, Colors::yellow );
00078         if( butMainExit.isContain(mouse) )                      drawBox( butMainExit, Colors::yellow );
00079 }
00080 //------------------------------------------------------------------------------------

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