First cut of drag/draw support (MultiTouch); drag fixes
[numtypysics.git] / Levels.h
blob2ea6edb3f21ffa57abcb5e35f2260ab7c6cd10ed
1 /*
2 * This file is part of NumptyPhysics
3 * Copyright (C) 2008 Tim Edmonds
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
17 #ifndef LEVELS_H
18 #define LEVELS_H
20 #include <cstdio>
21 #include <sstream>
22 #include "Array.h"
24 class Levels
26 public:
27 Levels( int numDirs=0, const char** dirs=NULL );
28 bool addPath( const char* path );
29 bool addLevel( const std::string& file, int rank=-1, int index=-1 );
30 int numLevels();
31 int load( int i, unsigned char* buf, int bufLen );
32 std::string levelName( int i );
33 int findLevel( const char *file );
34 private:
35 bool scanCollection( const std::string& file, int rank );
36 struct LevelDesc
38 LevelDesc( const std::string& f,int r=0, int i=-1)
39 : file(f), index(i), rank(r) {}
40 std::string file;
41 int index;
42 int rank;
44 Array<LevelDesc*> m_levels;
47 #endif //LEVELS_H