00001 /* This file is part of Annchienta. 00002 * Copyright 2008 (C) Jasper Van der Jeugt 00003 * 00004 * Annchienta is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * Annchienta is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with Annchienta. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef ANNCHIENTA_MAPMANAGER_H 00019 #define ANNCHIENTA_MAPMANAGER_H 00020 00021 namespace Annchienta 00022 { 00023 class Map; 00024 class StaticObject; 00025 class InputManager; 00026 class Person; 00027 00028 class MapManager 00029 { 00030 private: 00031 InputManager *inputManager; 00032 00033 int tileWidth, tileHeight; 00034 int cameraX, cameraY; 00035 int updatesPerSecond; 00036 Map *currentMap; 00037 StaticObject *cameraTarget; 00038 00039 int maxAscentHeight, maxDescentHeight; 00040 00041 char *onUpdateScript, *onUpdateCode; 00042 00043 bool running; 00044 00045 public: 00046 #ifndef SWIG 00047 MapManager(); 00048 ~MapManager(); 00049 00050 int getUpdatesNeeded() const; 00051 #endif 00052 00059 void setTileWidth( int tileWidth ); 00060 00063 int getTileWidth() const; 00064 00069 void setTileHeight( int tileHeight ); 00070 00073 int getTileHeight() const; 00074 00079 void setCameraX( int x ); 00080 00083 int getCameraX() const; 00084 00087 void setCameraY( int y ); 00088 00091 int getCameraY() const; 00092 00098 void cameraFollow( StaticObject *object ); 00099 00102 StaticObject *getCameraFollow() const; 00103 00110 void cameraPeekAt( StaticObject *object, bool instantly=false ); 00111 00116 void setUpdatesPerSecond( int ); 00117 00120 void setCurrentMap( Map *map ); 00121 00125 void setNullMap(); 00126 00129 Map *getCurrentMap() const; 00130 00136 void setMaxAscentHeight( int maxAscentHeight ); 00137 00140 int getMaxAscentHeight() const; 00141 00147 void setMaxDescentHeight( int maxDescentHeight ); 00148 00151 int getMaxDescentHeight() const; 00152 00157 StaticObject *getObject( const char *name ); 00158 00162 void setOnUpdateScript( const char *filename ); 00163 00167 void setOnUpdateCode( const char *code ); 00168 00173 void run(); 00174 00177 bool isRunning() const; 00178 00183 void stop(); 00184 00191 void update( bool updateInput=true ); 00192 00196 void updateOnce( bool updateInput=true ); 00197 00200 void draw() const; 00201 00205 void renderFrame() const; 00206 00223 void resync(); 00224 }; 00225 00226 MapManager *getMapManager(); 00227 00228 }; 00229 00230 #endif