ScreenExample2DSS.h

Go to the documentation of this file.
00001 #ifndef _SCREEN_EXAMPLE_H
00002 #define _SCREEN_EXAMPLE_H
00003 
00004 /********************************************************
00005  * ScreenExample2DSS - Very basic screen for use on the *
00006  * Mercury Game Engine.  This is primarily for          *
00007  * educational purposes.                                *
00008  *                                                      *
00009  * LICENSE NOTE: We ask that if you use this code to    *
00010  * make your own screen based on this one, you simply   *
00011  * ammend the copyright notice at the end of this file  *
00012  * and its repective CPP.                               *
00013  ********************************************************/
00014 
00015 #include "MercuryScreen.h"  //MercuryScreen: most of what you need for a secreen 
00016 
00017 class ScreenExample2DSS : public MercuryScreen  //Abstract from MercuryScreen
00018 {
00019 public:
00020 
00021     //Basic constructors, you should not be doing anything in your constructors.
00022     //Everyhing you need to do on Init should be done on your init function.
00023     ScreenExample2DSS( ) { }
00024     ScreenExample2DSS( const MString & name ):MercuryScreen( name ) { m_name = name; }
00025 
00026     //Destructor, if you don't know what this is or why they can be useful,
00027     //you probally should not be using this example.
00028     virtual ~ScreenExample2DSS();
00029 
00030     //Init:     This is called once Mercury tries to display your screen. You
00031     //          should load any of your objects here, or intilize any of your
00032     //          data members.
00033     virtual void Init();
00034 
00035     //Update:   This is called once every game cycle, before the draw portion.
00036     //          You should include any thing game-related in this.  Moving
00037     //          objects around, sending information to other parts of the game,
00038     //          etc should all be done in this, not your draw.
00039     virtual void Update( const float dTime );
00040 
00041     //Message:  Used for receiving messages from the system.  In the base engine
00042     //          there is only input and focus messages, but you can have classes
00043     //          running concurrently to screens that can broadcast messages.
00044     //          this is how you receive them.
00045     virtual void Message( int Message, PStack & data, const MString & name );
00046 
00047     //Draw:     Used during the draw cycle.  This is optional.  We are using
00048     //          it in this case in order to treat the background specially.
00049     virtual void Draw();
00050 private:
00051     //The following defines a milshape model for use in the screen.
00052     //A milkshape model is any three dimensional object created in Milkshape3D
00053     MercuryMilkshapeModel m_modMan;
00054 
00055     //All objects can contain children.  This is a useful way for managing
00056     //a large amount of objects that can fit togeather in a sort of group.
00057     MercuryObject m_objBoxes;
00058     vector< MercuryMilkshapeModel * > m_vBoxes;
00059 
00060     //Sprites... 2 dimensional objects that can only be viewed from the front.
00061     MercurySprite m_sprTitle;
00062     MercurySprite m_sprBackground;
00063 
00064     //Information regarding the game...
00065     
00066     //MercuryPoints:  A vector of sorts.  Among its members, it has an x, y and
00067     //z.  Basic vector math can be performed on it.
00068 
00069     //Information for "man"
00070     MercuryPoint m_pAcceleration;
00071     MercuryPoint m_pVelocity;
00072     MercuryPoint m_pLocation;
00073 
00074     //Private member function.  This is used to load the map (boxes) from the
00075     //file.
00076     void LoadMap( MString sFileName );
00077 
00078     //Variables for the special zooming (button c)
00079     bool m_bTightZoom;
00080     MercuryPoint m_pOldCamera;
00081 };
00082 
00083 #endif
00084 
00085 /* 
00086  * Copyright (c) 2005-2006, Joshua Allen, Charles Lohr
00087  * All rights reserved.
00088  *
00089  * Redistribution and use in source and binary forms, with or
00090  * without modification, are permitted provided that the following
00091  * conditions are met:
00092  *  -   Redistributions of source code must retain the above
00093  *      copyright notice, this list of conditions and the following disclaimer.
00094  *  -   Redistributions in binary form must reproduce the above copyright
00095  *      notice, this list of conditions and the following disclaimer in
00096  *      the documentation and/or other materials provided with the distribution.
00097  *  -   Neither the name of the Mercury Engine nor the names of its
00098  *      contributors may be used to endorse or promote products derived from
00099  *      this software without specific prior written permission.
00100  *
00101  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00102  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00103  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00104  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00105  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00106  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00107  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00108  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00109  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00110  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00111  */

Hosted by SourceForge.net Logo