ScreenMapEditor.h

Go to the documentation of this file.
00001 #ifndef _SCREEN_MAP_EDITOR
00002 #define _SCREEN_MAP_EDITOR
00003 
00004 #include "MercuryScreen.h"
00005 #include "MercuryText.h"
00006 #include "MercuryShapes.h"
00007 #include "MercuryLight.h"
00008 #include "MercuryCamera.h"
00009 
00010 class TextList : public MercuryObject
00011 {
00012 public:
00013     ~TextList();
00014     virtual void Init();
00015     void SetupList( MVector< MString > & vsList );
00016     void UnsetupList();
00017     void Show();
00018     void Hide();
00019     CLASS_RTTI( TextList, MercuryObject );
00020 private:
00021     MercurySprite m_sBG;
00022     vector< MercuryText * > m_vTexts;
00023 };
00024 
00026 class ObjectControlPane : public MercuryObject
00027 {
00028 public:
00029     void Init();
00030     void Update( const float dTime );
00031     void SetObject( MercuryObject * obj, int LX, int LY );
00032     void SetAttributes( const MString & sAttributes );
00033 
00034     MercuryText m_tName;
00035     MercuryText m_tPosition;
00036     MercuryText m_tScale;
00037     MercuryText m_tRotation;
00038     MercuryText m_tAttributes;
00039 
00040     MercuryShape    m_sBackground;
00041     MercuryObject * m_objWatch;
00042     MercuryObject   m_objMimic;
00043     CLASS_RTTI( ObjectControlPane, MercuryObject );
00044 };
00045 
00047 class MercuryTextPrompt : public MercuryObject
00048 {
00049 public:
00050     virtual void Init();
00051     virtual void Update( const float dTime );
00052     virtual void Message( int Message, PStack & data, const MString & name );
00053     void PromptForText( int iMessageWhenDone, MercuryScreen * Notifier, const MString &sPrompt, 
00054         const MString &sDefaultText, bool bAllowCancel = false, bool bSingleChar = false );
00055 
00056     // Input Overlay info.
00057     MercurySprite   m_sTextInOverlay;
00058     MercuryText     m_tTextInOverlayPrompt;
00059     MercuryText     m_tTextInOverlayText;
00060     bool            m_bPromptingForText;
00061     bool            m_bSingleChar;
00062     bool            m_bAllowCancel;
00063     int             m_iMessageWhenDone;
00064     MString         m_sPromptedText;
00065     MercuryScreen * m_objNotify;
00066     CLASS_RTTI( MercuryTextPrompt, MercuryObject );
00067 };
00068 
00070 class ScreenMapEditor : public MercuryScreen
00071 {
00072 public:
00073     ScreenMapEditor():MercuryScreen() { }
00074     ScreenMapEditor( const MString & name ):MercuryScreen( name ) { m_name = name; }
00075 
00076     virtual ~ScreenMapEditor();
00077     virtual void Init();
00078     virtual void Update( const float dTime );
00079     virtual void Render();
00080     virtual void Message( int Message, PStack & data, const MString & name );
00081 
00082     void LoadFile( const MString & sFilename );
00083     void LoadWorld( const MString & sFilename );
00084     void LoadObject( const MString & sFilename );
00085     void NotifyMessage( const MString & sMessage );
00086 
00087     int GenerateObject( MString sObjectIn, int iPieceToReplace = -1 );  //Returns the ID Number of the object.
00088 
00089     void ClearOutArea();
00090 
00091     int SelectObject( int ObjectNumber = -1 );
00092     int GetNumObjects();
00093     int SelectedObject() { return m_iSelectedPart; }
00094     MercuryObject * GetSelectedHandleODE();
00095     MercuryObject * GetSelectedHandleVis();
00096     CLASS_RTTI( ScreenMapEditor, MercuryScreen );
00097 private:
00098     void SetIni( const MString & key, const MString & value, const MString & data );
00099     void RewriteCurrent();
00100     void MakeWorldPiece( int i, const MString & sWorldname, int iReplace = -1 );
00101     float CameraDistance();
00102     
00103     MercuryLight m_light;
00104     MercuryObject   m_fVisibles;
00105     MercuryObject   m_fODEables;
00106     vector< MercuryObject * > m_vODEObjs;
00107     vector< MercuryObject * > m_vVisObjs;
00108 
00109     //These represent the individual pieces of the last loaded object.
00110     //If we're only editing a single object, these are what we care about.
00111     vector< MercuryObject * > m_vLastODE;
00112     vector< MercuryObject * > m_vLastVis;
00113 
00114     MercuryPoint    m_pCameraPos;
00115     MercuryPoint    m_pCameraRot;
00116     MQuaternion     m_qCamera;
00117     MercuryCamera   m_fCamera;
00118 
00119     MercuryObject   m_fOverlays;
00120 
00121     MercuryText     m_tMessage;
00122 
00123     TextList        m_tElems;
00124     bool            m_bShowingElems;
00125 
00126     ObjectControlPane m_pOverlay;
00127     MercuryTextPrompt m_pPrompt;
00128 
00129     MString         m_sFilename;
00130     MString         m_sEditingName;
00131 
00132     MercuryINI      m_iWorldFile;
00133     MercuryINI      m_iTightFile;
00134 
00135     bool            m_bFileLoaded;
00136     bool            m_bWorldLoaded;
00137     bool            m_bObjectLoaded;
00138 
00139     MercuryObject * m_oSelectedPart;
00140 
00141     int             m_iSelectedPart;
00142     int             m_iOldMouseX;
00143     int             m_iOldMouseY;
00144 };
00145 
00146 #endif
00147 
00148 /* 
00149  * Copyright (c) 2006 Charles Lohr
00150  * All rights reserved.
00151  *
00152  * Redistribution and use in source and binary forms, with or
00153  * without modification, are permitted provided that the following
00154  * conditions are met:
00155  *  -   Redistributions of source code must retain the above
00156  *      copyright notice, this list of conditions and the following disclaimer.
00157  *  -   Redistributions in binary form must reproduce the above copyright
00158  *      notice, this list of conditions and the following disclaimer in
00159  *      the documentation and/or other materials provided with the distribution.
00160  *  -   Neither the name of the Mercury Engine nor the names of its
00161  *      contributors may be used to endorse or promote products derived from
00162  *      this software without specific prior written permission.
00163  *
00164  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00165  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00166  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00167  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00168  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00169  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00170  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00171  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00172  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00173  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00174  */

Hosted by SourceForge.net Logo