diff options
| author | jacob1 <jfu614@gmail.com> | 2012-12-06 16:01:46 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2012-12-06 16:01:46 (GMT) |
| commit | 122599763ef9827d7aadc0fe0295c2fbc96e82ab (patch) | |
| tree | dcf0a21b20cd38a12dee93d9db6115da6c0fdb35 /src/game/GameModel.cpp | |
| parent | 2d7ac84c1dca8521f41cf023774b7a90e300b3bf (diff) | |
| parent | 9bf5eeeef919260458637e84f3388b4d7d8204c5 (diff) | |
| download | powder-122599763ef9827d7aadc0fe0295c2fbc96e82ab.zip powder-122599763ef9827d7aadc0fe0295c2fbc96e82ab.tar.gz | |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/game/GameModel.cpp')
| -rw-r--r-- | src/game/GameModel.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 5c4ee97..71d9263 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -9,6 +9,7 @@ #include "Brush.h" #include "EllipseBrush.h" #include "TriangleBrush.h" +#include "BitmapBrush.h" #include "client/Client.h" #include "client/GameSave.h" #include "game/DecorationTool.h" @@ -310,6 +311,26 @@ void GameModel::BuildMenus() brushList.push_back(new Brush(ui::Point(4, 4))); brushList.push_back(new TriangleBrush(ui::Point(4, 4))); + //Load more from brushes folder + std::vector<string> brushFiles = Client::Ref().DirectorySearch(BRUSH_DIR, "", ".ptb"); + for(int i = 0; i < brushFiles.size(); i++) + { + std::vector<unsigned char> brushData = Client::Ref().ReadFile(brushFiles[i]); + if(!brushData.size()) + { + std::cout << "Brushes: Skipping " << brushFiles[i] << ". Could not open" << std::endl; + continue; + } + int dimension = std::sqrt(brushData.size()); + if(dimension * dimension != brushData.size()) + { + std::cout << "Brushes: Skipping " << brushFiles[i] << ". Invalid bitmap size" << std::endl; + continue; + } + brushList.push_back(new BitmapBrush(brushData, ui::Point(dimension, dimension))); + } + + //Set default tools regularToolset[0] = GetToolFromIdentifier("DEFAULT_PT_DUST"); regularToolset[1] = GetToolFromIdentifier("DEFAULT_PT_NONE"); |
