Planeshift
|
00001 /* 00002 * worldeditor.h - Author: Mike Gist 00003 * 00004 * Copyright (C) 2009 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 00020 #include <csutil/ref.h> 00021 #include "util/genericevent.h" 00022 00023 class pawsMainWidget; 00024 class PawsManager; 00025 struct iEngine; 00026 struct iGraphics3D; 00027 struct iKeyboardDriver; 00028 struct iObjectRegistry; 00029 struct iSceneManipulate; 00030 struct iVirtualClock; 00031 struct iView; 00032 00033 class WorldEditor 00034 { 00035 public: 00036 WorldEditor(int argc, char* argv[]); 00037 ~WorldEditor(); 00038 00039 void Run(); 00040 00041 private: 00042 /* Handles an event from the event handler */ 00043 bool HandleEvent(iEvent &ev); 00044 00045 /* Init plugins, paws, world etc. */ 00046 bool Init(); 00047 00048 /* Handles camera movement */ 00049 void HandleMovement(); 00050 00051 /* Handles mesh manipulation */ 00052 void HandleMeshManipulation(iEvent &ev); 00053 00054 // Editing modes 00055 enum EditMode 00056 { 00057 Select = 0, 00058 Create, 00059 TranslateXZ, 00060 TranslateY, 00061 Rotate, 00062 Remove 00063 }; 00064 00065 EditMode editMode; 00066 00067 // Whether to move the camera or the mesh. 00068 bool moveCamera; 00069 00070 // CS 00071 iObjectRegistry* objectReg; 00072 csRef<iView> view; 00073 csRef<iGraphics3D> g3d; 00074 csRef<iEngine> engine; 00075 csRef<iKeyboardDriver> kbd; 00076 csRef<iVirtualClock> vc; 00077 DeclareGenericEventHandler(EventHandler, WorldEditor, "worldeditor"); 00078 00079 // PS 00080 PawsManager* paws; 00081 pawsMainWidget* mainWidget; 00082 csRef<iSceneManipulate> sceneManipulator; 00084 float rotX, rotY; 00085 00086 // Event ids. 00087 csEventID MouseMove; 00088 csEventID MouseDown; 00089 csEventID KeyDown; 00090 csEventID FrameEvent; 00091 };