utilities.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Mike Polan                                      *
00003  *   kanadakid@gmail.com                                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
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  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 // utilities.h: various extra functions
00021 
00022 #include <iostream>
00023 
00024 #include "case.h"
00025 #include "uimanager.h"
00026 
00028 namespace Utils {
00029 
00031 enum MessageType { MESSAGE_CRITICAL=0, MESSAGE_WARNING };
00032 
00034 extern bool g_DebugOn;
00035 
00037 namespace FS {
00038 
00042 ustring cwd();
00043 
00048 void move(const ustring &from, const ustring &to);
00049 
00054 bool dirExists(const ustring &path);
00055 
00059 void makeDir(const ustring &path);
00060 
00064 void removeDir(const ustring &path);
00065 
00066 } // namespace FS
00067 
00073 void alert(const ustring &text, const MessageType &type=MESSAGE_CRITICAL);
00074 
00082 void scriptToLimits(const ustring &str, UI::Limit &start, UI::Limit &end);
00083 
00088 Color keyToColor(char ch);
00089 
00094 void debugMessage(const ustring &msg);
00095 
00101 bool pointInRect(const Point &p, const Rect &rect);
00102 
00107 Point calculateShakePoint(int highestRadius);
00108 
00114 int randomRange(int min, int max);
00115 
00120 Point getMouseLocation(Uint8 *modState=NULL);
00121 
00127 SDL_Surface* createSurface(int width, int height);
00128 
00133 ustring ucharToStr(uchar ch);
00134 
00139 ustring itoa(int num);
00140 
00146 StringVector explodeString(const ustring &delimiter, const ustring &str);
00147 
00153 StringVector explodeString(uchar delimiter, const ustring &str);
00154 
00160 int amountInString(const ustring &sub, const ustring &str);
00161 
00162 }; // namespace UI

Generated on Fri Feb 22 22:29:23 2008 for Phoenix Wright Case Player API by  doxygen 1.5.3