MercurySprite.h

Go to the documentation of this file.
00001 #ifndef MERCURYSPRITE_H
00002 #define MERCURYSPRITE_H
00003 
00004 #include "MercuryObject.h"
00005 #include "MercuryMesh.h"
00006 #include "MercuryTexture.h"
00007 
00009 class MercurySprite : public MercuryObject
00010 {
00011 public:
00012     virtual void Init();
00013     virtual void Draw();
00014 
00015     virtual void Message( int Message, PStack & data, const MString & name );
00016 
00017     virtual bool Command( PStack & ret, const char * command, PStack & args );
00018     virtual void EnumerateCommands( MVector< MString > & toAdd );
00019     void LoadImage(MString path);
00020 
00021     void LoadMaterial(const MercuryMaterial& material);
00022 
00023     inline void SetWidth(int x) {  if (x != m_origWidth) { m_taintedMatrix |= true; m_origWidth = x; } }
00024     inline void SetHeight(int y) {  if (y != m_origHeight) { m_taintedMatrix |= true; m_origHeight = y; } }
00025     int GetWidth() { return m_origWidth; }
00026     int GetHeight() { return m_origHeight; }
00027 
00029     void MakeOrthoLine( const MercuryPoint &from, const MercuryPoint &to, float fWidth );
00030 
00031     void SetImageAttrs(const ImageAttrs& attrs);
00032     
00033     virtual void CalculateMatrices();
00034     
00035     CLASS_RTTI( MercurySprite, MercuryObject );
00036 private:
00037 
00038     int m_origHeight;
00039     int m_origWidth;
00040 
00041     MercuryMesh m_mesh;
00042     MercuryMaterial m_material;
00043 };
00044 
00045 #endif
00046 
00047 /* 
00048  * Copyright (c) 2005-2006, Joshua Allen
00049  * All rights reserved.
00050  *
00051  * Redistribution and use in source and binary forms, with or
00052  * without modification, are permitted provided that the following
00053  * conditions are met:
00054  *  -   Redistributions of source code must retain the above
00055  *      copyright notice, this list of conditions and the following disclaimer.
00056  *  -   Redistributions in binary form must reproduce the above copyright
00057  *      notice, this list of conditions and the following disclaimer in
00058  *      the documentation and/or other materials provided with the distribution.
00059  *  -   Neither the name of the Mercury Engine nor the names of its
00060  *      contributors may be used to endorse or promote products derived from
00061  *      this software without specific prior written permission.
00062  *
00063  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00064  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00065  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00066  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00067  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00068  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00069  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00070  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00071  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00072  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00073  */

Hosted by SourceForge.net Logo