guiTerrPreviewCtrl.h
Engine/source/gui/worldEditor/guiTerrPreviewCtrl.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _GUITERRPREVIEWCTRL_H_ 25#define _GUITERRPREVIEWCTRL_H_ 26 27#ifndef _GUICONTROL_H_ 28#include "gui/core/guiControl.h" 29#endif 30#ifndef _GUITSCONTROL_H_ 31#include "gui/3d/guiTSControl.h" 32#endif 33#ifndef _GFX_GFXDRAWER_H_ 34#include "gfx/gfxDrawUtil.h" 35#endif 36#ifndef _TERRAINEDITOR_H_ 37#include "gui/worldEditor/terrainEditor.h" 38#endif 39 40 41class GuiTerrPreviewCtrl : public GuiControl 42{ 43private: 44 typedef GuiControl Parent; 45 GFXTexHandle mTextureHandle; 46 GFXStateBlockRef mTerrainBitmapStateBlock; 47 GFXStateBlockRef mControlsStateBlock; 48 Point2F mRoot; 49 Point2F mOrigin; 50 Point2F mWorldScreenCenter; 51 Point2F mCamera; 52 F32 mTerrainSize; 53 54 TerrainEditor* mTerrainEditor; 55 56 Point2F& wrap(const Point2F &p); 57 Point2F& worldToTexture(const Point2F &p); 58 Point2F& worldToCtrl(const Point2F &p); 59 60 61public: 62 //creation methods 63 DECLARE_CONOBJECT(GuiTerrPreviewCtrl); 64 DECLARE_CATEGORY( "Gui Editor" ); 65 GuiTerrPreviewCtrl(); 66 static void initPersistFields(); 67 68 //Parental methods 69 bool onWake(); 70 void onSleep(); 71 bool onAdd(); 72 73 void setBitmap(const GFXTexHandle&); 74 75 void reset(); 76 void setRoot(); 77 void setRoot(const Point2F &root); 78 void setOrigin(const Point2F &origin); 79 const Point2F& getRoot() { return mRoot; } 80 const Point2F& getOrigin() { return mOrigin; } 81 82 //void setValue(const Point2F *center, const Point2F *camera); 83 //const char *getScriptValue(); 84 void onPreRender(); 85 void onRender(Point2I offset, const RectI &updateRect); 86}; 87 88 89#endif 90